vibe64 0.1.59 → 0.1.60
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 +1070 -1054
- package/bin/server.js +392 -376
- package/bin/upgrade-state.js +4439 -4420
- package/dist/assets/{GithubBrowserTabs-D_nMB5Y1.js → GithubBrowserTabs-Vv-64NIg.js} +1 -1
- package/dist/assets/{LocalDatabaseServer-BgO_aeUg.js → LocalDatabaseServer-rolg-sXl.js} +1 -1
- package/dist/assets/SelectField-DwWoHC2p.js +1 -0
- package/dist/assets/{ShellOutlet-Cr8SJs7s.js → ShellOutlet-Clsh2qYP.js} +1 -1
- package/dist/assets/Vibe64AuthSettingsButton-BICxvZDm.js +5 -0
- package/dist/assets/{Vibe64AuthSettingsButton-DRTKdimW.css → Vibe64AuthSettingsButton-DbL7Ukry.css} +1 -1
- package/dist/assets/{Vibe64ConversationLog-DtOgxPNR.js → Vibe64ConversationLog-K6aUo3q1.js} +4 -4
- package/dist/assets/{Vibe64ConversationLog-NH61odld.css → Vibe64ConversationLog-ksf1U6PP.css} +1 -1
- package/dist/assets/{Vibe64DashboardShell-DhPE6H3P.js → Vibe64DashboardShell-C_wkAaSb.js} +1 -1
- package/dist/assets/{Vibe64DashboardShell-Bpnbjs4l.css → Vibe64DashboardShell-D0GNI4V8.css} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-cfn8TTxQ.css → Vibe64DatabaseWorkspace-De4sbXAN.css} +1 -1
- package/dist/assets/{Vibe64DatabaseWorkspace-CHV0cd3l.js → Vibe64DatabaseWorkspace-Dy88t2ZX.js} +2 -2
- package/dist/assets/Vibe64FileArea-BU5rPyqx.js +1 -0
- package/dist/assets/{Vibe64FileArea-mydNQQl8.css → Vibe64FileArea-ZEzsvLt2.css} +1 -1
- package/dist/assets/Vibe64OutputControls-Z2K52QCc.js +8 -0
- package/dist/assets/{Vibe64RepositoryWorkspace-DUSMn4pR.js → Vibe64RepositoryWorkspace-CWw4w5SA.js} +1 -1
- package/dist/assets/{Vibe64SessionFiles-BXt__PJL.js → Vibe64SessionFiles-DI8ZH6aF.js} +1 -1
- package/dist/assets/{Vibe64SessionSourceEditor-NyG6niQM.js → Vibe64SessionSourceEditor-BVfoXgmZ.js} +1 -1
- package/dist/assets/{Vibe64UiStoryboardView-CtlJWiCY.css → Vibe64UiStoryboardView-BYLWabXY.css} +1 -1
- package/dist/assets/Vibe64UiStoryboardView-C-99xlAo.js +8 -0
- package/dist/assets/{Vibe64UnavailableSessions-CCPWJo8e.js → Vibe64UnavailableSessions-BRB2bUR_.js} +1 -1
- package/dist/assets/{_pageId_-D54CqzqG.js → _pageId_-DPJ8pvUs.js} +1 -1
- package/dist/assets/{_sessionId_-CW044RVi.js → _sessionId_-CiU1Awul.js} +1 -1
- package/dist/assets/_slug_-C5yeqlpL.js +14 -0
- package/dist/assets/{_slug_-WWvJTLoc.css → _slug_-Vy_1jrpy.css} +1 -1
- package/dist/assets/access-BH1OsqPS.css +1 -0
- package/dist/assets/access-Cq6GEVhT.js +1 -0
- package/dist/assets/{app-D9FegZf0.js → app-BKwP6m9e.js} +1 -1
- package/dist/assets/{assistantRouting-D4SnnxJn.js → assistantRouting-BS0ZW5Ki.js} +1 -1
- package/dist/assets/{changes-DtfJc780.js → changes-DT8e3wYn.js} +1 -1
- package/dist/assets/{client-Dra4Vp3A.js → client-BHa4BumO.js} +2 -2
- package/dist/assets/{client-DnjkdG6K.js → client-B_iZQVU8.js} +1 -1
- package/dist/assets/{client-BBqNv4HL.js → client-C-Rw8t8y.js} +1 -1
- package/dist/assets/{client-B8u2_Svv.css → client-CM6TGZc9.css} +1 -1
- package/dist/assets/{client-DuDOzb5A.js → client-Cf6iimPy.js} +2 -2
- package/dist/assets/{client-mU-LObHG.js → client-DWPSlYBq.js} +1 -1
- package/dist/assets/{conversation-QpMeXw70.js → conversation-CsB1b1JZ.js} +1 -1
- package/dist/assets/{conversation-La-pkh5h.css → conversation-DA_fbJJD.css} +1 -1
- package/dist/assets/{dashboard-B26QwE6y.js → dashboard-DRwBugiR.js} +1 -1
- package/dist/assets/{english-definitions-I9tIXY2u.js → english-definitions-Bi3yaDu7.js} +1 -1
- package/dist/assets/{env-BXsvM592.js → env-ObiVMW6f.js} +1 -1
- package/dist/assets/errorMessageHelpers-BjIt31kK.js +1 -0
- package/dist/assets/{errors-DErd0NON.js → errors-D17nJYne.js} +1 -1
- package/dist/assets/{health-C4WtefLm.js → health-Ev-UBIsw.js} +1 -1
- package/dist/assets/history-BSIuLgnI.css +1 -0
- package/dist/assets/history-U6UcbKBZ.js +1 -0
- package/dist/assets/{httpClient-BRO3GqjU.js → httpClient-Bwitq9Xf.js} +1 -1
- package/dist/assets/i18n-BkxO7BMl.js +1 -0
- package/dist/assets/index-Ctygjyf8.css +1 -0
- package/dist/assets/index-Wcdz2Rey.js +134 -0
- package/dist/assets/{integrations-CQNJxkMu.js → integrations-BHURBo17.js} +3 -3
- package/dist/assets/{integrations-CrI893NK.css → integrations-Bo_beIy3.css} +1 -1
- package/dist/assets/issues-D4Asc_wa.css +1 -0
- package/dist/assets/issues-DEzrDqDU.js +1 -0
- package/dist/assets/{learning-0cINHUSN.js → learning-BrBAyLFt.js} +1 -1
- package/dist/assets/{pages-DbF-yXqO.js → pages-5jaEclQo.js} +1 -1
- package/dist/assets/{pages-CIKw99GN.js → pages-BTk_FkDr.js} +1 -1
- package/dist/assets/{pathname-DOqQPPVa.js → pathname-JHQIKk21.js} +1 -1
- package/dist/assets/{placement-BAaZQhAh.js → placement-1lT0lW3-.js} +1 -1
- package/dist/assets/{placement-Lk1Lpy6s.js → placement-B2V88UDJ.js} +1 -1
- package/dist/assets/{project-files-CklWobqZ.js → project-files-CTGwnBh7.js} +1 -1
- package/dist/assets/publish-BYZ7KRzq.js +3 -0
- package/dist/assets/{publish-DOybV3Qz.css → publish-C9O0tDPB.css} +1 -1
- package/dist/assets/{pull-requests-ybnixBv0.js → pull-requests-C-puL4SG.js} +1 -1
- package/dist/assets/{pull-requests-DnEm9m_1.css → pull-requests-DgWKsMdI.css} +1 -1
- package/dist/assets/{repository-wJZei_NJ.js → repository-DknGo0hr.js} +1 -1
- package/dist/assets/settings-BKZcbISO.css +1 -0
- package/dist/assets/settings-BmOQ1NnW.js +1 -0
- package/dist/assets/{shared-X5MxTHwl.js → shared-B6plZPQ_.js} +1 -1
- package/dist/assets/{studioGateApi-CHIdcQvD.js → studioGateApi-UqmdV50W.js} +1 -1
- package/dist/assets/{studioUrls-oIU1Eq_t.js → studioUrls-k_pQIuPs.js} +1 -1
- package/dist/assets/useArchivedVibe64Sessions-DI9ow2ds.js +1 -0
- package/dist/assets/useCommand-YOAaO5Wz.js +1 -0
- package/dist/assets/{useEndpointResource-61E93qP-.js → useEndpointResource-CmMwteuX.js} +1 -1
- package/dist/assets/{usePaths-B-QGqa_I.js → usePaths-CvUbx5-V.js} +1 -1
- package/dist/assets/{useUiFeedback-CycH_fvY.js → useUiFeedback-Bixow9mW.js} +1 -1
- package/dist/assets/useVibe64ConversationLog-BkcPA64C.js +2 -0
- package/dist/assets/{useVibe64Learning-DZCyrfpy.js → useVibe64Learning-RE4HXHqo.js} +1 -1
- package/dist/assets/{useVibe64SessionData-rBvWMqyc.js → useVibe64SessionData-Df7M5k1M.js} +1 -1
- package/dist/assets/{useVibe64SessionSelection-C546mBu8.js → useVibe64SessionSelection-B0USk6X6.js} +1 -1
- package/dist/assets/validators-HqYRjxEO.js +1 -0
- package/dist/assets/{vibe64FileUpload-D0Lv2mMJ.js → vibe64FileUpload-BDkcaUyk.js} +1 -1
- package/dist/assets/vibe64GithubProject-CJneIo5O.js +1 -0
- package/dist/assets/vibe64RepositoryRealtime-DKSXVg1B.js +1 -0
- package/dist/assets/vibe64SessionFocus-BJLy8eTE.js +1 -0
- package/dist/assets/vibe64SessionFocus-DdYRpG72.css +1 -0
- package/dist/index.html +26 -24
- package/docs/colleague-usage/ai-tasks.md +15 -4
- package/docs/colleague-usage/coding-agent-recovery.md +3 -1
- package/docs/colleague-usage/coding-agents.md +19 -1
- package/docs/colleague-usage/connected-repositories.md +16 -4
- package/docs/colleague-usage/files.md +2 -1
- package/docs/colleague-usage/github-work.md +50 -11
- package/docs/colleague-usage/health-checks.md +1 -1
- package/docs/colleague-usage/preview-browser-checks.md +3 -0
- package/docs/colleague-usage/preview.md +29 -0
- package/docs/colleague-usage/project-messages.md +3 -2
- package/docs/colleague-usage/project-settings.md +3 -0
- package/docs/colleague-usage/session-archive.md +9 -0
- package/docs/colleague-usage/sessions.md +5 -4
- package/docs/colleague-usage/temporary-chats.md +4 -3
- package/docs/colleague-usage/usage-map.md +3 -2
- package/docs/colleague-usage/workspace-preparation.md +12 -0
- package/node_modules/@jskit-ai/agent/CHANGELOG.md +5 -0
- package/node_modules/@jskit-ai/agent/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-core/CHANGELOG.md +8 -0
- package/node_modules/@jskit-ai/assistant-core/package.json +1 -1
- package/node_modules/@jskit-ai/assistant-runtime/CHANGELOG.md +4 -0
- 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/connector-google-calendar/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-catalog/package.json +1 -1
- package/node_modules/@jskit-ai/connectors-core/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/connectors-core/README.md +4 -0
- package/node_modules/@jskit-ai/connectors-core/package.json +1 -1
- package/node_modules/@jskit-ai/http-runtime/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/http-runtime/package.json +1 -1
- package/node_modules/@jskit-ai/kernel/CHANGELOG.md +7 -0
- package/node_modules/@jskit-ai/kernel/package.json +1 -1
- package/node_modules/@jskit-ai/payments-core/package.json +1 -1
- package/node_modules/@jskit-ai/realtime/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/realtime/package.json +1 -1
- package/node_modules/@jskit-ai/resource-core/CHANGELOG.md +1 -0
- package/node_modules/@jskit-ai/resource-core/package.json +1 -1
- package/node_modules/@jskit-ai/uploads-runtime/package.json +1 -1
- package/node_modules/@local/vibe64-execution/src/host/execHelper.js +428 -423
- package/node_modules/@local/vibe64-genesis/bin/genesis +17 -11
- package/node_modules/@local/vibe64-genesis/bin/vibe64-genesis-host-context +830 -816
- package/node_modules/@local/vibe64-genesis/src/server/index.js +533 -519
- package/node_modules/@local/vibe64-genesis/src/server/promptContext.js +172 -169
- package/node_modules/@local/vibe64-runtime/src/server/codexAppServerProcess.js +490 -479
- package/node_modules/@local/vibe64-source-editor/src/server/searchIndexWorker.js +12 -11
- package/node_modules/@local/vibe64-system-graph/README.md +9 -5
- package/node_modules/@local/vibe64-terminals/src/server/opencodeSessionEnvironmentPlugin.js +262 -252
- package/node_modules/@local/vibe64-terminals/src/server/sessionWorkOperationCommand.js +1060 -1018
- package/node_modules/json-rest-schema/README.md +3 -1
- package/node_modules/json-rest-schema/package.json +1 -1
- package/package.json +17 -17
- package/server.bundle.mjs +43046 -42782
- package/dist/assets/Vibe64AuthSettingsButton-Bx9patil.js +0 -5
- package/dist/assets/Vibe64FileArea-DIDyAUvD.js +0 -1
- package/dist/assets/Vibe64OutputControls-mNWUWLSm.js +0 -8
- package/dist/assets/Vibe64UiStoryboardView-BXH2MSWn.js +0 -8
- package/dist/assets/_slug_-CRtFhc0A.js +0 -14
- package/dist/assets/access-ChMLRErk.js +0 -1
- package/dist/assets/access-Cm2lrMF6.css +0 -1
- package/dist/assets/errorMessageHelpers-L2GsOwCP.js +0 -1
- package/dist/assets/history-BhqQz5jH.css +0 -1
- package/dist/assets/history-HHPFoNi3.js +0 -1
- package/dist/assets/index-BBfSvf2i.css +0 -1
- package/dist/assets/index-Bvd00puv.js +0 -134
- package/dist/assets/issues-BHr_nI-9.js +0 -1
- package/dist/assets/issues-CpBRQTQ_.css +0 -1
- package/dist/assets/publish-Cot797YN.js +0 -3
- package/dist/assets/settings-DJByC5Wb.js +0 -1
- package/dist/assets/settings-bEkDjn0Y.css +0 -1
- package/dist/assets/useArchivedVibe64Sessions-B-DtXrk-.js +0 -1
- package/dist/assets/useCommand-D96utlVe.js +0 -1
- package/dist/assets/useVibe64ConversationLog-BVANhCHq.js +0 -2
- package/dist/assets/validators-B3YzM6px.js +0 -1
- package/dist/assets/vibe64GithubProject-DNl0aDcC.js +0 -1
- package/dist/assets/vibe64RepositoryRealtime-BPsE5l5E.js +0 -1
- package/dist/assets/vibe64SessionFocus-CxX2nK6F.js +0 -1
- package/dist/assets/vibe64SessionFocus-DW73PN_o.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Et as unref,G as renderList,H as openBlock,Xt as toDisplayString,b as createVNode,d as createBaseVNode,f as createBlock,ft as isRef,i as Fragment,it as watch,m as createElementBlock,ot as withCtx,p as createCommentVNode,u as computed,vt as ref,y as createTextVNode}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{t as useEndpointResource}from"./useEndpointResource-61E93qP-.js";import{_ as useRouter,g as useRoute}from"./useApi-BPuI6ZR9-rsYWyW6m.js";import{t as VSelect}from"./VSelect-9lMtP5cu.js";import{t as VAlert}from"./VAlert-DyCQWe9P.js";import{t as VTextField}from"./VTextField-BMvaWVTN.js";import{i as scopedDevelopmentApiUrl}from"./studioUrls-oIU1Eq_t.js";import{o as ROUTE_VISIBILITY_PUBLIC}from"./visibility-Cq31Xy7I.js";import{t as VBtn}from"./VBtn-2vbH580C.js";import{t as VCheckbox}from"./VCheckbox-B40zJSbZ.js";import{n as VRadio,t as VRadioGroup}from"./VRadioGroup-D1duMMwJ.js";import{t as VSwitch}from"./VSwitch-DUkp5sfW.js";import{t as VTextarea}from"./VTextarea-CLaWcpd_.js";import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper-DNW4j-dv.js";import{r as useRealtimeEvent}from"./useRealtimeEvent-B4oRg9Dt.js";import{t as useCommand}from"./useCommand-D96utlVe.js";import{o as reloadPage}from"./browser-D8z6v6Ge.js";import{c as VIBE64_SESSION_SUMMARY_CHANGED_EVENT}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{A as projectSettingsQueryKey,E as engineeringSettingsQueryKey,S as VIBE64_PROJECT_CHANGED_EVENT,T as VIBE64_PROMPT_HINTS_SETTINGS_API_SUFFIX,_ as VIBE64_ENGINEERING_API_SUFFIX,d as PROMPT_HINTS_SETTINGS_ENDPOINT,g as VIBE64_DEVELOPMENT_DATABASE_API_SUFFIX,m as VIBE64_COLLABORATION_API_SUFFIX,n as DEVELOPMENT_DATABASE_ENDPOINT,r as ENGINEERING_ENDPOINT,t as COLLABORATION_ENDPOINT,u as PROJECT_SETTINGS_ENDPOINT}from"./studioGateApi-CHIdcQvD.js";import{P as useVibe64ProjectSlug,j as requestVibe64AccountConnectionsDialog}from"./index-Bvd00puv.js";import{t as Vibe64AsyncModuleState_default}from"./Vibe64AsyncModuleState-C9rLM2H0.js";import{t as sessionListRealtimeShouldRefresh}from"./useVibe64SessionData-rBvWMqyc.js";var CONNECTED_CUSTOM_PACKAGE_TYPE=`custom`;var CONNECTED_PACKAGE_TYPES=Object.freeze([Object.freeze({value:`npm`,label:`npm (Node.js)`}),Object.freeze({value:`composer`,label:`Composer (PHP)`}),Object.freeze({value:`pip`,label:`pip (Python)`}),Object.freeze({value:`bundler`,label:`Bundler (Ruby)`}),Object.freeze({value:`gomod`,label:`Go modules`}),Object.freeze({value:`cargo`,label:`Cargo (Rust)`}),Object.freeze({value:`maven`,label:`Maven`}),Object.freeze({value:`gradle`,label:`Gradle`}),Object.freeze({value:`nuget`,label:`NuGet (.NET)`}),Object.freeze({value:CONNECTED_CUSTOM_PACKAGE_TYPE,label:`custom`})]);var CONNECTED_PACKAGE_TYPE_VALUES=Object.freeze(CONNECTED_PACKAGE_TYPES.map(type=>type.value));function connectedPackageTypeUsesScript(type){return type===CONNECTED_CUSTOM_PACKAGE_TYPE}var _hoisted_1$2={class:`project-settings__section`,"aria-labelledby":`connected-projects-title`};var _hoisted_2$1={class:`project-settings__content text-body-medium`};var _hoisted_3$1={key:0};var _hoisted_4$1={key:0};var _hoisted_5$1=[`disabled`];var _hoisted_6$1={class:`text-label-large`};var _hoisted_7$1={key:2};var _hoisted_8$1={class:`connection-actions`};var _sfc_main$2={__name:`ConnectedProjectsSettings`,props:{projectSlug:{type:String,required:true},state:{type:Object,default:()=>({})}},emits:[`saved`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const draft=ref([]);const baseline=ref(`[]`);const revision=ref(``);const saving=ref(false);const changed=computed(()=>JSON.stringify(draft.value)!==baseline.value);const stale=computed(()=>props.state.available&&revision.value!==props.state.revision);const relationships=[{label:`Dependency — a library or tool`,value:`dependency`},{label:`Composition — source assembled into this project`,value:`composition`}];const packageTypes=[{label:`Stack default`,value:``},...CONNECTED_PACKAGE_TYPES];function scriptAllowed(entry){return!entry.type||connectedPackageTypeUsesScript(entry.type)}function setPackageType(entry,value){if(value)entry.type=value;else delete entry.type;if(!scriptAllowed(entry))delete entry.script}function setScript(entry,value){if(value)entry.script=value;else delete entry.script}function resetDraft(){draft.value=(props.state.repositories||[]).map(entry=>({...entry}));baseline.value=JSON.stringify(draft.value);revision.value=props.state.revision||``}let sourceIdentity=``;watch(()=>[props.projectSlug,props.state],()=>{if(!props.state.source)return;const identity=JSON.stringify([props.projectSlug,props.state.source]);if(identity!==sourceIdentity||!changed.value)resetDraft();sourceIdentity=identity},{immediate:true});const saveCommand=useCommand({access:`never`,apiSuffix:`/vibe64/settings/connections`,buildCommandOptions:()=>({method:`PUT`,path:scopedDevelopmentApiUrl(`/api/vibe64/settings/connections`,props.projectSlug)}),buildRawPayload:(_model,{context})=>context,fallbackRunError:`Connected repositories could not be saved.`,messages:{error:`Connected repositories could not be saved.`,success:`Connected repositories saved in source.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.project.connections.save`,surfaceId:`app`,writeMethod:`PUT`});async function save(){if(saving.value||stale.value||!props.state.canEdit)return;saving.value=true;try{if(!await saveCommand.run({repositories:draft.value.map(entry=>({...entry})),revision:revision.value,sessionId:props.state.source?.sessionId||``}))return;baseline.value=JSON.stringify(draft.value);emit(`saved`)}catch{}finally{saving.value=false}}return(_ctx,_cache)=>{return openBlock(),createElementBlock(`section`,_hoisted_1$2,[_cache[6]||(_cache[6]=createBaseVNode(`div`,{class:`project-settings__section-copy text-body-medium`},[createBaseVNode(`h2`,{id:`connected-projects-title`,class:`text-title-medium font-weight-bold`},`Connected repositories`),createBaseVNode(`p`,null,`Libraries and source projects you contribute to from this project.`),createBaseVNode(`p`,null,[createTextVNode(`Saved in this source checkout’s `),createBaseVNode(`code`,null,`vibe64.connections.json`),createTextVNode(`. Changes follow normal project Save.`)])],-1)),createBaseVNode(`div`,_hoisted_2$1,[!__props.state.available?(openBlock(),createElementBlock(`p`,_hoisted_3$1,toDisplayString(__props.state.unavailableReason||`Select a session to configure connected repositories.`),1)):(openBlock(),createElementBlock(Fragment,{key:1},[!__props.state.exists?(openBlock(),createElementBlock(`p`,_hoisted_4$1,`No connection file yet. Add repositories below, then save the list.`)):createCommentVNode(``,true),stale.value?(openBlock(),createBlock(VAlert,{key:1,type:`warning`,variant:`tonal`},{default:withCtx(()=>[_cache[2]||(_cache[2]=createTextVNode(` The saved list changed while you were editing. Reload the saved list and review your changes before saving. `,-1)),createVNode(VBtn,{variant:`text`,onClick:resetDraft},{default:withCtx(()=>[..._cache[1]||(_cache[1]=[createTextVNode(`Reload saved list`,-1)])]),_:1})]),_:1})):createCommentVNode(``,true),(openBlock(true),createElementBlock(Fragment,null,renderList(draft.value,(entry,index)=>{return openBlock(),createElementBlock(`fieldset`,{key:index,class:`connection-entry`,disabled:!__props.state.canEdit||saving.value},[createBaseVNode(`legend`,_hoisted_6$1,`Connected repository `+toDisplayString(index+1),1),createVNode(VTextField,{disabled:!__props.state.canEdit||saving.value,modelValue:entry.name,"onUpdate:modelValue":$event=>entry.name=$event,label:`Name`,maxlength:`100`,variant:`outlined`,"hide-details":`auto`},null,8,[`disabled`,`modelValue`,`onUpdate:modelValue`]),createVNode(VTextField,{disabled:!__props.state.canEdit||saving.value,modelValue:entry.repository,"onUpdate:modelValue":$event=>entry.repository=$event,label:`GitHub repository URL`,placeholder:`https://github.com/owner/repository`,variant:`outlined`,"hide-details":`auto`},null,8,[`disabled`,`modelValue`,`onUpdate:modelValue`]),createVNode(VSelect,{disabled:!__props.state.canEdit||saving.value,modelValue:entry.relationship,"onUpdate:modelValue":$event=>entry.relationship=$event,label:`Relationship`,items:relationships,"item-title":`label`,"item-value":`value`,variant:`outlined`,"hide-details":`auto`},null,8,[`disabled`,`modelValue`,`onUpdate:modelValue`]),createVNode(VSelect,{disabled:!__props.state.canEdit||saving.value,"model-value":entry.type||``,"onUpdate:modelValue":$event=>setPackageType(entry,$event),label:`Package type`,items:packageTypes,"item-title":`label`,"item-value":`value`,variant:`outlined`,"hide-details":`auto`},null,8,[`disabled`,`model-value`,`onUpdate:modelValue`]),createVNode(VTextField,{disabled:!__props.state.canEdit||saving.value||!scriptAllowed(entry),"model-value":entry.script||``,"onUpdate:modelValue":$event=>setScript(entry,$event),label:`Preparation script (project-relative)`,placeholder:`tooling/prepare-native-worker.mjs`,maxlength:`1024`,hint:`Required for custom. Relative to this project's root; Stack declares the runtime.`,"persistent-hint":``,variant:`outlined`,"hide-details":`auto`},null,8,[`disabled`,`model-value`,`onUpdate:modelValue`]),createVNode(VBtn,{disabled:!__props.state.canEdit||saving.value,variant:`text`,"aria-label":`Remove ${entry.name||`connected repository`}`,onClick:$event=>draft.value.splice(index,1)},{default:withCtx(()=>[..._cache[3]||(_cache[3]=[createTextVNode(`Remove`,-1)])]),_:1},8,[`disabled`,`aria-label`,`onClick`])],8,_hoisted_5$1)}),128)),__props.state.exists&&!draft.value.length?(openBlock(),createElementBlock(`p`,_hoisted_7$1,`No connected repositories.`)):createCommentVNode(``,true),_cache[5]||(_cache[5]=createBaseVNode(`p`,{class:`text-body-small`},`Removing a connection keeps each session's copy of it until that copy's work is saved.`,-1)),createBaseVNode(`div`,_hoisted_8$1,[createVNode(VBtn,{disabled:!__props.state.canEdit||saving.value||draft.value.length>=unref(64),variant:`outlined`,onClick:_cache[0]||(_cache[0]=$event=>draft.value.push({name:``,repository:``,relationship:`dependency`}))},{default:withCtx(()=>[..._cache[4]||(_cache[4]=[createTextVNode(`Add repository`,-1)])]),_:1},8,[`disabled`]),createVNode(VBtn,{disabled:!__props.state.canEdit||saving.value||stale.value||!changed.value&&__props.state.exists,color:`primary`,variant:`flat`,onClick:save},{default:withCtx(()=>[createTextVNode(toDisplayString(saving.value?`Saving…`:`Save connected repositories`),1)]),_:1},8,[`disabled`])])],64))])])}}};var ConnectedProjectsSettings_default=_plugin_vue_export_helper_default(_sfc_main$2,[[`__scopeId`,`data-v-3ce2b74d`]]);function normalizeCollaborationDraft(value={}){return{tone:String(value.tone||``),responseLength:String(value.responseLength||``),experience:String(value.experience||``),explanationStyle:String(value.explanationStyle||``),requirements:String(value.requirements||``)}}function collaborationChoiceOptions(collaboration={},field=``){const choices=collaboration.choices?.[field];return(Array.isArray(choices)?choices:[]).flatMap(choice=>{const value=String(choice?.id||``).trim();const label=String(choice?.name||``).trim();return value&&label?[{label,value}]:[]})}function useVibe64CollaborationSettings({projectSlug,resource,routeSessionId}){const collaborationDraft=ref(normalizeCollaborationDraft());const savedCollaboration=ref(normalizeCollaborationDraft());const collaborationSaveCommand=useCommand({access:`never`,apiSuffix:VIBE64_COLLABORATION_API_SUFFIX,buildCommandOptions:()=>({method:`PUT`,path:COLLABORATION_ENDPOINT}),buildRawPayload:(_model,{context})=>({...context.collaboration,...context.sessionId?{sessionId:context.sessionId}:{}}),fallbackRunError:`Collaboration guidance could not be saved.`,messages:{error:`Collaboration guidance could not be saved.`,success:`Collaboration guidance saved.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.collaboration.save`,surfaceId:`app`,writeMethod:`PUT`});const collaboration=computed(()=>resource.data.value?.collaboration||{});const collaborationAvailable=computed(()=>collaboration.value.available===true);const collaborationCanEdit=computed(()=>collaboration.value.canEdit===true);const collaborationSourceLabel=computed(()=>collaboration.value.source?.rootKind===`session-source`?`This session's project source`:`This project source`);const collaborationUnavailableReason=computed(()=>String(collaboration.value.unavailableReason||`Collaboration guidance is not available for this source.`));const toneOptions=computed(()=>collaborationChoiceOptions(collaboration.value,`tone`));const responseLengthOptions=computed(()=>collaborationChoiceOptions(collaboration.value,`responseLength`));const experienceOptions=computed(()=>collaborationChoiceOptions(collaboration.value,`experience`));const explanationStyleOptions=computed(()=>collaborationChoiceOptions(collaboration.value,`explanationStyle`));const collaborationSaving=ref(false);const collaborationChanged=computed(()=>JSON.stringify(collaborationDraft.value)!==JSON.stringify(savedCollaboration.value));let collaborationSource=null;watch([projectSlug,collaboration],([slug,value])=>{if(!value.source)return;const sourceChanged=!collaborationSource||collaborationSource.projectSlug!==slug||collaborationSource.rootKind!==value.source.rootKind||collaborationSource.sessionId!==value.source.sessionId;const next=normalizeCollaborationDraft(value);if(sourceChanged||!collaborationChanged.value)collaborationDraft.value=next;savedCollaboration.value={...next};collaborationSource={projectSlug:slug,...value.source}},{immediate:true});async function saveCollaboration(){if(!collaborationChanged.value||!collaborationAvailable.value||!collaborationCanEdit.value||collaborationSaving.value)return;collaborationSaving.value=true;try{try{await collaborationSaveCommand.run({collaboration:normalizeCollaborationDraft(collaborationDraft.value),sessionId:routeSessionId.value||String(collaboration.value.source?.sessionId||``).trim()})}catch{return}await resource.reload()}finally{collaborationSaving.value=false}}return{collaborationAvailable,collaborationCanEdit,collaborationChanged,collaborationDraft,collaborationSaving,collaborationSourceLabel,collaborationUnavailableReason,experienceOptions,explanationStyleOptions,responseLengthOptions,saveCollaboration,toneOptions}}function useVibe64DevelopmentDatabaseSettings({resource}){const scopeDraft=ref(`session`);const sharedSessionsDraft=ref(false);const databaseSaveCommand=useCommand({access:`never`,apiSuffix:VIBE64_DEVELOPMENT_DATABASE_API_SUFFIX,buildCommandOptions:()=>({method:`PUT`,path:DEVELOPMENT_DATABASE_ENDPOINT}),buildRawPayload:(_model,{context})=>({scope:context.scope,allowSharedDatabaseSessions:context.allowSharedDatabaseSessions}),fallbackRunError:`Development database choice could not be saved.`,messages:{error:`Development database choice could not be saved.`,success:`Development database choice saved.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.development-database.scope.save`,surfaceId:`app`,writeMethod:`PUT`});const developmentDatabase=computed(()=>resource.data.value?.developmentDatabase||{});const managed=computed(()=>developmentDatabase.value.managed===true);const canChange=computed(()=>developmentDatabase.value.canChange===true);const disabledReason=computed(()=>String(developmentDatabase.value.disabledReason||``));const sessionScopeOption=computed(()=>developmentDatabase.value.options?.session||{});const projectScopeOption=computed(()=>developmentDatabase.value.options?.project||{});const sessionScopeAvailable=computed(()=>sessionScopeOption.value.available===true);const projectScopeAvailable=computed(()=>projectScopeOption.value.available===true);const sessionScopeReason=computed(()=>String(sessionScopeOption.value.disabledReason||``));const projectScopeReason=computed(()=>String(projectScopeOption.value.disabledReason||``));const scopeDraftAvailable=computed(()=>scopeDraft.value===`project`?projectScopeAvailable.value:sessionScopeAvailable.value);const databaseSaving=computed(()=>databaseSaveCommand.isRunning===true);const databaseChanged=computed(()=>managed.value&&(scopeDraft.value!==developmentDatabase.value.scope||sharedSessionsDraft.value!==(developmentDatabase.value.allowSharedDatabaseSessions===true)));const databaseSaveAllowed=computed(()=>scopeDraft.value===developmentDatabase.value.scope||canChange.value&&scopeDraftAvailable.value);watch(()=>developmentDatabase.value.allowSharedDatabaseSessions,value=>{sharedSessionsDraft.value=value===true},{immediate:true});watch(()=>developmentDatabase.value.scope,scope=>{if([`project`,`session`].includes(scope))scopeDraft.value=scope},{immediate:true});async function saveDatabase(){if(!databaseChanged.value||!databaseSaveAllowed.value||databaseSaving.value)return;await databaseSaveCommand.run({scope:scopeDraft.value,allowSharedDatabaseSessions:sharedSessionsDraft.value});await resource.reload()}return{databaseChanged,databaseSaveAllowed,databaseSaving,disabledReason,managed,projectScopeAvailable,projectScopeReason,saveDatabase,scopeDraft,sessionScopeAvailable,sessionScopeReason,sharedSessionsDraft}}function useVibe64EngineeringSettings({projectSlug,route,router,routeSessionId}){const engineeringProfileDraft=ref(``);const savedEngineeringProfile=ref(``);const engineeringResource=useEndpointResource({fallbackLoadError:`Engineering approach could not load.`,path:computed(()=>scopedDevelopmentApiUrl(ENGINEERING_ENDPOINT,projectSlug.value)),queryKey:computed(()=>engineeringSettingsQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,projectSlug.value,routeSessionId.value)),readQuery:computed(()=>routeSessionId.value?{sessionId:routeSessionId.value}:{}),realtime:{event:VIBE64_PROJECT_CHANGED_EVENT,matches:()=>!engineeringSaveCommand.isRunning},refreshOnPull:true,requestRecoveryLabel:`Engineering approach`});const engineeringSaveCommand=useCommand({access:`never`,apiSuffix:VIBE64_ENGINEERING_API_SUFFIX,buildCommandOptions:()=>({method:`PUT`,path:ENGINEERING_ENDPOINT}),buildRawPayload:(_model,{context})=>({profile:context.profile,...context.sessionId?{sessionId:context.sessionId}:{}}),fallbackRunError:`Engineering approach could not be saved.`,messages:{error:`Engineering approach could not be saved.`,success:`Engineering approach saved.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.engineering.profile.save`,surfaceId:`app`,writeMethod:`PUT`});const engineering=computed(()=>engineeringResource.data.value?.engineering||{});const engineeringAvailable=computed(()=>engineering.value.available===true);const engineeringProfiles=computed(()=>Array.isArray(engineering.value.profiles)?engineering.value.profiles:[]);const engineeringSourceLabel=computed(()=>engineering.value.source?.rootKind===`session-source`?`This session's project source`:`This project source`);const engineeringUnavailableReason=computed(()=>String(engineering.value.unavailableReason||`An engineering profile is not available for this source.`));const selectedEngineeringDescription=computed(()=>String(engineeringProfiles.value.find(profile=>profile.id===engineeringProfileDraft.value)?.description||``));const engineeringStatusText=computed(()=>engineering.value.status===`defaulted`?`The focused default is active. Saving records the choice in genesis/engineering.md.`:`This choice is stored in genesis/engineering.md and follows the source.`);const engineeringSaving=ref(false);const engineeringChanged=computed(()=>engineeringAvailable.value&&Boolean(engineeringProfileDraft.value)&&engineeringProfileDraft.value!==savedEngineeringProfile.value);let engineeringSource=null;watch([projectSlug,engineering],([slug,value])=>{if(!value.source)return;const sourceChanged=!engineeringSource||engineeringSource.projectSlug!==slug||engineeringSource.rootKind!==value.source.rootKind||engineeringSource.sessionId!==value.source.sessionId;const profile=String(value.profile?.id||``).trim();if(sourceChanged||engineeringProfileDraft.value===savedEngineeringProfile.value)engineeringProfileDraft.value=profile;savedEngineeringProfile.value=profile;engineeringSource={projectSlug:slug,...value.source};const sourceSessionId=String(value.source?.sessionId||``).trim();if(!routeSessionId.value&&sourceSessionId)router.replace({query:{...route.query,sessionId:sourceSessionId}})},{immediate:true});async function saveEngineeringProfile(){if(!engineeringChanged.value||engineeringSaving.value)return;engineeringSaving.value=true;try{await engineeringSaveCommand.run({profile:engineeringProfileDraft.value,sessionId:routeSessionId.value||String(engineering.value.source?.sessionId||``).trim()})}catch{}finally{try{await engineeringResource.reload()}finally{engineeringSaving.value=false}}}return{engineeringAvailable,engineeringChanged,engineeringProfileDraft,engineeringProfiles,engineeringResource,engineeringSaving,engineeringSourceLabel,engineeringStatusText,engineeringUnavailableReason,saveEngineeringProfile,selectedEngineeringDescription}}var _hoisted_1$1={class:`project-settings`};var _hoisted_2={class:`project-settings__header`};var _hoisted_3={class:`project-settings__section`,"aria-labelledby":`engineering-approach-title`};var _hoisted_4={class:`project-settings__section-copy text-body-medium`};var _hoisted_5={key:0,class:`project-settings__scope text-label-medium`};var _hoisted_6={key:0,class:`project-settings__content text-body-medium`};var _hoisted_7={class:`project-settings__engineering-field`};var _hoisted_8={class:`project-settings__action text-body-small`};var _hoisted_9={key:1,class:`project-settings__action text-body-small`};var _hoisted_10={class:`project-settings__section`,"aria-labelledby":`development-database-title`};var _hoisted_11={class:`project-settings__section-copy text-body-medium`};var _hoisted_12={key:0};var _hoisted_13={key:1};var _hoisted_14={key:0,class:`project-settings__content text-body-medium`};var _hoisted_15={class:`project-settings__option`};var _hoisted_16={key:0,id:`development-database-session-reason`,class:`project-settings__option-support text-body-small`};var _hoisted_17={class:`project-settings__option`};var _hoisted_18={key:0,id:`development-database-project-reason`,class:`project-settings__option-support text-body-small`};var _hoisted_19={key:0,class:`project-settings__action text-body-small`};var _hoisted_20={class:`project-settings__action text-body-small`};var _hoisted_21={key:0};var _hoisted_22={key:1};var _hoisted_23={class:`project-settings__section`,"aria-labelledby":`ai-behaviour-title`};var _hoisted_24={class:`project-settings__section-copy text-body-medium`};var _hoisted_25={class:`project-settings__scope text-label-medium`};var _hoisted_26={class:`project-settings__content text-body-medium`};var _hoisted_27={class:`project-settings__ai-fields`};var _hoisted_28={class:`project-settings__action text-body-small`};var _hoisted_29={key:0};var _hoisted_30={key:1};var _hoisted_31={key:2};var _hoisted_32={class:`project-settings__section`,"aria-labelledby":`prompt-suggestions-title`};var _hoisted_33={class:`project-settings__content text-body-medium`};var _hoisted_34={class:`project-settings__action text-body-small`};var _hoisted_35={key:0,class:`project-settings__section`,"aria-labelledby":`repository-workflow-title`};var _hoisted_36={class:`project-settings__content text-body-medium`};var _hoisted_37={class:`project-settings__action text-body-small`};var _sfc_main$1={__name:`ProjectSettingsPanel`,setup(__props){const projectSlug=useVibe64ProjectSlug();const route=useRoute();const router=useRouter();const promptHintsDraft=ref(true);const savedPromptHints=ref(true);const requirePullRequest=ref(false);const routeSessionId=computed(()=>String(route.query.sessionId||``).trim());const resource=useEndpointResource({fallbackLoadError:`Project settings could not load.`,path:computed(()=>scopedDevelopmentApiUrl(PROJECT_SETTINGS_ENDPOINT,projectSlug.value)),queryKey:computed(()=>projectSettingsQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,projectSlug.value,routeSessionId.value)),readQuery:computed(()=>routeSessionId.value?{sessionId:routeSessionId.value}:{}),refreshOnPull:true,requestRecoveryLabel:`Project settings`});const{databaseChanged,databaseSaveAllowed,databaseSaving,disabledReason,managed,projectScopeAvailable,projectScopeReason,saveDatabase,scopeDraft,sessionScopeAvailable,sessionScopeReason,sharedSessionsDraft}=useVibe64DevelopmentDatabaseSettings({resource});const{collaborationAvailable,collaborationCanEdit,collaborationChanged,collaborationDraft,collaborationSaving,collaborationSourceLabel,collaborationUnavailableReason,experienceOptions,explanationStyleOptions,responseLengthOptions,saveCollaboration,toneOptions}=useVibe64CollaborationSettings({projectSlug,resource,routeSessionId});const promptHintsSaveCommand=useCommand({access:`never`,apiSuffix:VIBE64_PROMPT_HINTS_SETTINGS_API_SUFFIX,buildCommandOptions:()=>({method:`PUT`,path:PROMPT_HINTS_SETTINGS_ENDPOINT}),buildRawPayload:(_model,{context})=>({promptHints:context.promptHints}),fallbackRunError:`Prompt suggestions could not be saved.`,messages:{error:`Prompt suggestions could not be saved.`,success:`Prompt suggestions saved.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.prompt-hints.save`,surfaceId:`app`,writeMethod:`PUT`});const repositoryWorkflowCommand=useCommand({access:`never`,apiSuffix:`/vibe64/repository/workflow`,buildCommandOptions:()=>({method:`PUT`,path:scopedDevelopmentApiUrl(`/api/vibe64/repository/workflow`,projectSlug.value)}),buildRawPayload:(_model,{context})=>({requirePullRequest:context.requirePullRequest}),fallbackRunError:`Repository workflow could not be saved.`,messages:{error:`Repository workflow could not be saved.`,success:`Repository workflow saved.`},ownershipFilter:ROUTE_VISIBILITY_PUBLIC,placementSource:`vibe64.repository.workflow`,surfaceId:`app`,writeMethod:`PUT`});const repositoryWorkflow=computed(()=>resource.data.value?.repositoryWorkflow||{});watch(()=>repositoryWorkflow.value.requirePullRequest,value=>{requirePullRequest.value=value===true},{immediate:true});async function saveRepositoryWorkflow(){await repositoryWorkflowCommand.run({requirePullRequest:requirePullRequest.value});await resource.reload()}const{engineeringAvailable,engineeringChanged,engineeringProfileDraft,engineeringProfiles,engineeringResource,engineeringSaving,engineeringSourceLabel,engineeringStatusText,engineeringUnavailableReason,saveEngineeringProfile,selectedEngineeringDescription}=useVibe64EngineeringSettings({projectSlug,route,router,routeSessionId});const promptHints=computed(()=>resource.data.value?.promptHints||{});const promptHintsCanEdit=computed(()=>promptHints.value.canEdit===true);const loading=computed(()=>resource.isLoading.value===true||engineeringResource.isLoading.value===true);const initialLoading=computed(()=>loading.value&&(!resource.data.value||!engineeringResource.data.value));const loadError=computed(()=>String(resource.loadError.value||engineeringResource.loadError.value||``));const promptHintsSaving=computed(()=>promptHintsSaveCommand.isRunning===true);const promptHintsChanged=computed(()=>promptHintsDraft.value!==savedPromptHints.value);watch(()=>promptHints.value.enabled,value=>{const enabled=value!==false;if(!promptHintsChanged.value)promptHintsDraft.value=enabled;savedPromptHints.value=enabled},{immediate:true});useRealtimeEvent({event:VIBE64_SESSION_SUMMARY_CHANGED_EVENT,matches:event=>sessionListRealtimeShouldRefresh(event,projectSlug.value),onEvent(){resource.reload();engineeringResource.reload()}});async function refresh(){await Promise.all([resource.reload(),engineeringResource.reload()])}async function savePromptHints(){if(!promptHintsChanged.value||!promptHintsCanEdit.value||promptHintsSaving.value)return;await promptHintsSaveCommand.run({promptHints:promptHintsDraft.value});await resource.reload()}function openPersonalSettings(){requestVibe64AccountConnectionsDialog({refresh:false,section:`profile`})}return(_ctx,_cache)=>{return openBlock(),createElementBlock(`section`,_hoisted_1$1,[createBaseVNode(`header`,_hoisted_2,[_cache[11]||(_cache[11]=createBaseVNode(`div`,null,[createBaseVNode(`h2`,{class:`text-headline-small font-weight-bold ma-0`},`Project settings`),createBaseVNode(`p`,{class:`text-body-medium`},`Choose how you and your AI work on this project.`)],-1)),createVNode(VBtn,{class:`project-settings__refresh`,disabled:loading.value,type:`button`,variant:`text`,onClick:refresh},{default:withCtx(()=>[createTextVNode(toDisplayString(loading.value?`Refreshing…`:`Refresh`),1)]),_:1},8,[`disabled`])]),initialLoading.value||loadError.value?(openBlock(),createBlock(Vibe64AsyncModuleState_default,{key:0,label:`Project settings`,loading:loading.value,message:loadError.value||`Loading project settings.`,"min-height":`12rem`,onReload:unref(reloadPage),onRetry:refresh},null,8,[`loading`,`message`,`onReload`])):(openBlock(),createElementBlock(Fragment,{key:1},[createVNode(ConnectedProjectsSettings_default,{"project-slug":unref(projectSlug),state:unref(resource).data.value?.connectedProjects,onSaved:_cache[0]||(_cache[0]=$event=>unref(resource).reload())},null,8,[`project-slug`,`state`]),createBaseVNode(`section`,_hoisted_3,[createBaseVNode(`div`,_hoisted_4,[unref(engineeringAvailable)?(openBlock(),createElementBlock(`p`,_hoisted_5,toDisplayString(unref(engineeringSourceLabel)),1)):createCommentVNode(``,true),_cache[12]||(_cache[12]=createBaseVNode(`h2`,{id:`engineering-approach-title`,class:`text-title-medium font-weight-bold`},`Engineering approach`,-1)),_cache[13]||(_cache[13]=createBaseVNode(`p`,null,` Choose how cautiously the AI changes your software. Every profile keeps changes simple and asks before adding necessary complexity. `,-1))]),unref(engineeringAvailable)?(openBlock(),createElementBlock(`div`,_hoisted_6,[createBaseVNode(`div`,_hoisted_7,[createVNode(VSelect,{modelValue:unref(engineeringProfileDraft),"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>isRef(engineeringProfileDraft)?engineeringProfileDraft.value=$event:null),disabled:unref(engineeringSaving),density:`comfortable`,"hide-details":`auto`,hint:unref(selectedEngineeringDescription),"item-title":`name`,"item-value":`id`,items:unref(engineeringProfiles),label:`Engineering profile`,"persistent-hint":``,variant:`outlined`},null,8,[`modelValue`,`disabled`,`hint`,`items`])]),createBaseVNode(`div`,_hoisted_8,[createBaseVNode(`p`,null,toDisplayString(unref(engineeringStatusText)),1),createVNode(VBtn,{disabled:!unref(engineeringChanged)||unref(engineeringSaving),color:unref(engineeringChanged)?`primary`:void 0,type:`button`,variant:`flat`,onClick:unref(saveEngineeringProfile)},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(engineeringSaving)?`Saving…`:`Save engineering approach`),1)]),_:1},8,[`disabled`,`color`,`onClick`])])])):(openBlock(),createElementBlock(`div`,_hoisted_9,[createBaseVNode(`p`,null,toDisplayString(unref(engineeringUnavailableReason)),1)]))]),createBaseVNode(`section`,_hoisted_10,[createBaseVNode(`div`,_hoisted_11,[_cache[14]||(_cache[14]=createBaseVNode(`h2`,{id:`development-database-title`,class:`text-title-medium font-weight-bold`},`Development database`,-1)),unref(managed)?(openBlock(),createElementBlock(`p`,_hoisted_12,` Share development data across sessions or keep a separate database for each. `)):(openBlock(),createElementBlock(`p`,_hoisted_13,` This Vibe64 installation does not manage development databases. The application receives its database connection through the project Env configuration. `))]),unref(managed)?(openBlock(),createElementBlock(`div`,_hoisted_14,[createVNode(VRadioGroup,{modelValue:unref(scopeDraft),"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>isRef(scopeDraft)?scopeDraft.value=$event:null),"aria-labelledby":`development-database-title`,class:`project-settings__options`,disabled:unref(databaseSaving),"hide-details":``},{default:withCtx(()=>[createBaseVNode(`div`,_hoisted_15,[createVNode(VRadio,{class:`py-1`,"aria-describedby":unref(sessionScopeReason)?`development-database-session-reason`:void 0,disabled:!unref(sessionScopeAvailable),label:`A separate database for each session`,value:`session`},null,8,[`aria-describedby`,`disabled`]),unref(sessionScopeReason)?(openBlock(),createElementBlock(`p`,_hoisted_16,toDisplayString(unref(sessionScopeReason)),1)):createCommentVNode(``,true)]),createBaseVNode(`div`,_hoisted_17,[createVNode(VRadio,{class:`py-1`,"aria-describedby":unref(projectScopeReason)?`development-database-project-reason`:void 0,disabled:!unref(projectScopeAvailable),label:`One database shared by this project`,value:`project`},null,8,[`aria-describedby`,`disabled`]),unref(projectScopeReason)?(openBlock(),createElementBlock(`p`,_hoisted_18,toDisplayString(unref(projectScopeReason)),1)):createCommentVNode(``,true)])]),_:1},8,[`modelValue`,`disabled`]),unref(scopeDraft)===`project`?(openBlock(),createElementBlock(`div`,_hoisted_19,[createVNode(VCheckbox,{modelValue:unref(sharedSessionsDraft),"onUpdate:modelValue":_cache[3]||(_cache[3]=$event=>isRef(sharedSessionsDraft)?sharedSessionsDraft.value=$event:null),label:`Allow multiple sessions with this shared database`,disabled:unref(databaseSaving),"hide-details":``},null,8,[`modelValue`,`disabled`]),_cache[15]||(_cache[15]=createBaseVNode(`p`,null,`All sessions will share the same database.`,-1))])):createCommentVNode(``,true),createBaseVNode(`div`,_hoisted_20,[unref(disabledReason)?(openBlock(),createElementBlock(`p`,_hoisted_21,toDisplayString(unref(disabledReason)),1)):unref(scopeDraft)===`project`?(openBlock(),createElementBlock(`p`,_hoisted_22,` Data and schema changes will be visible to every project session and remain after a session is archived. `)):createCommentVNode(``,true),createVNode(VBtn,{disabled:!unref(databaseChanged)||!unref(databaseSaveAllowed)||unref(databaseSaving),color:unref(databaseChanged)?`primary`:void 0,type:`button`,variant:`flat`,onClick:unref(saveDatabase)},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(databaseSaving)?`Saving…`:`Save database choice`),1)]),_:1},8,[`disabled`,`color`,`onClick`])])])):createCommentVNode(``,true)]),createBaseVNode(`section`,_hoisted_23,[createBaseVNode(`div`,_hoisted_24,[createBaseVNode(`p`,_hoisted_25,toDisplayString(unref(collaborationSourceLabel)),1),_cache[17]||(_cache[17]=createBaseVNode(`h2`,{id:`ai-behaviour-title`,class:`text-title-medium font-weight-bold`},`AI behaviour`,-1)),_cache[18]||(_cache[18]=createBaseVNode(`p`,null,` Set the tone, level of detail and project requirements for your conversations. These choices follow your project source. `,-1)),createVNode(VBtn,{class:`project-settings__account-link`,type:`button`,variant:`text`,onClick:openPersonalSettings},{default:withCtx(()=>[..._cache[16]||(_cache[16]=[createTextVNode(` Set your Vibe64 name `,-1)])]),_:1})]),createBaseVNode(`div`,_hoisted_26,[createBaseVNode(`div`,_hoisted_27,[createVNode(VSelect,{modelValue:unref(collaborationDraft).tone,"onUpdate:modelValue":_cache[4]||(_cache[4]=$event=>unref(collaborationDraft).tone=$event),disabled:!unref(collaborationAvailable)||!unref(collaborationCanEdit)||unref(collaborationSaving),density:`comfortable`,"hide-details":``,"item-title":`label`,"item-value":`value`,items:unref(toneOptions),label:`Tone`,variant:`outlined`},null,8,[`modelValue`,`disabled`,`items`]),createVNode(VSelect,{modelValue:unref(collaborationDraft).responseLength,"onUpdate:modelValue":_cache[5]||(_cache[5]=$event=>unref(collaborationDraft).responseLength=$event),disabled:!unref(collaborationAvailable)||!unref(collaborationCanEdit)||unref(collaborationSaving),density:`comfortable`,"hide-details":``,"item-title":`label`,"item-value":`value`,items:unref(responseLengthOptions),label:`Response length`,variant:`outlined`},null,8,[`modelValue`,`disabled`,`items`]),createVNode(VSelect,{modelValue:unref(collaborationDraft).experience,"onUpdate:modelValue":_cache[6]||(_cache[6]=$event=>unref(collaborationDraft).experience=$event),disabled:!unref(collaborationAvailable)||!unref(collaborationCanEdit)||unref(collaborationSaving),density:`comfortable`,"hide-details":``,"item-title":`label`,"item-value":`value`,items:unref(experienceOptions),label:`Experience level`,variant:`outlined`},null,8,[`modelValue`,`disabled`,`items`]),createVNode(VSelect,{modelValue:unref(collaborationDraft).explanationStyle,"onUpdate:modelValue":_cache[7]||(_cache[7]=$event=>unref(collaborationDraft).explanationStyle=$event),disabled:!unref(collaborationAvailable)||!unref(collaborationCanEdit)||unref(collaborationSaving),density:`comfortable`,"hide-details":``,"item-title":`label`,"item-value":`value`,items:unref(explanationStyleOptions),label:`Explanation style`,variant:`outlined`},null,8,[`modelValue`,`disabled`,`items`]),createVNode(VTextarea,{modelValue:unref(collaborationDraft).requirements,"onUpdate:modelValue":_cache[8]||(_cache[8]=$event=>unref(collaborationDraft).requirements=$event),class:`project-settings__ai-note`,disabled:!unref(collaborationAvailable)||!unref(collaborationCanEdit)||unref(collaborationSaving),"auto-grow":``,density:`comfortable`,"hide-details":``,label:`Project requirements (optional)`,placeholder:`For example: use Australian English.`,rows:`6`,"max-rows":`18`,variant:`outlined`},null,8,[`modelValue`,`disabled`])]),createBaseVNode(`div`,_hoisted_28,[!unref(collaborationAvailable)?(openBlock(),createElementBlock(`p`,_hoisted_29,toDisplayString(unref(collaborationUnavailableReason)),1)):!unref(collaborationCanEdit)?(openBlock(),createElementBlock(`p`,_hoisted_30,` Only the project owner can change these controls in Settings. Anyone who can edit this source can change genesis/collaboration.md directly. `)):(openBlock(),createElementBlock(`p`,_hoisted_31,` Applies when a conversation next starts or refreshes its context. Existing history and instructions in an active Codex conversation stay as they are. `)),createVNode(VBtn,{disabled:!unref(collaborationChanged)||!unref(collaborationAvailable)||!unref(collaborationCanEdit)||unref(collaborationSaving),color:unref(collaborationChanged)?`primary`:void 0,type:`button`,variant:`flat`,onClick:unref(saveCollaboration)},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(collaborationSaving)?`Saving…`:`Save collaboration`),1)]),_:1},8,[`disabled`,`color`,`onClick`])])])]),createBaseVNode(`section`,_hoisted_32,[_cache[19]||(_cache[19]=createBaseVNode(`div`,{class:`project-settings__section-copy text-body-medium`},[createBaseVNode(`h2`,{id:`prompt-suggestions-title`,class:`text-title-medium font-weight-bold`},`Prompt suggestions`),createBaseVNode(`p`,null,`Get ideas for what to ask next. This Vibe64 setting does not change your AI's instructions.`)],-1)),createBaseVNode(`div`,_hoisted_33,[createVNode(VSwitch,{modelValue:promptHintsDraft.value,"onUpdate:modelValue":_cache[9]||(_cache[9]=$event=>promptHintsDraft.value=$event),class:`project-settings__ai-hints`,color:`primary`,disabled:!promptHintsCanEdit.value||promptHintsSaving.value,"hide-details":``,label:`Suggest useful next prompts`},null,8,[`modelValue`,`disabled`]),createBaseVNode(`div`,_hoisted_34,[createVNode(VBtn,{disabled:!promptHintsChanged.value||!promptHintsCanEdit.value||promptHintsSaving.value,color:promptHintsChanged.value?`primary`:void 0,type:`button`,variant:`flat`,onClick:savePromptHints},{default:withCtx(()=>[createTextVNode(toDisplayString(promptHintsSaving.value?`Saving…`:`Save prompt suggestions`),1)]),_:1},8,[`disabled`,`color`])])])]),repositoryWorkflow.value.available?(openBlock(),createElementBlock(`section`,_hoisted_35,[_cache[22]||(_cache[22]=createBaseVNode(`div`,{class:`project-settings__section-copy text-body-medium`},[createBaseVNode(`h2`,{id:`repository-workflow-title`,class:`text-title-medium font-weight-bold`},`Git workflow`),createBaseVNode(`p`,null,`Choose how Vibe64 saves changes to this repository.`)],-1)),createBaseVNode(`div`,_hoisted_36,[createVNode(VRadioGroup,{modelValue:requirePullRequest.value,"onUpdate:modelValue":_cache[10]||(_cache[10]=$event=>requirePullRequest.value=$event),label:`GitHub save workflow`,color:`primary`,"hide-details":``,disabled:!repositoryWorkflow.value.canEdit||unref(repositoryWorkflowCommand).isRunning},{default:withCtx(()=>[createVNode(VRadio,{label:`Allow direct commits and pushes`,value:false,class:`py-1`}),createVNode(VRadio,{label:`Require pull requests`,value:true,class:`py-1`})]),_:1},8,[`modelValue`,`disabled`]),_cache[20]||(_cache[20]=createBaseVNode(`p`,null,`GitHub branch rules still apply. Requiring pull requests makes Create draft PR the main Save action until a session is attached to a PR.`,-1)),_cache[21]||(_cache[21]=createBaseVNode(`p`,null,`This setting controls Vibe64's Save actions. GitHub rules control pushes from terminals and other tools.`,-1)),createBaseVNode(`div`,_hoisted_37,[createVNode(VBtn,{color:requirePullRequest.value!==repositoryWorkflow.value.requirePullRequest?`primary`:void 0,variant:`flat`,disabled:!repositoryWorkflow.value.canEdit||unref(repositoryWorkflowCommand).isRunning||requirePullRequest.value===repositoryWorkflow.value.requirePullRequest,onClick:saveRepositoryWorkflow},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(repositoryWorkflowCommand).isRunning?`Saving…`:`Save repository workflow`),1)]),_:1},8,[`color`,`disabled`])])])])):createCommentVNode(``,true)],64))])}}};var ProjectSettingsPanel_default=_plugin_vue_export_helper_default(_sfc_main$1,[[`__scopeId`,`data-v-55be68b2`]]);var _hoisted_1={class:`vibe64-dashboard-page`};var _sfc_main={__name:`index`,setup(__props){return(_ctx,_cache)=>{return openBlock(),createElementBlock(`section`,_hoisted_1,[createVNode(ProjectSettingsPanel_default)])}}};var settings_default=_plugin_vue_export_helper_default(_sfc_main,[[`__scopeId`,`data-v-d998a641`]]);export{settings_default as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.project-settings__section-copy[data-v-3ce2b74d],.project-settings__content[data-v-3ce2b74d]{gap:1rem;min-width:0;display:grid}.project-settings__section-copy[data-v-3ce2b74d]{align-content:start;gap:.5rem}.project-settings__section-copy p[data-v-3ce2b74d],.project-settings__content p[data-v-3ce2b74d]{overflow-wrap:anywhere;margin:0}.connection-entry[data-v-3ce2b74d]{border:0;gap:.75rem;min-width:0;margin:1rem 0;padding:0;display:grid}.connection-entry legend[data-v-3ce2b74d]{margin-bottom:.75rem}.connection-actions[data-v-3ce2b74d]{flex-wrap:wrap;gap:.75rem;display:flex}.project-settings[data-v-55be68b2]{width:100%;min-width:0;max-width:76rem;container:project-settings/inline-size}.project-settings__header[data-v-55be68b2]{justify-content:space-between;align-items:start;gap:1rem;padding-block-end:1.5rem;display:flex}.project-settings p[data-v-55be68b2],.project-settings h2[data-v-55be68b2]{margin:0}.project-settings p[data-v-55be68b2]{color:rgba(var(--v-theme-on-surface), .7);overflow-wrap:anywhere}.project-settings__header p[data-v-55be68b2]{margin-top:.5rem}.project-settings__refresh[data-v-55be68b2]{flex:none}.project-settings__section[data-v-55be68b2]{border-top:thin solid rgba(var(--v-border-color), var(--v-border-opacity));grid-template-columns:minmax(12rem,1fr) minmax(0,2fr);align-items:start;gap:1.5rem 2rem;padding-block:1.5rem;display:grid}.project-settings__section-copy[data-v-55be68b2],.project-settings__content[data-v-55be68b2],.project-settings__action[data-v-55be68b2]{gap:1rem;min-width:0;display:grid}.project-settings__section-copy[data-v-55be68b2]{align-content:start;gap:.5rem}.project-settings__action[data-v-55be68b2]{justify-items:start}.project-settings__account-link[data-v-55be68b2]{justify-self:start;margin-inline-start:-.75rem}.project-settings__engineering-field[data-v-55be68b2],.project-settings__option[data-v-55be68b2]{min-width:0}.project-settings .project-settings__option-support[data-v-55be68b2]{margin-inline-start:2.5rem}.project-settings__ai-fields[data-v-55be68b2]{grid-template-columns:repeat(auto-fit,minmax(min(100%,15rem),1fr));gap:1.5rem 1rem;min-width:0;display:grid}.project-settings__ai-note[data-v-55be68b2]{grid-column:1/-1}@container project-settings (width<=48rem){.project-settings__section[data-v-55be68b2]{grid-template-columns:minmax(0,1fr)}}.vibe64-dashboard-page[data-v-d998a641]{gap:.75rem;min-width:0;display:grid}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ht as proxyRefs,it as watch,u as computed,vt as ref}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{t as useEndpointResource}from"./useEndpointResource-61E93qP-.js";import{g as useRoute}from"./useApi-BPuI6ZR9-rsYWyW6m.js";import{r as projectAppPath}from"./vibe64ProjectScope.local-B9ZpdYlf.js";import{n as getHttpWebClient}from"./httpClient-BRO3GqjU.js";import{o as ROUTE_VISIBILITY_PUBLIC}from"./visibility-Cq31Xy7I.js";import{a as normalizeConversationLogPage,i as mergeConversationLogPages,o as normalizeConversationLogPagination,r as conversationLogReadQuery}from"./conversation-p_mmD9ie.js";import{t as usePaths}from"./usePaths-B-QGqa_I.js";import{t as readRefOrGetterValue}from"./vueRefOrGetterValue-y-4f_In7.js";import{H as vibe64SessionsQueryKey,L as vibe64SessionPath,V as vibe64SessionQueryKey,b as vibe64ConversationLogPath,n as VIBE64_ARCHIVED_SESSIONS_API_SUFFIX,o as VIBE64_SESSIONS_API_SUFFIX,x as vibe64ConversationLogQueryKey}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{P as useVibe64ProjectSlug}from"./index-Bvd00puv.js";import{t as isArchivedVibe64Session}from"./vibe64SessionViewModel-CQCds_jb.js";import{n as enrichVibe64SessionForDisplay}from"./vibe64SessionPanelModel-B-WkXnPu.js";import{t as normalizeConversationLog}from"./useVibe64ConversationLog-BVANhCHq.js";function useArchivedVibe64ConversationHistory({active=true,projectSlug,session,sessionsApiPath}={}){const httpClient=getHttpWebClient();const sessionId=computed(()=>String(readRefOrGetterValue(session)?.sessionId||``).trim());const enabled=computed(()=>readRefOrGetterValue(active)!==false&&Boolean(sessionId.value));const path=computed(()=>sessionId.value?vibe64ConversationLogPath(readRefOrGetterValue(sessionsApiPath),sessionId.value):``);const resource=useEndpointResource({enabled,fallbackLoadError:`Conversation history could not be loaded.`,path,queryKey:computed(()=>vibe64ConversationLogQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,sessionId.value,readRefOrGetterValue(projectSlug))),queryOptions:{queryFn:({signal})=>httpClient.request(path.value,{method:`GET`,query:conversationLogReadQuery(),signal}),placeholderData:previousData=>previousData,refetchOnMount:false,refetchOnWindowFocus:false},readMethod:`GET`,refreshOnPull:true,requestRecoveryLabel:`Conversation history`,realtime:null});const olderPages=ref([]);const loadingMore=ref(false);const loadMoreError=ref(``);const latestPage=computed(()=>normalizeConversationLogPage(resource.data.value||{}));const oldestLoadedPage=computed(()=>olderPages.value[0]||latestPage.value);const hasMoreBefore=computed(()=>Boolean(normalizeConversationLogPagination(oldestLoadedPage.value?.pagination).hasMoreBefore));const turns=computed(()=>normalizeConversationLog(mergeConversationLogPages([...olderPages.value,latestPage.value])));function reload(){olderPages.value=[];loadMoreError.value=``;return resource.reload()}async function loadMore({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||!path.value||!hasMoreBefore.value||loadingMore.value||!beforeTurnId){finish({changed:false,loaded:false});return false}const requestedSessionId=sessionId.value;loadingMore.value=true;loadMoreError.value=``;try{const page=await httpClient.request(path.value,{method:`GET`,query:conversationLogReadQuery({beforeTurnId,limit:10})});if(sessionId.value!==requestedSessionId){finish({changed:false,loaded:false});return false}const messageCount=()=>turns.value.reduce((count,turn)=>count+(turn.messages?.length||0),0);const previousOldestTurnId=String(turns.value[0]?.turnId||``).trim();const previousMessageCount=messageCount();olderPages.value=[normalizeConversationLogPage(page),...olderPages.value];const nextOldestTurnId=String(turns.value[0]?.turnId||``).trim();finish({changed:Boolean(nextOldestTurnId&&(nextOldestTurnId!==previousOldestTurnId||messageCount()!==previousMessageCount)),loaded:true});return true}catch(error){if(sessionId.value===requestedSessionId)loadMoreError.value=String(error?.message||error||`Older conversation history could not be loaded.`);finish({changed:false,loaded:false});return false}finally{loadingMore.value=false}}watch(sessionId,()=>{olderPages.value=[];loadMoreError.value=``});return{error:resource.loadError,hasMoreBefore,loadMore,loadMoreError,loading:resource.isLoading,loadingMore,reload,turns}}var archivedVibe64SessionsEmits=[`loading-changed`];var archivedAtFormatter=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});var archivedVibe64SessionsProps={description:{default:``,type:String},emptyText:{default:``,type:String},emptyTitle:{default:`No sessions`,type:String},showRefresh:{default:true,type:Boolean},title:{default:``,type:String}};function useArchivedVibe64Sessions(emit){const paths=usePaths();const projectSlug=useVibe64ProjectSlug();const sessionsApiPath=computed(()=>paths.api(VIBE64_ARCHIVED_SESSIONS_API_SUFFIX,{surface:`app`}));const sessionListResource=useEndpointResource({fallbackLoadError:`Archived sessions could not be loaded.`,path:sessionsApiPath,queryKey:computed(()=>[...vibe64SessionsQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,projectSlug.value),`archived`]),requestRecoveryLabel:`Archived sessions`});const loading=computed(()=>Boolean(sessionListResource.isLoading.value));const error=computed(()=>String(sessionListResource.loadError.value||``));const sessions=computed(()=>{const payload=sessionListResource.data.value;return(Array.isArray(payload?.sessions)?payload.sessions:[]).map(enrichVibe64SessionForDisplay).filter(isArchivedVibe64Session)});watch(loading,isLoading=>{emit(`loading-changed`,isLoading)},{immediate:true});return{unavailableSessions:computed(()=>sessionListResource.data.value?.unavailableSessions||[]),error,loadSessions,loading,formatArchivedAt,sessionRoute,sessions};async function loadSessions(){await sessionListResource.reload()}function sessionRoute(session={}){return archivedSessionDetailRoute({projectSlug:projectSlug.value,sessionId:session.sessionId})}}function useArchivedVibe64SessionDetail(){const route=useRoute();const paths=usePaths();const projectSlug=useVibe64ProjectSlug(route);const sessionId=computed(()=>firstRouteParam(route.params.sessionId));const sessionsApiPath=computed(()=>paths.api(VIBE64_SESSIONS_API_SUFFIX,{surface:`app`}));const sessionPath=computed(()=>sessionId.value?vibe64SessionPath(sessionsApiPath.value,sessionId.value):``);const sessionResource=useEndpointResource({enabled:computed(()=>Boolean(sessionId.value)),fallbackLoadError:`Archived session could not be loaded.`,path:sessionPath,queryKey:computed(()=>[...vibe64SessionQueryKey(`app`,ROUTE_VISIBILITY_PUBLIC,projectSlug.value),`archive-detail`,sessionId.value]),readQuery:computed(()=>projectSlug.value?{projectSlug:projectSlug.value}:null),requestRecoveryLabel:`Archived session`});const session=computed(()=>{const payload=sessionResource.data.value;if(!payload||typeof payload!==`object`||Array.isArray(payload))return null;if(String(payload.sessionId||``).trim()!==sessionId.value)return null;const enrichedSession=enrichVibe64SessionForDisplay(payload);return isArchivedVibe64Session(enrichedSession)?enrichedSession:null});return{conversationLog:proxyRefs(useArchivedVibe64ConversationHistory({active:computed(()=>Boolean(session.value)),projectSlug,session,sessionsApiPath})),error:computed(()=>String(sessionResource.loadError.value||``)),loading:computed(()=>Boolean(sessionResource.isLoading.value||sessionResource.isInitialLoading?.value)),reload:sessionResource.reload,session,sessionId,sessionsApiPath,projectSlug}}function formatArchivedAt(value=``){const date=new Date(String(value||``));return Number.isNaN(date.getTime())?`time unavailable`:archivedAtFormatter.format(date)}function archivedSessionDetailRoute({projectSlug=``,sessionId=``}={}){return{path:`${projectAppPath(projectSlug)}/dashboard/history/${encodeURIComponent(String(sessionId||``).trim())}`}}function firstRouteParam(value){return String(Array.isArray(value)?value[0]:value||``).trim()}function metadataValue(session={},name=``){return String(session.metadata?.[name]||``).trim()}function archiveFactRows(session={}){return[{icon:`$forkRight`,label:`Branch`,value:session.branch||metadataValue(session,`source_recovery_branch`)},{icon:`$commit`,label:`Head`,value:metadataValue(session,`source_recovery_head`)||metadataValue(session,`base_commit`)},{icon:`$description`,label:`Saved patch`,value:metadataValue(session,`source_recovery_patch_artifact`)||`No saved patch`},{icon:`$description`,label:`Untracked files`,value:metadataValue(session,`source_recovery_untracked_artifact`)||`No saved untracked archive`}].filter(row=>row.value)}export{useArchivedVibe64Sessions as a,useArchivedVibe64SessionDetail as i,archivedVibe64SessionsEmits as n,archivedVibe64SessionsProps as r,archiveFactRows as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Et as unref,gt as reactive,ht as proxyRefs,it as watch,u as computed}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{r as useShellWebErrorRuntime}from"./error-kdRkyK9x.js";import{N as useQueryClient,a as ensureAccessModeCompatibility,c as normalizePermissions,d as resolveEnabled,f as resolvePermissionAccess,i as emptyRecord,l as resolveAccessModeEnabled,m as resolveEnabledRef,n as useOperationRealtime,o as normalizeAccessMode,p as resolveQueryKey,r as asPlainObject,s as normalizeOwnershipFilter,t as useEndpointResource,u as resolveApiSuffix}from"./useEndpointResource-61E93qP-.js";import{o as normalizeLowerText,u as normalizeText}from"./normalize-BD25VwNK.js";import{n as validateSchemaPayload}from"./validators-B3YzM6px.js";import{c as normalizePermissionList,n as getHttpWebClient,r as buildValidationFailure,s as hasPermission}from"./httpClient-BRO3GqjU.js";import{n as resolveScopedRouteBase}from"./surface-CBlx7sF_.js";import{r as useJskitText}from"./i18n-BuXRXGaO.js";import{n as ROUTE_VISIBILITY_WORKSPACE}from"./visibility-Cq31Xy7I.js";import{r as toUiFieldErrors}from"./errorMessageHelpers-L2GsOwCP.js";import{p as useWebPlacementContext,r as resolveSurfaceDefinitionFromPlacementContext}from"./placement-BAaZQhAh.js";import{n as useSurfaceRouteContext,t as usePaths}from"./usePaths-B-QGqa_I.js";import{t as useUiFeedback}from"./useUiFeedback-CycH_fvY.js";var{t:t$3,text:text$1}=useJskitText();var SILENT_FIELD_BAG=Object.freeze({apply(){}});var SILENT_FEEDBACK=Object.freeze({error(){}});function validateOperationInput({input,rawPayload={},fieldBag=SILENT_FIELD_BAG,feedback=SILENT_FEEDBACK,validationMessage=``}){if(!input)return{ok:true,parsedInput:rawPayload};try{return{ok:true,parsedInput:validateSchemaPayload(input,rawPayload,{phase:`input`,context:`operation input`})}}catch(error){if(!error?.fieldErrors||typeof error.fieldErrors!==`object`)throw error;const fieldErrorCodes=error.fieldErrorCodes||error.details?.fieldErrorCodes;const failure={...buildValidationFailure({error:text$1(validationMessage)||t$3(`jskit.http.feedback.validationFailed`),code:`validation_failed`,fieldErrors:error?.fieldErrors}),...fieldErrorCodes?{fieldErrorCodes}:{}};fieldBag.apply(toUiFieldErrors(failure));feedback.error(failure,failure.error);return{ok:false,failure,parsedInput:null}}}var{t:t$2,text}=useJskitText();function useCommandCore({model,resource,writeMethod=`POST`,canRun,fieldBag,feedback,input,buildRawPayload=emptyRecord,buildCommandPayload,buildCommandOptions=emptyRecord,onRunSuccess,onRunError,suppressSuccessMessage=false,messages={}}){const queryClient=useQueryClient();const normalizedWriteMethod=String(writeMethod||`POST`).trim().toUpperCase();const running=resource.isSaving;const fieldErrors=fieldBag.errors;const message=feedback.message;const messageType=feedback.messageType;async function run(context={}){if(!canRun.value||running.value)return null;feedback.clear();fieldBag.clear();const rawPayload=buildRawPayload(model,{queryClient,resource,context});const validationResult=validateOperationInput({input,rawPayload,fieldBag,feedback,validationMessage:text(messages.validation)||t$2(`jskit.http.feedback.validationFailed`)});if(!validationResult.ok)return null;const{parsedInput}=validationResult;const payload=typeof buildCommandPayload===`function`?buildCommandPayload(parsedInput,{rawPayload,queryClient,resource,context}):normalizedWriteMethod===`DELETE`?void 0:parsedInput;const options=buildCommandOptions(parsedInput,{rawPayload,queryClient,resource,context});try{const response=await resource.save(payload,options);if(onRunSuccess)await onRunSuccess(response,{parsed:parsedInput,rawPayload,payload,options,queryClient,resource,context});if(!suppressSuccessMessage)feedback.success(text(messages.success)||t$2(`jskit.http.feedback.completed`));return response}catch(error){fieldBag.apply(toUiFieldErrors(error));if(onRunError)await onRunError(error,{parsed:parsedInput,rawPayload,payload,options,queryClient,resource,context});feedback.error(error,text(messages.error)||t$2(`jskit.http.feedback.actionFailed`));throw error}}return{running,fieldErrors,message,messageType,run}}var{t:t$1}=useJskitText();function asPermissionList(value){if(Array.isArray(value))return value;if(value===void 0||value===null||value===``)return[];return[value]}function useAccess({enabled=true,access=`always`,hasPermissionRequirements=false}={}){const normalizedAccessMode=normalizeAccessMode(access);const accessRequired=resolveAccessModeEnabled(normalizedAccessMode,{hasPermissionRequirements:hasPermissionRequirements===true});const{context:placementContext}=useWebPlacementContext();const queryEnabled=computed(()=>resolveEnabledRef(enabled)&&accessRequired);const hasPlacementPermissions=computed(()=>{const source=placementContext.value;if(!source||typeof source!==`object`)return false;return Object.hasOwn(source,`permissions`)});const placementPermissions=computed(()=>normalizePermissionList(placementContext.value?.permissions));const permissions=computed(()=>{if(!queryEnabled.value||!hasPlacementPermissions.value)return[];return placementPermissions.value});const permissionsUnavailableError=computed(()=>{if(!queryEnabled.value||hasPlacementPermissions.value)return``;return t$1(`jskit.http.access.permissionsUnavailable`)});const awaitingPlacementPermissions=computed(()=>queryEnabled.value&&!hasPlacementPermissions.value);function can(permission){return hasPermission(permissions.value,permission)}function canAny(requiredPermissions){const list=asPermissionList(requiredPermissions);if(list.length<1)return true;for(const entry of list)if(can(entry))return true;return false}function canAll(requiredPermissions){const list=asPermissionList(requiredPermissions);if(list.length<1)return true;for(const entry of list)if(!can(entry))return false;return true}return{accessMode:normalizedAccessMode,accessRequired,permissions,permissionsUnavailableError,awaitingPlacementPermissions,can,canAny,canAll}}function toRouteParamValue(value){if(Array.isArray(value))return toRouteParamValue(value[0]);if(value==null)return``;return String(value).trim()}function extractRouteParamNames(pathTemplate=``){const normalizedTemplate=String(pathTemplate||``).trim();if(!normalizedTemplate)return[];const names=[];const seen=new Set;const pattern=/:([A-Za-z][A-Za-z0-9_]*)/g;let match=null;while((match=pattern.exec(normalizedTemplate))!=null){const name=String(match[1]||``).trim();if(!name||seen.has(name))continue;seen.add(name);names.push(name)}return names}var{t}=useJskitText();function resolveScopedRouteParamNames(placementContext=null,surfaceId=``){const routeBase=resolveSurfaceDefinitionFromPlacementContext(placementContext,surfaceId)?.routeBase||`/`;return extractRouteParamNames(resolveScopedRouteBase(routeBase))}function useScopeRuntime({ownershipFilter=ROUTE_VISIBILITY_WORKSPACE,surfaceId=``,accessMode=`auto`,hasPermissionRequirements=false}={}){const normalizedOwnershipFilter=normalizeOwnershipFilter(ownershipFilter);const normalizedAccessMode=ensureAccessModeCompatibility({accessMode,hasPermissionRequirements,caller:`useScopeRuntime`});const accessRequired=resolveAccessModeEnabled(normalizedAccessMode,{hasPermissionRequirements});const routeContext=useSurfaceRouteContext();const paths=usePaths({routeContext});const resolvedSurfaceId=computed(()=>{const explicitSurfaceId=normalizeLowerText(surfaceId);if(explicitSurfaceId)return explicitSurfaceId;return normalizeLowerText(routeContext.currentSurfaceId.value)});const scopedRouteParamNames=computed(()=>resolveScopedRouteParamNames(routeContext.placementContext.value,resolvedSurfaceId.value));const routeScopeParams=computed(()=>{const source=paths.routeParams.value;const next={};for(const paramName of scopedRouteParamNames.value){const paramValue=toRouteParamValue(source[paramName]);if(paramValue)next[paramName]=paramValue}return Object.freeze(next)});const missingScopedRouteParamNames=computed(()=>scopedRouteParamNames.value.filter(paramName=>!routeScopeParams.value[paramName]));const requiresScopedRouteParams=computed(()=>scopedRouteParamNames.value.length>0);const hasRequiredRouteScope=computed(()=>missingScopedRouteParamNames.value.length<1);const scopeParamValue=computed(()=>{const[primaryScopeParamName=``]=scopedRouteParamNames.value;return primaryScopeParamName?routeScopeParams.value[primaryScopeParamName]||``:``});const routeScopeError=computed(()=>{if(!requiresScopedRouteParams.value||hasRequiredRouteScope.value)return``;const missingParams=missingScopedRouteParamNames.value.join(`, `);return t(`jskit.http.access.routeParamsRequired`,{params:missingParams,surface:resolvedSurfaceId.value||`<unknown>`})});const accessRuntime=useAccess({enabled:computed(()=>accessRequired&&hasRequiredRouteScope.value),access:normalizedAccessMode,hasPermissionRequirements});function resolveApiPath(apiSuffix=``,context={}){if(routeScopeError.value)return``;const suffix=resolveApiSuffix(apiSuffix,{surfaceId:routeContext.currentSurfaceId.value,scopeParamValue:scopeParamValue.value,ownershipFilter:normalizedOwnershipFilter,...asPlainObject(context)});return paths.api(suffix,{surface:resolvedSurfaceId.value,params:routeScopeParams.value})}function requireRouteScope(caller=`useScopeRuntime`){if(routeScopeError.value)throw new Error(`${caller}: ${routeScopeError.value}`)}return{normalizedOwnershipFilter,requiresScopedRouteParams:requiresScopedRouteParams.value,resolvedSurfaceId,accessMode:normalizedAccessMode,accessRequired,routeContext,scopedRouteParamNames,routeScopeParams,scopeParamValue,hasRequiredRouteScope,routeScopeError,access:accessRuntime,resolveApiPath,requireRouteScope}}function normalizePermissionSets(permissionSets={}){const source=permissionSets&&typeof permissionSets===`object`&&!Array.isArray(permissionSets)?permissionSets:{};const normalized={};for(const[key,value]of Object.entries(source))normalized[key]=normalizePermissions(value);return normalized}function hasAnyPermissions(permissionSets={}){for(const list of Object.values(permissionSets))if(Array.isArray(list)&&list.length>0)return true;return false}function useOperationScope({ownershipFilter=ROUTE_VISIBILITY_WORKSPACE,surfaceId=``,access=`auto`,apiSuffix=``,model,readEnabled=true,queryKeyFactory,permissionSets={},realtime}){const normalizedPermissionSets=normalizePermissionSets(permissionSets);const scopeRuntime=useScopeRuntime({ownershipFilter,surfaceId,accessMode:access,hasPermissionRequirements:hasAnyPermissions(normalizedPermissionSets)});const normalizedOwnershipFilter=scopeRuntime.normalizedOwnershipFilter;const routeContext=scopeRuntime.routeContext;const scopeParamValue=scopeRuntime.scopeParamValue;const hasRequiredRouteScope=scopeRuntime.hasRequiredRouteScope;const accessRuntime=scopeRuntime.access;const apiPath=computed(()=>scopeRuntime.resolveApiPath(apiSuffix,{model}));const queryEnabled=computed(()=>resolveEnabled(readEnabled,{surfaceId:routeContext.currentSurfaceId.value,scopeParamValue:scopeParamValue.value,ownershipFilter:normalizedOwnershipFilter,model}));const queryKey=computed(()=>resolveQueryKey(queryKeyFactory,{surfaceId:routeContext.currentSurfaceId.value,scopeParamValue:scopeParamValue.value,ownershipFilter:normalizedOwnershipFilter}));const realtimeBinding=useOperationRealtime({realtime,queryKey:typeof queryKeyFactory===`function`?queryKey:null,enabled:computed(()=>hasRequiredRouteScope.value&&Boolean(apiPath.value))});function queryCanRun(accessGate=true){return computed(()=>queryEnabled.value&&hasRequiredRouteScope.value&&Boolean(apiPath.value)&&Boolean(unref(accessGate)))}function permissionGate(key=``){const list=normalizedPermissionSets[String(key||``)]||[];return computed(()=>resolvePermissionAccess(accessRuntime,list))}function loadError(baseError=``){return computed(()=>{if(scopeRuntime.routeScopeError.value)return scopeRuntime.routeScopeError.value;const permissionsError=String(accessRuntime.permissionsUnavailableError.value||``).trim();if(permissionsError)return permissionsError;if(baseError===void 0||baseError===null||baseError===``)return``;return String(unref(baseError)||``).trim()})}function isLoading(baseLoading=false){return computed(()=>Boolean(unref(baseLoading))||accessRuntime.awaitingPlacementPermissions.value)}return{scopeRuntime,routeContext,normalizedOwnershipFilter,scopeParamValue,hasRequiredRouteScope,access:accessRuntime,apiPath,queryEnabled,queryKey,queryCanRun,realtime:realtimeBinding,permissionGate,loadError,isLoading}}function normalizeFieldErrorKeys(keys){return Array.isArray(keys)?keys.map(entry=>String(entry||``).trim()).filter(Boolean):[]}function useFieldErrorBag(keys=[]){const normalizedKeys=normalizeFieldErrorKeys(keys);const hasFixedKeys=normalizedKeys.length>0;const errors=reactive(Object.fromEntries(normalizedKeys.map(key=>[key,``])));function clear(){const keysToClear=hasFixedKeys?normalizedKeys:Object.keys(errors);for(const key of keysToClear)errors[key]=``}function apply(source={}){const fieldErrorMap=source&&typeof source===`object`?source:{};if(hasFixedKeys){for(const key of normalizedKeys)errors[key]=String(fieldErrorMap[key]||``);return}clear();for(const[field,message]of Object.entries(fieldErrorMap)){const key=String(field||``).trim();if(!key)continue;errors[key]=String(message||``)}}function set(field,message){const key=String(field||``).trim();if(!key)return;if(hasFixedKeys&&!(key in errors))return;errors[key]=String(message||``)}return{errors,clear,apply,set}}function normalizeMessage(value){return String(value||``).trim()}function noRetryAction(){return null}function setupOperationErrorReporting({enabled=true,source=`http-web.operation`,loadError=null,notFoundError=null,loadActionFactory=noRetryAction,notFoundActionFactory=noRetryAction,loadChannel=``,notFoundChannel=``,loadSeverity=`error`,notFoundSeverity=`warning`,dedupeWindowMs=2e3}={}){if(!enabled)return;const runtime=useShellWebErrorRuntime();const normalizedSource=normalizeMessage(source)||`http-web.operation`;function watchMessage(value,{kind=`load`,channel=``,intent=`resource-load`,severity=`error`,actionFactory=noRetryAction}={}){let lastMessage=``;let lastPresentationId=``;watch(()=>normalizeMessage(value.value),nextMessage=>{if(!nextMessage){lastMessage=``;if(lastPresentationId){runtime.dismiss(lastPresentationId);lastPresentationId=``}return}if(nextMessage===lastMessage)return;lastMessage=nextMessage;const action=actionFactory({message:nextMessage,kind});const reportResult=runtime.report({source:normalizedSource,message:nextMessage,intent,severity,channel,action,dedupeKey:`${normalizedSource}:${kind}:${nextMessage}`,dedupeWindowMs});const nextPresentationId=String(reportResult?.presentationId||``).trim();if(nextPresentationId){if(lastPresentationId&&lastPresentationId!==nextPresentationId)runtime.dismiss(lastPresentationId);lastPresentationId=nextPresentationId}},{immediate:true})}if(loadError)watchMessage(loadError,{kind:`load`,channel:loadChannel,intent:`resource-load`,severity:loadSeverity,actionFactory:loadActionFactory});if(notFoundError)watchMessage(notFoundError,{kind:`not-found`,channel:notFoundChannel,intent:`resource-load`,severity:notFoundSeverity,actionFactory:notFoundActionFactory})}function setupRouteChangeCleanup({enabled=true,route,feedback,onClear}){if(!enabled)return;watch(()=>route?.fullPath,()=>{feedback.clear();onClear()})}var CRUD_API_ACCESS_AUTHENTICATED=`authenticated`;var CRUD_API_ACCESS_PUBLIC=`public`;var CRUD_API_ACCESS_VALUES=Object.freeze([CRUD_API_ACCESS_AUTHENTICATED,CRUD_API_ACCESS_PUBLIC]);var publicCrudClients=new WeakSet;function normalizeCrudApiAccess(value=``){const normalized=normalizeText(value).toLowerCase()||`authenticated`;if(CRUD_API_ACCESS_VALUES.includes(normalized))return normalized;throw new TypeError(`CRUD resource apiAccess must be one of: ${CRUD_API_ACCESS_VALUES.join(`, `)}. Received: ${String(value||``)||`(empty)`}`)}function resolveCrudHttpClient(resource=null,{client=getHttpWebClient()}={}){if(normalizeCrudApiAccess(resource?.apiAccess)!==`public`)return client;if(publicCrudClients.has(client))return client;const publicClient=Object.freeze({request(url,options={}){const requestOptions=options&&typeof options===`object`&&!Array.isArray(options)?options:{};return client.request(url,{...requestOptions,csrf:false})}});publicCrudClients.add(publicClient);return publicClient}function useCommand({ownershipFilter=ROUTE_VISIBILITY_WORKSPACE,surfaceId=``,access=`auto`,apiSuffix=``,runPermissions=[],writeMethod=`POST`,client,resource:commandResource=null,transport,placementSource=`http-web.command`,fallbackRunError=`jskit.http.feedback.actionFailed`,fieldErrorKeys,clearOnRouteChange=true,model,input,buildRawPayload,buildCommandPayload,buildCommandOptions,onRunSuccess,onRunError,suppressSuccessMessage=false,messages={},realtime}){const operationScope=useOperationScope({ownershipFilter,surfaceId,access,apiSuffix,model,readEnabled:false,permissionSets:{run:runPermissions},realtime});const routeContext=operationScope.routeContext;const canRun=operationScope.permissionGate(`run`);const endpointResource=useEndpointResource({path:operationScope.apiPath,enabled:false,client:resolveCrudHttpClient(commandResource,{client}),writeMethod,transport,fallbackSaveError:fallbackRunError});const feedback=useUiFeedback({source:`${placementSource}.feedback`});const fieldBag=useFieldErrorBag(fieldErrorKeys);const command=useCommandCore({model,resource:endpointResource,writeMethod,canRun,fieldBag,feedback,input,buildRawPayload,buildCommandPayload,buildCommandOptions,onRunSuccess,onRunError,suppressSuccessMessage:Boolean(suppressSuccessMessage),messages:{validation:`jskit.http.feedback.fixInvalidValues`,success:`jskit.http.feedback.completed`,error:String(fallbackRunError||`jskit.http.feedback.actionFailed`),...messages&&typeof messages===`object`?messages:{}}});setupRouteChangeCleanup({enabled:clearOnRouteChange,route:routeContext.route,feedback,onClear:fieldBag.clear});const loadError=operationScope.loadError();const isLoading=operationScope.isLoading();setupOperationErrorReporting({source:`${placementSource}.load`,loadError});return proxyRefs({canRun,isLoading,loadError,isRunning:command.running,fieldErrors:command.fieldErrors,message:command.message,messageType:command.messageType,run:command.run,resource:endpointResource})}export{useCommand as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/english-definitions-I9tIXY2u.js","assets/placement-Lk1Lpy6s.js","assets/placement-BAaZQhAh.js","assets/runtime-core.esm-bundler-Bi1P1jMa.js","assets/returnToPath-CILshEkc.js","assets/normalize-BD25VwNK.js","assets/linkPath-BsiibCNd.js","assets/surface-CBlx7sF_.js","assets/vibe64GithubProject-DNl0aDcC.js","assets/vibe64SessionToolDefinitions-BijEEwqu.js","assets/vibe64ProjectScope.local-B9ZpdYlf.js","assets/deepFreeze-BgoYkoTa.js","assets/validators-B3YzM6px.js","assets/i18n-DpzQwXg6.js","assets/index-Bvd00puv.js","assets/VChip-D2IukBZw.js","assets/VChip-4Nj-0ztL.css","assets/error-kdRkyK9x.js","assets/i18n-BuXRXGaO.js","assets/i18n-B5lc019_.js","assets/useEndpointResource-61E93qP-.js","assets/httpClient-BRO3GqjU.js","assets/queryPath-yKLyWw8V.js","assets/visibility-Cq31Xy7I.js","assets/useRealtimeEvent-B4oRg9Dt.js","assets/errorMessageHelpers-L2GsOwCP.js","assets/useApi-BPuI6ZR9-rsYWyW6m.js","assets/devtools-CN5uWJaH-_xug6686.js","assets/preload-helper-BvdcsxN9.js","assets/VSelect-9lMtP5cu.js","assets/VOverlay-DUKRqNx3.js","assets/lazy-vXRXMwYF.js","assets/VOverlay-DG-PukqI.css","assets/VMenu-DQ9SZ1Fq.js","assets/ssrBoot-C6UwmCGc.js","assets/VDivider-DGkInAUr.js","assets/VDivider-DvkP_iX7.css","assets/VMenu-9TUL6_ph.css","assets/VTextField-BMvaWVTN.js","assets/VTextField-F6unyhrS.css","assets/VCheckboxBtn-6ebHAnh9.js","assets/VCheckboxBtn-o1O5Bixh.css","assets/VSheet-D5wAuyc2.js","assets/VSheet-BbLSwuzR.css","assets/VSelect-yFA6_y4G.css","assets/VAlert-DyCQWe9P.js","assets/VBtn-2vbH580C.js","assets/VBtn-C1plz3b1.css","assets/VAlert-Bp38AD8H.css","assets/useVibe64Learning-DZCyrfpy.js","assets/vibe64AssistantHost-CyWUOG-F.js","assets/asyncModuleRecovery-BALhPqsY.js","assets/VDialog-B2W9wqR8.js","assets/VDialog-DP-kc9Gx.css","assets/_plugin-vue_export-helper-DNW4j-dv.js","assets/browser-D8z6v6Ge.js","assets/StudioErrorNotice-CCT_T6mT.js","assets/StudioErrorNotice-CQfeUEOD.css","assets/browserLocalStorage-B4C7rHrs.js","assets/clipboard-CZs9aH3L.js","assets/useVibe64Learning-B9b7aUr-.css","assets/layout-B_cpKP4k.js","assets/errors-DErd0NON.js","assets/studioUrls-oIU1Eq_t.js","assets/client-DnjkdG6K.js","assets/VAutocomplete-CiXrKMyn.js","assets/VAutocomplete-D48FgPMA.css","assets/VCheckbox-B40zJSbZ.js","assets/VCheckbox-ChRKi1kj.css","assets/VCard-BFqQSnAE.js","assets/VCard-dv-Dc592.css","assets/VRow-Dz87sIhY.js","assets/VRow-BdVn5u8X.css","assets/VSpacer-GgPR_AzN.js","assets/VSpacer-DfbUir7X.css","assets/VExpansionPanels-BHw1Id_o.js","assets/VExpansionPanels-cvCWEkWz.css","assets/VRadioGroup-D1duMMwJ.js","assets/VRadioGroup-C9f4tbih.css","assets/VSkeletonLoader-C5ZRrPV4.js","assets/VSkeletonLoader-LCPSxykp.css","assets/VSwitch-DUkp5sfW.js","assets/VSwitch-DAlld-JI.css","assets/useCommand-D96utlVe.js","assets/usePaths-B-QGqa_I.js","assets/pathname-DOqQPPVa.js","assets/useUiFeedback-CycH_fvY.js","assets/shared-X5MxTHwl.js","assets/assistantRouting-D4SnnxJn.js","assets/shared-DjZEYqzW.js","assets/vibe64ApiResponses-DuJ9mfus.js","assets/studioGateApi-CHIdcQvD.js","assets/client-B8u2_Svv.css","assets/client-4uCr4dYG.js","assets/VTextarea-CLaWcpd_.js","assets/VTextarea--uW4w6nq.css","assets/useAssistantAttachments-CkseokGM.js","assets/conversation-QpMeXw70.js","assets/conversation-p_mmD9ie.js","assets/conversation-La-pkh5h.css","assets/vueRefOrGetterValue-y-4f_In7.js","assets/vibe64BrowserTabOrigin-vIN_87mi.js","assets/vibe64SessionRequestConfig-DVRCRAex.js","assets/windowSizeClass-DQekxFgV.js","assets/index-BBfSvf2i.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{it as watch,mt as onScopeDispose,u as computed,vt as ref,xt as shallowRef}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{r as isRecord,s as normalizeObject}from"./normalize-BD25VwNK.js";import{t as __vitePreload}from"./preload-helper-BvdcsxN9.js";import{n as getHttpWebClient}from"./httpClient-BRO3GqjU.js";import{n as normalizeConversationTurn$1}from"./conversation-p_mmD9ie.js";import{r as useRealtimeEvent}from"./useRealtimeEvent-B4oRg9Dt.js";import{t as usePaths}from"./usePaths-B-QGqa_I.js";import{t as readRefOrGetterValue}from"./vueRefOrGetterValue-y-4f_In7.js";import{I as vibe64SessionEventMatchesScope,L as vibe64SessionPath,o as VIBE64_SESSIONS_API_SUFFIX,s as VIBE64_SESSION_CHANGED_EVENT}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{o as normalizeVibe64ConversationAttachments}from"./shared-X5MxTHwl.js";import{P as useVibe64ProjectSlug}from"./index-Bvd00puv.js";var CONVERSATION_LOG_REALTIME_REASONS=new Set([`project-message-changed`,`conversation-rewound`,`session-assistant-selection-updated`,`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 normalizeConversationTurn(turn={},index=0){const normalized=normalizeConversationTurn$1(turn,index,{normalizeAttachments:normalizeVibe64ConversationAttachments});return normalized&&{...normalized,...isRecord(turn.integrationSetup)?{integrationSetup:turn.integrationSetup}:{}}}function normalizeConversationLog(payload,options={}){const log=normalizeObject(payload).conversationLog;return conversationTurnsWithPending((Array.isArray(log)?log:[]).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 sessionAgentTurnActive(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!reason||CONVERSATION_LOG_REALTIME_REASONS.has(reason)}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.`);const{connectorDefinitions}=await __vitePreload(async()=>{const{connectorDefinitions}=await import(`./english-definitions-I9tIXY2u.js`).then(n=>n.n);return{connectorDefinitions}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104]));if(integrationActionPending.value!==selection||sessionId.value!==selection.sessionId)return false;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}){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`}));const turns=computed(()=>conversationTurnsWithPending(conversation.turns.value,sessionAgentTurnActive(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{integrationConnections:integrationActions.integrationConnections,connectIntegrationRequest:integrationActions.connectIntegrationRequest,checkIntegrationRequest:integrationActions.checkIntegrationRequest,cancelIntegrationRequest:integrationActions.cancelIntegrationRequest,integrationActionPending:integrationActions.integrationActionPending,integrationActionError:integrationActions.integrationActionError,skipIntegrationRequest:integrationActions.skipIntegrationRequest,resumeIntegrationRequest:integrationActions.resumeIntegrationRequest,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))}}export{useVibe64ConversationLog as n,normalizeConversationLog as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as isRecord,s as normalizeObject,u as normalizeText}from"./normalize-BD25VwNK.js";import{t as deepFreeze}from"./deepFreeze-BgoYkoTa.js";function normalizeObjectInput(value){if(!isRecord(value))return{};return{...value}}function isPlainObject(value){if(value===null||typeof value!==`object`)return false;const prototype=Object.getPrototypeOf(value);return prototype===Object.prototype||prototype===null||isEmptyNullPrototypeRecord(prototype)}function isEmptyNullPrototypeRecord(value){return value!==null&&typeof value===`object`&&Object.getPrototypeOf(value)===null&&Reflect.ownKeys(value).length===0}function isSchemaLike(value){return value!==null&&typeof value===`object`&&isPlainObject(value.structure)&&isPlainObject(value.operations)&&typeof value.validateWith===`function`&&typeof value.toJsonSchema===`function`&&typeof value.cleanup===`function`}function resolveArrayItemsConfig(fieldPath,definition){if(!Object.hasOwn(definition,`items`))return null;const{items}=definition;if(isSchemaLike(items))return{kind:`schema`,schema:items};if(!isPlainObject(items)||typeof items.type!==`string`)throw new Error(`Array field "${fieldPath}" must define items as either a Schema instance or a field definition object.`);return{kind:`definition`,definition:items}}function resolveObjectValuesConfig(fieldPath,definition){if(!Object.hasOwn(definition,`values`))return null;const{values}=definition;if(isSchemaLike(values))return{kind:`schema`,schema:values};if(!isPlainObject(values)||typeof values.type!==`string`)throw new Error(`Object field "${fieldPath}" must define values as either a Schema instance or a field definition object.`);return{kind:`definition`,definition:values}}function resolveObjectFieldMode(fieldPath,definition){const hasNestedSchema=Object.hasOwn(definition,`schema`);const hasValues=Object.hasOwn(definition,`values`);const hasAdditionalProperties=Object.hasOwn(definition,`additionalProperties`);if(hasNestedSchema&&hasValues)throw new Error(`Object field "${fieldPath}" cannot define both schema and values.`);if(hasAdditionalProperties&&definition.additionalProperties!==true)throw new Error(`Object field "${fieldPath}" only supports additionalProperties: true.`);if(hasValues&&definition.additionalProperties===true)throw new Error(`Object field "${fieldPath}" cannot define both values and additionalProperties: true.`);if(hasNestedSchema){if(!isSchemaLike(definition.schema))throw new Error(`Object field "${fieldPath}" must define schema as a Schema instance.`);return{kind:`nested`,schema:definition.schema,allowAdditionalProperties:definition.additionalProperties===true}}if(hasValues)return{kind:`map`,valuesConfig:resolveObjectValuesConfig(fieldPath,definition)};if(definition.additionalProperties===true)return{kind:`opaque`};return{kind:`plain`}}function isNumericDefinition(definition){return definition?.type===`number`||definition?.type===`integer`||definition?.type===`epochMilliseconds`||definition?.type===`epochSeconds`}var EPOCH_MILLISECONDS_LIMIT=864e13;var EPOCH_SECONDS_LIMIT=864e10;var EPOCH_INTEGER_STRING_PATTERN=`^(?:0|-?[1-9]\\d*)$`;var YEAR_PATTERN=`\\d{4}`;var MONTH_PATTERN=`0[1-9]|1[0-2]`;var DAY_PATTERN=`0[1-9]|[12]\\d|3[01]`;var HOUR_PATTERN=`[01]\\d|2[0-3]`;var MINUTE_OR_SECOND_PATTERN=`[0-5]\\d`;var HOUR_MINUTE_PATTERN=`(?:${HOUR_PATTERN}):${MINUTE_OR_SECOND_PATTERN}`;var TIME_ZONE_PATTERN=`(?:Z|[+-](?:${HOUR_PATTERN}):${MINUTE_OR_SECOND_PATTERN})`;var CAPTURED_DATE_PATTERN=`(${YEAR_PATTERN})-(${MONTH_PATTERN})-(${DAY_PATTERN})`;var JSON_SCHEMA_DATE_PATTERN=`${YEAR_PATTERN}-(?:${MONTH_PATTERN})-(?:${DAY_PATTERN})`;var DATE_JSON_SCHEMA_PATTERN=`^${JSON_SCHEMA_DATE_PATTERN}$`;var DATE_PATTERN=new RegExp(`^${CAPTURED_DATE_PATTERN}$`);var TIME_PATTERN=new RegExp(`^${HOUR_MINUTE_PATTERN}(?::${MINUTE_OR_SECOND_PATTERN}(?:\\.(\\d+))?)?$`);var DATE_TIME_PATTERN=new RegExp(`^${CAPTURED_DATE_PATTERN}T${HOUR_MINUTE_PATTERN}:${MINUTE_OR_SECOND_PATTERN}(?:\\.(\\d+))?${TIME_ZONE_PATTERN}$`);var EPOCH_INTEGER_STRING=new RegExp(EPOCH_INTEGER_STRING_PATTERN);var DAYS_PER_MONTH=[31,28,31,30,31,30,31,31,30,31,30,31];function isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}function daysInMonth(year,month){if(month===2)return isLeapYear(year)?29:28;return DAYS_PER_MONTH[month-1]}function isValidCalendarDateParts(yearText,monthText,dayText){const year=Number(yearText);const month=Number(monthText);const day=Number(dayText);return month>=1&&month<=12&&day>=1&&day<=daysInMonth(year,month)}function resolveTemporalPrecision(definition,fieldName){const precision=definition.temporalPrecision;if(precision===void 0)return void 0;if(!Number.isInteger(precision)||precision<0)throw new Error(`temporalPrecision for "${fieldName}" must be a non-negative integer.`);return precision}function hasAllowedFractionalPrecision(fraction,temporalPrecision){if(fraction===void 0)return true;return temporalPrecision===void 0||fraction.length<=temporalPrecision}function isValidDate(value){if(typeof value!==`string`)return false;const match=DATE_PATTERN.exec(value);return match!==null&&isValidCalendarDateParts(match[1],match[2],match[3])}function isValidTime(value,temporalPrecision){if(typeof value!==`string`)return false;const match=TIME_PATTERN.exec(value);return match!==null&&hasAllowedFractionalPrecision(match[1],temporalPrecision)}function isValidDateTime(value,temporalPrecision){if(typeof value!==`string`)return false;const match=DATE_TIME_PATTERN.exec(value);if(match===null)return false;return isValidCalendarDateParts(match[1],match[2],match[3])&&hasAllowedFractionalPrecision(match[4],temporalPrecision)}function fractionalPattern(temporalPrecision){if(temporalPrecision===void 0)return`(?:\\.\\d+)?`;if(temporalPrecision===0)return``;return`(?:\\.\\d{1,${temporalPrecision}})?`}function timeJsonSchemaPattern(definition,fieldName){const precision=resolveTemporalPrecision(definition,fieldName);return`^${HOUR_MINUTE_PATTERN}(?::${MINUTE_OR_SECOND_PATTERN}${fractionalPattern(precision)})?$`}function dateTimeJsonSchemaPattern(definition,fieldName){const precision=resolveTemporalPrecision(definition,fieldName);return`^${JSON_SCHEMA_DATE_PATTERN}T${HOUR_MINUTE_PATTERN}:${MINUTE_OR_SECOND_PATTERN}${fractionalPattern(precision)}${TIME_ZONE_PATTERN}$`}function castEpochInteger(value,limit){let integerValue;if(typeof value===`number`)integerValue=value;else if(typeof value===`string`&&EPOCH_INTEGER_STRING.test(value))integerValue=Number(value);else return null;if(!Number.isSafeInteger(integerValue)||integerValue<-limit||integerValue>limit)return null;return integerValue===0?0:integerValue}var UNSAFE_PATH_SEGMENTS=new Set([`__proto__`,`prototype`,`constructor`]);function setOwnProperty(target,key,value){Object.defineProperty(target,key,{value,enumerable:true,configurable:true,writable:true})}function assertSafePathSegment(segment,helperName){if(UNSAFE_PATH_SEGMENTS.has(segment))throw new Error(`${helperName}() received unsafe path segment "${segment}".`)}function normalizeFieldPath(path){if(typeof path!==`string`)return path;return path.replace(/\[(.+?)\]/g,`.$1`).replace(/^\.+/,``).replace(/\.+/g,`.`).replace(/\.$/,``)}function buildPathSegments$1(path,helperName,{normalize=false,allowEmpty=false}={}){const normalizedPath=normalize?normalizeFieldPath(path):path;if(typeof normalizedPath!==`string`||normalizedPath.trim()===``){if(allowEmpty&&normalizedPath===``)return[];throw new Error(`${helperName}() expects a non-empty dotted path string.`)}const segments=normalizedPath.split(`.`);if(segments.some(segment=>segment===``))throw new Error(`${helperName}() received an invalid path "${normalizedPath}".`);for(const segment of segments)assertSafePathSegment(segment,helperName);return segments}var JSON_SCHEMA_DRAFT_07=`http://json-schema.org/draft-07/schema#`;var JSON_REST_EXTENSION_KEY=`x-json-rest-schema`;var NON_NULL_JSON_TYPES=[`object`,`array`,`string`,`number`,`boolean`];var EXPORT_CONTEXT_KEY=Symbol(`json-rest-schema.exportContext`);var BOOLEAN_TRUE_VALUES=[`true`,`1`,`yes`,`y`,`on`];var BOOLEAN_FALSE_VALUES=[`false`,`0`,`no`,`n`,`off`];function epochIntegerSchema(limit){return{anyOf:[{type:`integer`,minimum:-limit,maximum:limit},{type:`string`,pattern:EPOCH_INTEGER_STRING_PATTERN}]}}function extensionMetadataFragment(section,values){return{[JSON_REST_EXTENSION_KEY]:{[section]:values}}}var BUILTIN_TYPE_EXPORTERS={none:()=>({type:NON_NULL_JSON_TYPES}),blob:()=>({type:NON_NULL_JSON_TYPES}),serialize:()=>({type:NON_NULL_JSON_TYPES}),object:()=>({type:`object`}),array:()=>({type:`array`}),file:()=>({type:`string`}),string:()=>({type:`string`}),number:()=>({type:[`number`,`string`]}),integer:()=>({type:[`integer`,`string`]}),epochMilliseconds:()=>epochIntegerSchema(EPOCH_MILLISECONDS_LIMIT),epochSeconds:()=>epochIntegerSchema(EPOCH_SECONDS_LIMIT),dateTime:({definition,fieldName})=>({type:`string`,format:`date-time`,pattern:dateTimeJsonSchemaPattern(definition,fieldName)}),date:()=>({type:`string`,format:`date`,pattern:DATE_JSON_SCHEMA_PATTERN}),time:({definition,fieldName})=>({type:`string`,pattern:timeJsonSchemaPattern(definition,fieldName)}),boolean:({definition})=>{if(definition.strictBoolean===true)return{type:`boolean`};const trueValues=new Set([...BOOLEAN_TRUE_VALUES,String(definition.stringTrueWhen||`true`).trim().toLowerCase()]);return{anyOf:[{type:`boolean`},{type:`number`,enum:[0,1]},{type:`string`,enum:[...new Set([...BOOLEAN_FALSE_VALUES,String(definition.stringFalseWhen||`false`).trim().toLowerCase()]),...trueValues]}]}},id:()=>({type:[`integer`,`string`],minimum:1,pattern:`^[1-9][0-9]*$`})};var BUILTIN_VALIDATOR_EXPORTERS={minLength:({definition,parameterValue})=>definition.type===`string`?{minLength:parameterValue}:null,maxLength:({definition,parameterValue})=>definition.type===`string`?{maxLength:parameterValue}:null,min:({definition,parameterValue})=>isNumericDefinition(definition)?{minimum:parameterValue}:null,max:({definition,parameterValue})=>isNumericDefinition(definition)?{maximum:parameterValue}:null,pattern:({definition,parameterValue})=>definition.type===`string`?{pattern:parameterValue instanceof RegExp?parameterValue.source:parameterValue}:null,enum:({parameterValue})=>({enum:parameterValue}),notEmpty:({parameterValue,definition})=>{if(!parameterValue)return null;if(definition.type===`array`)return null;return{minLength:1}},uppercase:({parameterValue})=>parameterValue?extensionMetadataFragment(`transforms`,{uppercase:true}):null,lowercase:({parameterValue})=>parameterValue?extensionMetadataFragment(`transforms`,{lowercase:true}):null,length:({parameterValue})=>extensionMetadataFragment(`transforms`,{length:parameterValue}),unsigned:({parameterValue})=>parameterValue?extensionMetadataFragment(`metadata`,{unsigned:true}):null,precision:({parameterValue})=>extensionMetadataFragment(`metadata`,{precision:parameterValue}),scale:({parameterValue})=>extensionMetadataFragment(`metadata`,{scale:parameterValue}),temporalPrecision:({parameterValue})=>extensionMetadataFragment(`metadata`,{temporalPrecision:parameterValue}),strictBoolean:()=>null,required:()=>null,nullable:()=>null,nullOnEmpty:()=>null,defaultTo:()=>null};function mergePlainObjects(target,source){for(const key of Object.keys(source)){const sourceValue=source[key];const targetValue=target[key];if(sourceValue&&targetValue&&typeof sourceValue===`object`&&typeof targetValue===`object`&&!Array.isArray(sourceValue)&&!Array.isArray(targetValue)){mergePlainObjects(targetValue,sourceValue);continue}target[key]=sourceValue}}function mergeSchemaFragment(target,fragment){if(!fragment||typeof fragment!==`object`||Array.isArray(fragment))throw new Error(`JSON Schema export hooks must return an object or null.`);for(const key of Object.keys(fragment)){if(key===JSON_REST_EXTENSION_KEY&&target[key]&&typeof target[key]===`object`&&typeof fragment[key]===`object`&&!Array.isArray(target[key])&&!Array.isArray(fragment[key])){mergePlainObjects(target[key],fragment[key]);continue}target[key]=fragment[key]}}function buildAnyOfSchema(baseSchema,alternatives){const finalAlternatives=[...Array.isArray(baseSchema.anyOf)&&Object.keys(baseSchema).length===1?baseSchema.anyOf:[baseSchema],...alternatives];if(finalAlternatives.length===1)return baseSchema;return{anyOf:finalAlternatives}}function getTypeExporter(schema,definition){if(!Object.hasOwn(schema.types,definition.type))throw new Error(`No casting function for type: ${definition.type}`);const handler=schema.types[definition.type];if(typeof handler.toJsonSchema===`function`)return handler.toJsonSchema;const exporter=BUILTIN_TYPE_EXPORTERS[definition.type];if(!exporter)throw new Error(`Type '${definition.type}' cannot be exported to JSON Schema without a toJsonSchema hook.`);return exporter}function getValidatorExporter(schema,parameterName,fieldName){if(!Object.hasOwn(schema.validators,parameterName))return null;const handler=schema.validators[parameterName];if(typeof handler.toJsonSchema===`function`)return handler.toJsonSchema;const exporter=BUILTIN_VALIDATOR_EXPORTERS[parameterName];if(exporter)return exporter;throw new Error(`Validator '${parameterName}' on field '${fieldName}' cannot be exported to JSON Schema without a toJsonSchema hook.`)}function normalizeMode(mode){if(mode===void 0)return`create`;if([`create`,`replace`,`patch`].includes(mode))return mode;throw new Error(`Unsupported JSON Schema export mode '${mode}'. Expected 'create', 'replace', or 'patch'.`)}function resolveOperationName(schema,options={}){if(options.mode!==void 0&&options.operation!==void 0){const normalizedMode=normalizeMode(options.mode);if(normalizedMode!==options.operation)throw new Error(`Conflicting JSON Schema export options: mode '${normalizedMode}' does not match operation '${options.operation}'.`)}if(options.operation!==void 0){if(!Object.hasOwn(schema.operations,options.operation))throw new Error(`Unknown JSON Schema export operation '${options.operation}'.`);return options.operation}return normalizeMode(options.mode)}function resolveExportOperation(schema,options={}){if(options.operationName!==void 0&&options.operationDescriptor!==void 0)return{operationName:options.operationName,operation:options.operationDescriptor};const operationName=resolveOperationName(schema,options);return{operationName,operation:schema.operations[operationName]}}function createExportOptions(options={}){const exportOptions={...options};Object.defineProperty(exportOptions,EXPORT_CONTEXT_KEY,{value:{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null},enumerable:false});return exportOptions}function getExportContext(options={}){if(options[EXPORT_CONTEXT_KEY])return options[EXPORT_CONTEXT_KEY];return{definitions:{},nodes:[],nextDefinitionId:1,rootNode:null}}function sanitizeDefinitionNamePart(value){return String(value).replace(/[^a-zA-Z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`operation`}function isReferenceOnlySchema(schema){return isPlainObject(schema)&&Object.keys(schema).length===1&&typeof schema.$ref===`string`}function wrapReferenceSchema(schema){if(!isReferenceOnlySchema(schema))return schema;return{allOf:[schema]}}function findExportNode(exportContext,schema,operationName,operation,additionalProperties){return exportContext.nodes.find(node=>node.schema===schema&&node.operationName===operationName&&node.operation===operation&&node.additionalProperties===additionalProperties)||null}function createDefinitionName(exportContext,operationName){const suffix=sanitizeDefinitionNamePart(operationName);const definitionName=`SchemaNode_${exportContext.nextDefinitionId}_${suffix}`;exportContext.nextDefinitionId+=1;return definitionName}function getOrCreateExportNode(schema,options,operationName,operation,additionalProperties,{root=false}={}){const exportContext=getExportContext(options);const existingNode=findExportNode(exportContext,schema,operationName,operation,additionalProperties);if(existingNode){if(root){existingNode.pointer=`#`;exportContext.rootNode=existingNode}return existingNode}const node={schema,operationName,operation,additionalProperties,status:`new`,definitionName:root?null:createDefinitionName(exportContext,operationName),pointer:root?`#`:null};if(!root)node.pointer=`#/definitions/${node.definitionName}`;else exportContext.rootNode=node;exportContext.nodes.push(node);return node}function buildExportNodeSchema(node,options){if(node.status===`built`)return{$ref:node.pointer};if(node.status===`building`)return{$ref:node.pointer};const exportContext=getExportContext(options);node.status=`building`;if(node.pointer!==`#`)exportContext.definitions[node.definitionName]={};const objectSchema=buildSchemaObjectFragment(node.schema,options,node.operationName,node.operation,node.additionalProperties);node.status=`built`;if(node.pointer===`#`)return objectSchema;exportContext.definitions[node.definitionName]=objectSchema;return{$ref:node.pointer}}function buildSchemaReference(schema,options,operationName,operation,additionalProperties=false){const exportContext=getExportContext(options);const node=getOrCreateExportNode(schema,options,operationName,operation,additionalProperties);if(exportContext.rootNode===node)return{$ref:`#`};return buildExportNodeSchema(node,options)}function createFieldSchemaState(schema,{referenceBacked=false}={}){return{schema,referenceBacked}}function buildSchemaObjectFragment(schema,options,operationName,operation,additionalProperties=false){const properties={};const required=[];for(const[fieldName,definition]of Object.entries(schema.structure)){setOwnProperty(properties,fieldName,buildFieldSchema(schema,fieldName,definition,options,operationName,operation));if(operation.enforceRequired&&definition.required===true)required.push(fieldName)}const objectSchema={type:`object`,properties,additionalProperties};if(required.length>0)objectSchema.required=required;return objectSchema}function buildArrayItemsSchema(schema,fieldName,definition,options,operationName,operation){const itemsConfig=resolveArrayItemsConfig(fieldName,definition);if(!itemsConfig)return null;if(itemsConfig.kind===`schema`)return{...wrapReferenceSchema(buildSchemaReference(itemsConfig.schema,options,`replace`,itemsConfig.schema.operations.replace,false)),[JSON_REST_EXTENSION_KEY]:{castType:`object`}};const itemOperationName=definition.items.type===`object`&&Object.hasOwn(definition.items,`schema`)?`replace`:operationName;const itemOperation=itemOperationName===`replace`?schema.operations.replace:operation;return buildFieldSchema(schema,`${fieldName}[]`,definition.items,options,itemOperationName,itemOperation)}function buildObjectValuesSchema(schema,fieldName,definition,options,operationName,operation){const valuesConfig=resolveObjectValuesConfig(fieldName,definition);if(!valuesConfig)return null;if(valuesConfig.kind===`schema`)return{...wrapReferenceSchema(buildSchemaReference(valuesConfig.schema,options,`replace`,valuesConfig.schema.operations.replace,false)),[JSON_REST_EXTENSION_KEY]:{castType:`object`}};const valueOperationName=valuesConfig.definition.type===`object`&&Object.hasOwn(valuesConfig.definition,`schema`)?`replace`:operationName;const valueOperation=valueOperationName===`replace`?schema.operations.replace:operation;return buildFieldSchema(schema,`${fieldName}.*`,valuesConfig.definition,options,valueOperationName,valueOperation)}function buildBaseFieldSchema(schema,fieldName,definition,options,operationName,operation){if(definition.type===`object`){const objectMode=resolveObjectFieldMode(fieldName,definition);if(objectMode.kind===`nested`)return createFieldSchemaState(buildSchemaReference(objectMode.schema,options,operationName,operation,objectMode.allowAdditionalProperties===true),{referenceBacked:true});if(objectMode.kind===`opaque`)return createFieldSchemaState({type:`object`,additionalProperties:true});if(objectMode.kind===`map`)return createFieldSchemaState({type:`object`,additionalProperties:buildObjectValuesSchema(schema,fieldName,definition,options,operationName,operation)})}const baseSchema=getTypeExporter(schema,definition)({schema,fieldName,definition,operation:operationName,mode:operationName,options});if(!baseSchema||typeof baseSchema!==`object`||Array.isArray(baseSchema))throw new Error(`Type '${definition.type}' on field '${fieldName}' returned an invalid JSON Schema fragment.`);if(definition.type===`array`){const itemsSchema=buildArrayItemsSchema(schema,fieldName,definition,options,operationName,operation);if(itemsSchema)return createFieldSchemaState({...baseSchema,items:itemsSchema},{referenceBacked:isReferenceOnlySchema(baseSchema)})}return createFieldSchemaState(baseSchema,{referenceBacked:isReferenceOnlySchema(baseSchema)})}function buildFieldSchema(schema,fieldName,definition,options,operationName,operation){const exportContext={schema,fieldName,definition,operation:operationName,mode:operationName,options};const baseFieldSchemaState=buildBaseFieldSchema(schema,fieldName,definition,options,operationName,operation);const workingSchema=baseFieldSchemaState.referenceBacked?wrapReferenceSchema(baseFieldSchemaState.schema):{...baseFieldSchemaState.schema};const extensionMetadata={castType:definition.type};for(const parameterName of Object.keys(definition)){if(parameterName===`type`)continue;if(!Object.hasOwn(schema.validators,parameterName))continue;const exporter=getValidatorExporter(schema,parameterName,fieldName);if(!exporter)continue;const fragment=exporter({...exportContext,parameterName,parameterValue:definition[parameterName],fieldSchema:{...workingSchema}});if(!fragment)continue;mergeSchemaFragment(workingSchema,fragment)}if(workingSchema[JSON_REST_EXTENSION_KEY]){mergePlainObjects(extensionMetadata,workingSchema[JSON_REST_EXTENSION_KEY]);delete workingSchema[JSON_REST_EXTENSION_KEY]}const alternatives=[];if(definition.nullable===true)alternatives.push({type:`null`});if(definition.nullOnEmpty===true)alternatives.push({const:``});const finalSchema=wrapReferenceSchema(buildAnyOfSchema(workingSchema,alternatives));if(definition.defaultTo!==void 0&&operation.applyDefaults){if(typeof definition.defaultTo!==`function`){const defaultResult=schema._normalizeDefault(definition,definition.defaultTo,{fieldPath:fieldName,currentObject:{},containerKey:fieldName,objectBeforeCast:{},options:{},settings:schema._buildOperationSettings(operationName,operation,{})});if(Object.keys(defaultResult.errors).length>0){const firstError=Object.values(defaultResult.errors)[0];throw new Error(`defaultTo for "${fieldName}" is invalid (${firstError.code}).`)}finalSchema.default=defaultResult.value}else extensionMetadata.defaults={providedByFunction:true}}finalSchema[JSON_REST_EXTENSION_KEY]=extensionMetadata;return finalSchema}function buildJsonSchema(schema,options={}){const exportOptions=createExportOptions(options);const{operationName,operation}=resolveExportOperation(schema,exportOptions);const additionalProperties=exportOptions.additionalProperties===void 0?false:exportOptions.additionalProperties;const exportContext=getExportContext(exportOptions);const rootNode=getOrCreateExportNode(schema,exportOptions,operationName,operation,additionalProperties,{root:true});const transportSchema={$schema:JSON_SCHEMA_DRAFT_07,...buildExportNodeSchema(rootNode,exportOptions)};if(Object.keys(exportContext.definitions).length>0)transportSchema.definitions=exportContext.definitions;return transportSchema}function isThenable$1(value){return value!==null&&(typeof value===`object`||typeof value===`function`)&&typeof value.then===`function`}function isSchemaInstance(value){return value instanceof Schema}function createSelectionNode(){return{self:false,children:{}}}function hasSelectionChildren(selectionNode){return Object.keys(selectionNode.children).length>0}function joinPath(basePath,pathSegment){return`${basePath}.${String(pathSegment)}`}function buildFieldPath(basePath,fieldName){return basePath===``?String(fieldName):joinPath(basePath,fieldName)}function stripPathPrefix(path,prefix){if(path===prefix)return``;const prefixWithDot=`${prefix}.`;if(!path.startsWith(prefixWithDot))return null;return path.slice(prefixWithDot.length)}function prefixErrorMap(errors,prefix){const prefixedErrors={};for(const error of Object.values(errors)){const field=joinPath(prefix,error.field);setOwnProperty(prefixedErrors,field,{...error,field})}return prefixedErrors}function buildPathSegments(path){return buildPathSegments$1(path,`validatePath`)}function buildSelectionTree(paths){const selectionTree={};for(const path of paths){const segments=buildPathSegments(path);let currentTree=selectionTree;for(let index=0;index<segments.length;index++){const segment=segments[index];if(!Object.hasOwn(currentTree,segment))setOwnProperty(currentTree,segment,createSelectionNode());if(index===segments.length-1)currentTree[segment].self=true;currentTree=currentTree[segment].children}}return selectionTree}function getValueAtPath(value,pathSegments){let currentValue=value;for(const segment of pathSegments){if(currentValue===null||currentValue===void 0)return void 0;if(typeof currentValue!==`object`)return void 0;if(!Object.hasOwn(currentValue,segment))return void 0;currentValue=currentValue[segment]}return currentValue}function hasSelectedValue(value){if(value===null)return true;if(Array.isArray(value))return Object.keys(value).length>0;if(isPlainObject(value))return Object.keys(value).length>0;return value!==void 0}function sortSelectionKeys(keys){return[...keys].sort((left,right)=>{const leftIsIndex=/^[0-9]+$/.test(left);const rightIsIndex=/^[0-9]+$/.test(right);if(leftIsIndex&&rightIsIndex)return Number(left)-Number(right);if(leftIsIndex)return-1;if(rightIsIndex)return 1;return left.localeCompare(right)})}function isNumericPathSegment(segment){return/^[0-9]+$/.test(segment)}function cloneSchemaIntrospectionSnapshot(schema,seen=new WeakMap){if(seen.has(schema))return seen.get(schema);const snapshot=Object.create(Schema.prototype);seen.set(schema,snapshot);snapshot.structure=null;snapshot.types=schema.types;snapshot.validators=schema.validators;snapshot.operations=schema.operations;snapshot.structure=freezeIntrospectionValue(cloneIntrospectionValue(schema.structure,seen));snapshot._installOperationMethods();return Object.freeze(snapshot)}function cloneIntrospectionValue(value,seen=new WeakMap){if(value===null||typeof value!==`object`)return value;if(isSchemaInstance(value))return cloneSchemaIntrospectionSnapshot(value,seen);if(value instanceof Date)return new Date(value.getTime());if(value instanceof RegExp){const cloned=new RegExp(value.source,value.flags);cloned.lastIndex=value.lastIndex;return cloned}if(seen.has(value))return seen.get(value);if(Array.isArray(value)){const cloned=[];seen.set(value,cloned);for(const item of value)cloned.push(cloneIntrospectionValue(item,seen));return cloned}if(!isPlainObject(value))return value;const cloned={};seen.set(value,cloned);for(const[key,entry]of Object.entries(value))setOwnProperty(cloned,key,cloneIntrospectionValue(entry,seen));return cloned}function freezeIntrospectionValue(value,seen=new WeakSet){if(value===null||typeof value!==`object`||seen.has(value)||isSchemaInstance(value))return value;seen.add(value);if(Array.isArray(value))for(const item of value)freezeIntrospectionValue(item,seen);else for(const key of Reflect.ownKeys(value))freezeIntrospectionValue(value[key],seen);return Object.freeze(value)}function createIntrospectionSnapshot(value){return freezeIntrospectionValue(cloneIntrospectionValue(value))}function resolveDefinitionFromSchemaPath(schema,pathSegments,basePath=``){if(!isSchemaInstance(schema))return null;if(!Array.isArray(pathSegments)||pathSegments.length<1)return null;const[fieldName,...rest]=pathSegments;if(!Object.hasOwn(schema.structure,fieldName))return null;const definition=schema.structure[fieldName];if(rest.length<1)return definition;return resolveNestedDefinitionAtPath(schema,definition,rest,buildFieldPath(basePath,fieldName))}function resolveNestedDefinitionAtPath(schema,definition,pathSegments,fieldPath){if(definition?.type===`object`){const objectMode=schema._resolveObjectFieldMode(fieldPath,definition);if(objectMode.kind!==`nested`)return null;return resolveDefinitionFromSchemaPath(objectMode.schema,pathSegments,fieldPath)}if(definition?.type===`array`){const itemsConfig=schema._resolveArrayItemsConfig(fieldPath,definition);if(!itemsConfig||pathSegments.length<1)return null;const[indexSegment,...rest]=pathSegments;if(!isNumericPathSegment(indexSegment))return null;const itemPath=joinPath(fieldPath,indexSegment);if(itemsConfig.kind===`schema`){if(rest.length<1)return null;return resolveDefinitionFromSchemaPath(itemsConfig.schema,rest,itemPath)}if(rest.length<1)return itemsConfig.definition;return resolveNestedDefinitionAtPath(schema,itemsConfig.definition,rest,itemPath)}return null}function buildNestedOptions(options,prefix){const nestedOptions={...options};if(Array.isArray(options.skipFields)){const skipFields=options.skipFields.map(fieldPath=>stripPathPrefix(fieldPath,prefix)).filter(fieldPath=>fieldPath!==null&&fieldPath!==``);if(skipFields.length>0)nestedOptions.skipFields=skipFields;else delete nestedOptions.skipFields}if(isPlainObject(options.skipParams)){const skipParams={};for(const[fieldPath,parameters]of Object.entries(options.skipParams)){const nestedFieldPath=stripPathPrefix(fieldPath,prefix);if(nestedFieldPath===null||nestedFieldPath===``)continue;setOwnProperty(skipParams,nestedFieldPath,parameters)}if(Object.keys(skipParams).length>0)nestedOptions.skipParams=skipParams;else delete nestedOptions.skipParams}return nestedOptions}var DEFAULT_OPERATIONS=Object.freeze({create:Object.freeze({targetFields:`schema`,enforceRequired:true,applyDefaults:true,outputFields:`validated`,rejectExplicitUndefined:true}),replace:Object.freeze({targetFields:`schema`,enforceRequired:true,applyDefaults:true,outputFields:`validated`,rejectExplicitUndefined:true}),patch:Object.freeze({targetFields:`input`,enforceRequired:false,applyDefaults:false,outputFields:`input`,rejectExplicitUndefined:true})});function validateOperationOption(operationName,descriptor,key,allowedValues){const value=descriptor[key];if(!allowedValues.includes(value))throw new Error(`Operation "${operationName}" must define ${key} as one of: ${allowedValues.join(`, `)}.`)}function validateBooleanOperationOption(operationName,descriptor,key,required=true){const value=descriptor[key];if(value===void 0&&!required)return;if(typeof value!==`boolean`)throw new Error(`Operation "${operationName}" must define ${key} as a boolean.`)}function normalizeOperationDescriptor(operationName,descriptor){if(typeof descriptor!==`object`||descriptor===null||Array.isArray(descriptor))throw new Error(`Operation "${operationName}" must be an object.`);validateOperationOption(operationName,descriptor,`targetFields`,[`schema`,`input`]);validateBooleanOperationOption(operationName,descriptor,`enforceRequired`);validateBooleanOperationOption(operationName,descriptor,`applyDefaults`);validateOperationOption(operationName,descriptor,`outputFields`,[`validated`,`input`]);validateBooleanOperationOption(operationName,descriptor,`rejectExplicitUndefined`,false);return Object.freeze({targetFields:descriptor.targetFields,enforceRequired:descriptor.enforceRequired,applyDefaults:descriptor.applyDefaults,outputFields:descriptor.outputFields,rejectExplicitUndefined:descriptor.rejectExplicitUndefined===void 0?true:descriptor.rejectExplicitUndefined})}function normalizeOperations(operations={}){if(typeof operations!==`object`||operations===null||Array.isArray(operations))throw new Error(`Schema operations must be an object.`);const normalizedOperations=Object.create(null);for(const[operationName,descriptor]of Object.entries(DEFAULT_OPERATIONS))setOwnProperty(normalizedOperations,operationName,descriptor);for(const[operationName,descriptor]of Object.entries(operations))setOwnProperty(normalizedOperations,operationName,normalizeOperationDescriptor(operationName,descriptor));return Object.freeze(normalizedOperations)}function freezeOwnMap(source){const map=Object.create(null);for(const[key,value]of Object.entries(source))setOwnProperty(map,key,value);return Object.freeze(map)}function cloneValidationOptions(options){const validationOptions={...options};delete validationOptions.operation;delete validationOptions.mode;return validationOptions}var Schema=class{constructor(structure,types,validators,operations={}){this.structure=structure;this.types=freezeOwnMap(types);this.validators=freezeOwnMap(validators);this.operations=normalizeOperations(operations);this._installOperationMethods()}_typeError(field){return this._paramError(field,`TYPE_CAST_FAILED`,`Value could not be cast to the required type.`)}_paramError(field,code,message,params={}){const e=new Error(message);e.errorObject={field,code,message,params};return e}_paramToBeSkipped(parameterName,skipParams,fieldName){if(typeof skipParams!==`object`||skipParams===null)return false;if(Array.isArray(skipParams[fieldName])&&skipParams[fieldName].includes(parameterName))return true;return false}_fieldToBeSkipped(fieldPath,options){return Array.isArray(options.skipFields)&&options.skipFields.includes(fieldPath)}_mergeErrors(target,source){for(const[fieldPath,error]of Object.entries(source))setOwnProperty(target,fieldPath,error)}_singleErrorMap(error){const errors={};setOwnProperty(errors,error.field,error);return errors}_assertSupportedOptions(options={}){if(Object.hasOwn(options,`onlyObjectValues`))throw new Error("Unsupported validation option `onlyObjectValues`. Call `patch()` directly.");if(Object.hasOwn(options,`mode`))throw new Error("Unsupported validation option `mode`. Call `validateWith()` or an operation method directly.");if(Object.hasOwn(options,`operation`))throw new Error("Unsupported validation option `operation`. Call `validateWith()` or an operation method directly.")}_buildOperationSettings(operationName,operation,object){return{operationName,operation,targetFieldNames:operation.targetFields===`input`?Object.keys(object):Object.keys(this.structure),outputFieldNames:operation.outputFields===`input`?Object.keys(object):Object.keys(this.structure),enforceRequired:operation.enforceRequired,applyDefaults:operation.applyDefaults,rejectExplicitUndefined:operation.rejectExplicitUndefined,defaultedFields:new Set,isFieldPresent:fieldName=>Object.hasOwn(object,fieldName)}}_assertPlainObjectInput(methodName,object){if(!isPlainObject(object))throw new Error(`${methodName}() expects a plain object input.`)}_resolvePathValidationRequest(options={}){const operationName=options.operation??options.mode??`patch`;if(Object.hasOwn(options,`operation`)&&Object.hasOwn(options,`mode`)&&options.operation!==options.mode)throw new Error("Path validation options `operation` and `mode` must match when both are provided.");if(!Object.hasOwn(this.operations,operationName))throw new Error(`Unknown operation "${operationName}".`);return{operationName,operation:this.operations[operationName],validationOptions:cloneValidationOptions(options)}}_buildOperationResult(object,workingObject,settings){const validatedObject={};for(const fieldName of settings.outputFieldNames){if(!Object.hasOwn(this.structure,fieldName))continue;const fieldPresent=settings.isFieldPresent(fieldName);if(!(workingObject[fieldName]!==void 0||fieldPresent&&object[fieldName]===null||settings.defaultedFields.has(fieldName)))continue;if(!fieldPresent&&!settings.defaultedFields.has(fieldName))continue;setOwnProperty(validatedObject,fieldName,workingObject[fieldName])}return validatedObject}_resolveObjectFieldMode(fieldPath,definition){return resolveObjectFieldMode(fieldPath,definition)}_resolveArrayItemsConfig(fieldPath,definition){return resolveArrayItemsConfig(fieldPath,definition)}_resolveObjectValuesConfig(fieldPath,definition){return resolveObjectValuesConfig(fieldPath,definition)}_buildArrayItemSettings(definition,settings){if(definition.type===`object`&&Object.hasOwn(definition,`schema`))return{...settings,operationName:`replace`,operation:this.operations.replace};return settings}_castValue(definition,rawValue,fieldPath,currentObject,containerKey,objectBeforeCast,options,settings){const nullable=definition.nullable===true||options.nullable===true;const nullOnEmpty=definition.nullOnEmpty===true||options.nullOnEmpty===true;if(!Object.hasOwn(this.types,definition.type))throw new Error(`No casting function for type: ${definition.type}`);const typeHandler=this.types[definition.type];if(rawValue===null){if(nullable){setOwnProperty(currentObject,containerKey,null);return{errors:{},shouldContinue:false}}return{errors:this._singleErrorMap({field:fieldPath,code:`NOT_NULLABLE`,message:`Field cannot be null`,params:{}}),shouldContinue:false}}if(rawValue===``&&nullOnEmpty){setOwnProperty(currentObject,containerKey,null);return{errors:{},shouldContinue:false}}const context={schema:this,definition,value:rawValue,fieldName:fieldPath,object:currentObject,objectBeforeCast,valueBeforeCast:rawValue,options,mode:settings.operationName,operation:settings.operationName,fieldPresent:true,computedOptions:{nullable:nullable||nullOnEmpty,nullOnEmpty},throwTypeError:()=>{throw this._typeError(fieldPath)},throwParamError:(code,message,params)=>{throw this._paramError(fieldPath,code,message,params)}};try{const castResult=typeHandler(context);if(isThenable$1(castResult))throw new Error(`Type handler for "${definition.type}" must be synchronous.`);if(castResult!==void 0){setOwnProperty(currentObject,containerKey,castResult);context.value=castResult}}catch(e){if(e.errorObject)return{errors:this._singleErrorMap(e.errorObject),shouldContinue:false};throw e}return{errors:{},context,shouldContinue:true}}_runFieldValidators(definition,fieldPath,currentObject,containerKey,context,options){for(const paramName of Object.keys(definition)){if(paramName===`type`)continue;if(this._paramToBeSkipped(paramName,options.skipParams,fieldPath))continue;if(!Object.hasOwn(this.validators,paramName))continue;const validatorHandler=this.validators[paramName];try{context.parameterName=paramName;context.parameterValue=definition[paramName];const validatorResult=validatorHandler(context);if(isThenable$1(validatorResult))throw new Error(`Validator handler for "${paramName}" must be synchronous.`);if(validatorResult!==void 0){setOwnProperty(currentObject,containerKey,validatorResult);context.value=validatorResult}}catch(e){if(e.errorObject)return this._singleErrorMap(e.errorObject);throw e}}return{}}_normalizeAndValidateValue(definition,rawValue,fieldPath,currentObject,containerKey,objectBeforeCast,options,settings){const castResult=this._castValue(definition,rawValue,fieldPath,currentObject,containerKey,objectBeforeCast,options,settings);if(Object.keys(castResult.errors).length>0)return castResult.errors;if(!castResult.shouldContinue)return{};const{context}=castResult;const nestedErrors=this._validateNestedValue(definition,fieldPath,currentObject,containerKey,options,settings);if(Object.keys(nestedErrors).length>0)return nestedErrors;context.value=currentObject[containerKey];return this._runFieldValidators(definition,fieldPath,currentObject,containerKey,context,options)}_normalizeDefault(definition,defaultValue,{fieldPath,currentObject,containerKey,objectBeforeCast,options,settings}){const defaultObject={...currentObject};setOwnProperty(defaultObject,containerKey,defaultValue);return{errors:this._normalizeAndValidateValue(definition,defaultValue,fieldPath,defaultObject,containerKey,objectBeforeCast,options,settings),value:defaultObject[containerKey]}}_validateNestedValue(definition,fieldPath,currentObject,containerKey,options,settings){if(definition.type===`object`){const objectMode=this._resolveObjectFieldMode(fieldPath,definition);if(objectMode.kind===`nested`)return this._validateNestedObjectSchema(objectMode,fieldPath,currentObject,containerKey,options,settings);if(objectMode.kind===`map`)return this._validateObjectValues(fieldPath,currentObject,containerKey,objectMode.valuesConfig,options,settings);return{}}if(definition.type!==`array`)return{};const itemsConfig=this._resolveArrayItemsConfig(fieldPath,definition);if(!itemsConfig)return{};return this._validateArrayItems(fieldPath,currentObject,containerKey,itemsConfig,options,settings)}_validateNestedObjectSchema(objectMode,fieldPath,currentObject,containerKey,options,settings){const sourceObject=currentObject[containerKey];const nestedInput=objectMode.allowAdditionalProperties?this._extractKnownObjectFields(sourceObject,objectMode.schema):sourceObject;const nestedResult=objectMode.schema._validateWithOperation(settings.operationName,settings.operation,nestedInput,buildNestedOptions(options,fieldPath));setOwnProperty(currentObject,containerKey,objectMode.allowAdditionalProperties?this._mergeKnownAndPassthroughObjectFields(sourceObject,objectMode.schema,nestedResult.validatedObject):nestedResult.validatedObject);return prefixErrorMap(nestedResult.errors,fieldPath)}_extractKnownObjectFields(sourceObject,nestedSchema){const knownObject={};for(const[key,value]of Object.entries(sourceObject))if(Object.hasOwn(nestedSchema.structure,key))setOwnProperty(knownObject,key,value);return knownObject}_mergeKnownAndPassthroughObjectFields(sourceObject,nestedSchema,validatedObject){const mergedObject={};for(const key of Object.keys(sourceObject)){if(!Object.hasOwn(nestedSchema.structure,key)){setOwnProperty(mergedObject,key,sourceObject[key]);continue}if(Object.hasOwn(validatedObject,key))setOwnProperty(mergedObject,key,validatedObject[key])}for(const[key,value]of Object.entries(validatedObject))if(!Object.hasOwn(mergedObject,key))setOwnProperty(mergedObject,key,value);return mergedObject}_validateObjectValues(fieldPath,currentObject,containerKey,valuesConfig,options,settings){const originalEntries=currentObject[containerKey];const normalizedEntries={...originalEntries};const errors={};setOwnProperty(currentObject,containerKey,normalizedEntries);for(const key of Object.keys(originalEntries)){const valuePath=joinPath(fieldPath,key);if(this._fieldToBeSkipped(valuePath,options))continue;const rawValue=normalizedEntries[key];if(rawValue===void 0){if(settings.rejectExplicitUndefined)this._mergeErrors(errors,this._singleErrorMap(this._typeError(valuePath).errorObject));else delete normalizedEntries[key];continue}if(valuesConfig.kind===`schema`){const valueResult=valuesConfig.schema._validateWithOperation(`replace`,valuesConfig.schema.operations.replace,rawValue,buildNestedOptions(options,valuePath));setOwnProperty(normalizedEntries,key,valueResult.validatedObject);this._mergeErrors(errors,prefixErrorMap(valueResult.errors,valuePath));continue}const valueErrors=this._normalizeAndValidateValue(valuesConfig.definition,rawValue,valuePath,normalizedEntries,key,originalEntries,options,this._buildArrayItemSettings(valuesConfig.definition,settings));this._mergeErrors(errors,valueErrors)}return errors}_validateArrayItems(fieldPath,currentObject,containerKey,itemsConfig,options,settings){const originalItems=currentObject[containerKey];const normalizedItems=originalItems.slice();const errors={};setOwnProperty(currentObject,containerKey,normalizedItems);for(let index=0;index<normalizedItems.length;index++){const itemPath=joinPath(fieldPath,index);if(this._fieldToBeSkipped(itemPath,options))continue;if(!Object.hasOwn(originalItems,index)||normalizedItems[index]===void 0){if(settings.rejectExplicitUndefined)this._mergeErrors(errors,this._singleErrorMap(this._typeError(itemPath).errorObject));else delete normalizedItems[index];continue}if(itemsConfig.kind===`schema`){const itemResult=itemsConfig.schema._validateWithOperation(`replace`,itemsConfig.schema.operations.replace,normalizedItems[index],buildNestedOptions(options,itemPath));setOwnProperty(normalizedItems,index,itemResult.validatedObject);this._mergeErrors(errors,prefixErrorMap(itemResult.errors,itemPath));continue}const itemErrors=this._normalizeAndValidateValue(itemsConfig.definition,normalizedItems[index],itemPath,normalizedItems,index,originalItems,options,this._buildArrayItemSettings(itemsConfig.definition,settings));this._mergeErrors(errors,itemErrors)}return errors}_validateField(fieldName,object,validatedObject,options,settings){if(!Object.hasOwn(this.structure,fieldName))return{};const definition=this.structure[fieldName];if(this._fieldToBeSkipped(fieldName,options))return{};const fieldPresent=settings.isFieldPresent(fieldName);const rawValue=object[fieldName];const valueMissing=rawValue===void 0;if(settings.enforceRequired&&definition.required&&(!fieldPresent||valueMissing)){if(!this._paramToBeSkipped(`required`,options.skipParams,fieldName))return this._singleErrorMap({field:fieldName,code:`REQUIRED`,message:`Field is required`,params:{}})}if(!fieldPresent)return{};if(valueMissing){if(settings.rejectExplicitUndefined)return this._singleErrorMap(this._typeError(fieldName).errorObject);return{}}return this._normalizeAndValidateValue(definition,rawValue,fieldName,validatedObject,fieldName,object,options,settings)}_validateWithOperation(operationName,operation,object,options){this._assertSupportedOptions(options);const errors={};const workingObject={...object};const settings=this._buildOperationSettings(operationName,operation,object);for(const fieldName of Object.keys(object))if(!Object.hasOwn(this.structure,fieldName))setOwnProperty(errors,fieldName,{field:fieldName,code:`FIELD_NOT_ALLOWED`,message:`Field not allowed`,params:{}});for(const fieldName of settings.targetFieldNames){const fieldErrors=this._validateField(fieldName,object,workingObject,options,settings);this._mergeErrors(errors,fieldErrors)}if(settings.applyDefaults)for(const fieldName of Object.keys(this.structure)){if(settings.isFieldPresent(fieldName))continue;if(this.structure[fieldName].defaultTo!==void 0){const definition=this.structure[fieldName];const defaultValue=typeof definition.defaultTo===`function`?definition.defaultTo():definition.defaultTo;const defaultResult=this._normalizeDefault(definition,defaultValue,{fieldPath:fieldName,currentObject:workingObject,containerKey:fieldName,objectBeforeCast:object,options,settings});this._mergeErrors(errors,defaultResult.errors);if(Object.keys(defaultResult.errors).length>0)continue;setOwnProperty(workingObject,fieldName,defaultResult.value);settings.defaultedFields.add(fieldName)}}return{validatedObject:this._buildOperationResult(object,workingObject,settings),errors}}_validateSelectedTree(selectionTree,object,options,settings,basePath=``){const errors={};const validatedObject={};for(const fieldName of sortSelectionKeys(Object.keys(selectionTree))){const fieldPath=buildFieldPath(basePath,fieldName);if(!Object.hasOwn(this.structure,fieldName))throw new Error(`Unknown schema path "${fieldPath}".`);const fieldErrors=this._validateSelectedField(fieldName,selectionTree[fieldName],object,validatedObject,options,settings,fieldPath);this._mergeErrors(errors,fieldErrors)}return{validatedObject,errors}}_validateSelectedField(fieldName,selectionNode,object,validatedObject,options,settings,fieldPath){if(!Object.hasOwn(this.structure,fieldName))return{};const definition=this.structure[fieldName];const exactSelected=selectionNode.self===true;const hasChildren=hasSelectionChildren(selectionNode);if(this._fieldToBeSkipped(fieldPath,options))return{};const fieldPresent=Object.hasOwn(object,fieldName);const rawValue=object[fieldName];const errors={};if(!fieldPresent){if(exactSelected&&settings.enforceRequired&&definition.required&&!this._paramToBeSkipped(`required`,options.skipParams,fieldPath))this._mergeErrors(errors,this._singleErrorMap({field:fieldPath,code:`REQUIRED`,message:`Field is required`,params:{}}));if(exactSelected&&settings.applyDefaults&&definition.defaultTo!==void 0){const defaultValue=typeof definition.defaultTo===`function`?definition.defaultTo():definition.defaultTo;const defaultResult=this._normalizeDefault(definition,defaultValue,{fieldPath,currentObject:validatedObject,containerKey:fieldName,objectBeforeCast:object,options,settings});this._mergeErrors(errors,defaultResult.errors);if(Object.keys(defaultResult.errors).length===0)setOwnProperty(validatedObject,fieldName,defaultResult.value)}return errors}if(rawValue===void 0){if(exactSelected&&settings.rejectExplicitUndefined)return this._singleErrorMap(this._typeError(fieldPath).errorObject);return{}}const currentObject={[fieldName]:rawValue};if(exactSelected){const fieldErrors=this._normalizeAndValidateValue(definition,rawValue,fieldPath,currentObject,fieldName,object,options,settings);if(Object.hasOwn(currentObject,fieldName)&¤tObject[fieldName]!==void 0)setOwnProperty(validatedObject,fieldName,currentObject[fieldName]);else if(currentObject[fieldName]===null)setOwnProperty(validatedObject,fieldName,null);return fieldErrors}if(!hasChildren)return{};const castResult=this._castValue(definition,rawValue,fieldPath,currentObject,fieldName,object,options,settings);if(Object.keys(castResult.errors).length>0)return castResult.errors;if(!castResult.shouldContinue)return{};const nestedResult=this._validateSelectedDescendants(definition,selectionNode.children,fieldPath,currentObject,fieldName,options,settings);if(hasSelectedValue(currentObject[fieldName]))setOwnProperty(validatedObject,fieldName,currentObject[fieldName]);return nestedResult}_validateSelectedDescendants(definition,selectionTree,fieldPath,currentObject,containerKey,options,settings){if(definition.type===`object`){const objectMode=this._resolveObjectFieldMode(fieldPath,definition);if(objectMode.kind!==`nested`)throw new Error(`Schema path "${fieldPath}" does not support nested field selection.`);const nestedValue=currentObject[containerKey];if(!isPlainObject(nestedValue))return{};const nestedResult=objectMode.schema._validateSelectedTree(selectionTree,nestedValue,buildNestedOptions(options,fieldPath),{...settings,defaultedFields:new Set});setOwnProperty(currentObject,containerKey,nestedResult.validatedObject);return prefixErrorMap(nestedResult.errors,fieldPath)}if(definition.type===`array`){const itemsConfig=this._resolveArrayItemsConfig(fieldPath,definition);if(!itemsConfig)throw new Error(`Schema path "${fieldPath}" does not define array items for nested selection.`);return this._validateSelectedArrayItems(fieldPath,currentObject,containerKey,itemsConfig,selectionTree,options,settings)}throw new Error(`Schema path "${fieldPath}" does not support nested field selection.`)}_validateSelectedArrayItems(fieldPath,currentObject,containerKey,itemsConfig,selectionTree,options,settings){const normalizedItems=[];const sourceItems=currentObject[containerKey];const errors={};setOwnProperty(currentObject,containerKey,normalizedItems);for(const indexKey of sortSelectionKeys(Object.keys(selectionTree))){if(!/^[0-9]+$/.test(indexKey))throw new Error(`Schema path "${joinPath(fieldPath,indexKey)}" is invalid because array segments must use numeric indexes.`);const index=Number(indexKey);const itemPath=joinPath(fieldPath,index);const selectionNode=selectionTree[indexKey];const exactSelected=selectionNode.self===true;const hasChildren=hasSelectionChildren(selectionNode);if(this._fieldToBeSkipped(itemPath,options))continue;if(!Object.hasOwn(sourceItems,index)){if(exactSelected&&settings.rejectExplicitUndefined)setOwnProperty(errors,itemPath,this._typeError(itemPath).errorObject);continue}const rawValue=sourceItems[index];if(rawValue===void 0){if(exactSelected&&settings.rejectExplicitUndefined)setOwnProperty(errors,itemPath,this._typeError(itemPath).errorObject);continue}if(itemsConfig.kind===`schema`){if(exactSelected){const itemResult=itemsConfig.schema._validateWithOperation(`replace`,itemsConfig.schema.operations.replace,rawValue,buildNestedOptions(options,itemPath));if(hasSelectedValue(itemResult.validatedObject))setOwnProperty(normalizedItems,index,itemResult.validatedObject);this._mergeErrors(errors,prefixErrorMap(itemResult.errors,itemPath));continue}if(!hasChildren)continue;const itemResult=itemsConfig.schema._validateSelectedTree(selectionNode.children,rawValue,buildNestedOptions(options,itemPath),{...settings,operationName:`replace`,operation:itemsConfig.schema.operations.replace,defaultedFields:new Set});if(hasSelectedValue(itemResult.validatedObject))setOwnProperty(normalizedItems,index,itemResult.validatedObject);this._mergeErrors(errors,prefixErrorMap(itemResult.errors,itemPath));continue}const itemSettings=this._buildArrayItemSettings(itemsConfig.definition,settings);const itemHolder=[rawValue];if(exactSelected){const itemErrors=this._normalizeAndValidateValue(itemsConfig.definition,rawValue,itemPath,itemHolder,0,sourceItems,options,itemSettings);if(Object.hasOwn(itemHolder,0)&&itemHolder[0]!==void 0)setOwnProperty(normalizedItems,index,itemHolder[0]);else if(itemHolder[0]===null)setOwnProperty(normalizedItems,index,null);this._mergeErrors(errors,itemErrors);continue}if(!hasChildren)continue;const castResult=this._castValue(itemsConfig.definition,rawValue,itemPath,itemHolder,0,sourceItems,options,itemSettings);if(Object.keys(castResult.errors).length>0){this._mergeErrors(errors,castResult.errors);continue}if(!castResult.shouldContinue)continue;const itemErrors=this._validateSelectedDescendants(itemsConfig.definition,selectionNode.children,itemPath,itemHolder,0,options,itemSettings);if(hasSelectedValue(itemHolder[0]))setOwnProperty(normalizedItems,index,itemHolder[0]);this._mergeErrors(errors,itemErrors)}return errors}validateWith(operationName,object,options={}){if(!Object.hasOwn(this.operations,operationName))throw new Error(`Unknown operation "${operationName}".`);const operation=this.operations[operationName];this._assertPlainObjectInput(operationName,object);return this._validateWithOperation(operationName,operation,object,options)}validateAt(path,object,options={}){this._assertPlainObjectInput(`validateAt`,object);const pathSegments=buildPathSegments(path);const{operationName,operation,validationOptions}=this._resolvePathValidationRequest(options);const result=this._validateSelectedTree(buildSelectionTree([path]),object,validationOptions,this._buildOperationSettings(operationName,operation,object));return{validatedValue:getValueAtPath(result.validatedObject,pathSegments),errors:result.errors}}validatePaths(paths,object,options={}){this._assertPlainObjectInput(`validatePaths`,object);if(!Array.isArray(paths)||paths.length===0)throw new Error(`validatePaths() expects a non-empty array of schema paths.`);const{operationName,operation,validationOptions}=this._resolvePathValidationRequest(options);return this._validateSelectedTree(buildSelectionTree(paths),object,validationOptions,this._buildOperationSettings(operationName,operation,object))}_installOperationMethods(){for(const operationName of Object.keys(this.operations)){if(operationName in this)throw new Error(`Operation name "${operationName}" is reserved and cannot be used as a schema method.`);this[operationName]=(object,options={})=>this.validateWith(operationName,object,options)}}toJsonSchema(options={}){return buildJsonSchema(this,options)}getFieldDefinitions(){return createIntrospectionSnapshot(this.structure)}getFieldDefinition(path){if(typeof path!==`string`||path.trim()===``)throw new Error(`Field path must be a non-empty string.`);const definition=resolveDefinitionFromSchemaPath(this,buildPathSegments(path.trim()));return definition===null?null:createIntrospectionSnapshot(definition)}getFieldMessages(path){const definition=this.getFieldDefinition(path);if(!definition||typeof definition.messages!==`object`||definition.messages===null)return Object.freeze({});return createIntrospectionSnapshot(definition.messages)}cleanup(object,parameterName){const newObject={};for(const k of Object.keys(object))if(Object.hasOwn(this.structure,k)&&this.structure[k][parameterName])setOwnProperty(newObject,k,object[k]);return newObject}};var{parse:$parse,stringify:$stringify}=JSON;var{keys}=Object;var Primitive=String;var primitive=`string`;var object=`object`;var noop=(_,value)=>value;var set=(known,input,value)=>{const index=Primitive(input.push(value)-1);known.set(value,index);return index};var stringify=(value,replacer,space)=>{const $=replacer&&typeof replacer===object?(k,v)=>k===``||-1<replacer.indexOf(k)?v:void 0:replacer||noop;const known=new Map;const input=[];const output=[];let i=+set(known,input,$.call({"":value},``,value));let firstRun=!i;while(i<input.length){firstRun=true;output[i]=$stringify(input[i++],replace,space)}return`[`+output.join(`,`)+`]`;function replace(key,value){if(firstRun){firstRun=!firstRun;return value}const after=$.call(this,key,value);switch(typeof after){case object:if(after===null)return after;case primitive:return known.get(after)||set(known,input,after)}return after}};var DEFAULT_BOOLEAN_TRUE_VALUES=new Set([`true`,`1`,`yes`,`y`,`on`]);var DEFAULT_BOOLEAN_FALSE_VALUES=new Set([`false`,`0`,`no`,`n`,`off`]);function isThenable(value){return value!==null&&(typeof value===`object`||typeof value===`function`)&&typeof value.then===`function`}function normalizeFiniteNumberInput(value){if(typeof value===`number`)return Number.isFinite(value)?value:null;if(typeof value===`bigint`){const numberValue=Number(value);return Number.isSafeInteger(numberValue)?numberValue:null}if(typeof value===`string`){const trimmed=value.trim();if(trimmed===``)return null;const numberValue=Number(trimmed);return Number.isFinite(numberValue)?numberValue:null}return null}function deepEqual(left,right){if(Object.is(left,right))return true;if(left instanceof Date&&right instanceof Date)return left.getTime()===right.getTime();if(left instanceof RegExp&&right instanceof RegExp)return left.source===right.source&&left.flags===right.flags;if(Array.isArray(left)||Array.isArray(right)){if(!Array.isArray(left)||!Array.isArray(right))return false;if(left.length!==right.length)return false;for(let index=0;index<left.length;index++)if(!deepEqual(left[index],right[index]))return false;return true}if(left===null||right===null||typeof left!==`object`||typeof right!==`object`)return false;if(Object.getPrototypeOf(left)!==Object.getPrototypeOf(right))return false;const leftKeys=Object.keys(left);const rightKeys=Object.keys(right);if(leftKeys.length!==rightKeys.length)return false;for(const key of leftKeys){if(!Object.hasOwn(right,key))return false;if(!deepEqual(left[key],right[key]))return false}return true}var CorePlugin={install(api){const{addType,addValidator}=api;addType(`none`,context=>context.value);addType(`file`,context=>{const val=context.value;if(val===void 0||val===null)context.throwTypeError();const valType=typeof val;if(valType===`string`||valType===`number`||valType===`boolean`){const s=val.toString();return context.definition.noTrim?s:s.trim()}context.throwTypeError()});addType(`string`,context=>{const val=context.value;if(val===void 0||val===null)return``;const valType=typeof val;if(valType===`string`||valType===`number`||valType===`boolean`){const s=val.toString();return context.definition.noTrim?s:s.trim()}context.throwTypeError()});addType(`blob`,context=>context.value);addType(`number`,context=>{const numberValue=normalizeFiniteNumberInput(context.value);if(numberValue===null)context.throwTypeError();return numberValue});addType(`integer`,context=>{const numberValue=normalizeFiniteNumberInput(context.value);if(numberValue===null||!Number.isInteger(numberValue))context.throwTypeError();return numberValue});addType(`epochMilliseconds`,context=>{const epochMilliseconds=castEpochInteger(context.value,EPOCH_MILLISECONDS_LIMIT);if(epochMilliseconds===null)context.throwTypeError();return epochMilliseconds});addType(`epochSeconds`,context=>{const epochSeconds=castEpochInteger(context.value,EPOCH_SECONDS_LIMIT);if(epochSeconds===null)context.throwTypeError();return epochSeconds});addType(`dateTime`,context=>{const temporalPrecision=resolveTemporalPrecision(context.definition,context.fieldName);if(!isValidDateTime(context.value,temporalPrecision))context.throwTypeError();return context.value});addType(`date`,context=>{if(!isValidDate(context.value))context.throwTypeError();return context.value});addType(`time`,context=>{const temporalPrecision=resolveTemporalPrecision(context.definition,context.fieldName);if(!isValidTime(context.value,temporalPrecision))context.throwTypeError();return context.value});addType(`array`,context=>{if(context.definition.type===`array`&&!Array.isArray(context.value))return[context.value];return context.value});addType(`object`,context=>{if(!isPlainObject(context.value))context.throwTypeError();return context.value});addType(`serialize`,context=>{try{return JSON.stringify(context.value)}catch(e){try{return stringify(context.value)}catch(e2){context.throwTypeError()}}});addType(`boolean`,context=>{if(typeof context.value===`boolean`)return context.value;if(typeof context.value===`number`){if(context.value===1)return true;if(context.value===0)return false;context.throwTypeError()}if(typeof context.value===`bigint`){if(context.value===1n)return true;if(context.value===0n)return false;context.throwTypeError()}if(typeof context.value===`string`){const falseVal=String(context.definition.stringFalseWhen||`false`).trim().toLowerCase();const trueVal=String(context.definition.stringTrueWhen||`true`).trim().toLowerCase();const lowerValue=context.value.trim().toLowerCase();const falseValues=new Set([...DEFAULT_BOOLEAN_FALSE_VALUES,falseVal]);const trueValues=new Set([...DEFAULT_BOOLEAN_TRUE_VALUES,trueVal]);if(falseValues.has(lowerValue))return false;if(trueValues.has(lowerValue))return true}context.throwTypeError()});addType(`id`,context=>{if(typeof context.value===`number`){if(Number.isSafeInteger(context.value)&&context.value>0)return context.value;context.throwTypeError()}if(typeof context.value===`bigint`){if(context.value>0n&&context.value<=BigInt(Number.MAX_SAFE_INTEGER))return Number(context.value);context.throwTypeError()}if(typeof context.value===`string`){const trimmed=context.value.trim();if(!/^[1-9][0-9]*$/.test(trimmed))context.throwTypeError();const numberValue=Number(trimmed);if(!Number.isSafeInteger(numberValue))context.throwTypeError();return numberValue}context.throwTypeError()});addValidator(`minLength`,context=>{if(context.value===void 0)return;if(context.definition.type===`string`&&context.value.toString&&context.value.toString().length<context.parameterValue)context.throwParamError(`MIN_LENGTH`,`Length must be at least ${context.parameterValue} characters.`,{min:context.parameterValue,actual:context.value.toString().length})});addValidator(`min`,context=>{if(context.value===void 0)return;if(isNumericDefinition(context.definition)&&typeof context.value===`number`&&context.value<context.parameterValue)context.throwParamError(`MIN_VALUE`,`Value must be at least ${context.parameterValue}.`,{min:context.parameterValue,actual:context.value})});addValidator(`maxLength`,context=>{if(context.value===void 0)return;if(context.definition.type===`string`&&context.value.toString&&context.value.toString().length>context.parameterValue)context.throwParamError(`MAX_LENGTH`,`Length must be no more than ${context.parameterValue} characters.`,{max:context.parameterValue,actual:context.value.toString().length})});addValidator(`max`,context=>{if(context.value===void 0)return;if(isNumericDefinition(context.definition)&&typeof context.value===`number`&&context.value>context.parameterValue)context.throwParamError(`MAX_VALUE`,`Value must be no more than ${context.parameterValue}.`,{max:context.parameterValue,actual:context.value})});addValidator(`enum`,context=>{if(!Array.isArray(context.parameterValue))throw new Error(`Enum for ${context.fieldName} must be an array.`);if(!context.parameterValue.some(allowedValue=>deepEqual(allowedValue,context.value)))context.throwParamError(`ENUM_VALUE`,`Value must match one of the allowed enum values.`,{allowed:context.parameterValue})});addValidator(`pattern`,context=>{if(context.value===void 0)return;if(context.definition.type!==`string`||typeof context.value!==`string`)return;const patternValue=context.parameterValue;const matcher=patternValue instanceof RegExp?new RegExp(patternValue.source,patternValue.flags):typeof patternValue===`string`?new RegExp(patternValue):null;if(!matcher)throw new Error(`Pattern for ${context.fieldName} must be a string or RegExp.`);if(!matcher.test(context.value))context.throwParamError(`PATTERN`,`Value does not match the required pattern.`,{pattern:matcher.source})});addValidator(`strictBoolean`,context=>{if(!context.parameterValue)return;if(context.definition.type!==`boolean`)throw new Error(`strictBoolean can only be used on boolean fields (${context.fieldName}).`);if(typeof context.valueBeforeCast!==`boolean`)context.throwParamError(`STRICT_BOOLEAN`,`Value must be a boolean.`)});addValidator(`validator`,context=>{if(typeof context.parameterValue!==`function`)throw new Error(`Validator for ${context.fieldName} must be a function.`);const r=context.parameterValue(context.value,context.object,context);if(isThenable(r))throw new Error(`Custom validator for "${context.fieldName}" must be synchronous.`);if(typeof r===`string`)context.throwParamError(`CUSTOM_VALIDATOR_FAILED`,r)});addValidator(`uppercase`,context=>{if(typeof context.value===`string`)return context.value.toUpperCase()});addValidator(`lowercase`,context=>{if(typeof context.value===`string`)return context.value.toLowerCase()});addValidator(`length`,context=>{if(typeof context.value===`string`)return context.value.substr(0,context.parameterValue);else if(Number.isInteger(Number(context.valueBeforeCast))&&String(context.valueBeforeCast).length>context.parameterValue)context.throwParamError(`RANGE_EXCEEDED`,`Numeric value is out of the allowed character range.`,{max:context.parameterValue,actual:String(context.valueBeforeCast).length})});addValidator(`notEmpty`,context=>{if(context.parameterValue&&typeof context.value===`string`&&context.value===``)context.throwParamError(`NOT_EMPTY`,`Field cannot be empty.`)});addValidator(`required`,()=>{});addValidator(`unsigned`,()=>{});addValidator(`precision`,()=>{});addValidator(`scale`,()=>{});addValidator(`temporalPrecision`,context=>{if(context.definition.type!==`time`&&context.definition.type!==`dateTime`)throw new Error(`temporalPrecision can only be used on time or dateTime fields (${context.fieldName}).`)});addValidator(`nullable`,()=>{});addValidator(`nullOnEmpty`,()=>{});addValidator(`defaultTo`,()=>{})}};var factoryTypesBySource=new WeakMap;var factoryValidatorsBySource=new WeakMap;var registryMetadataSymbol=Symbol.for(`json-rest-schema.registry-metadata`);function registerTypeHandler(types,name,handler){if(typeof handler!==`function`)throw new Error(`Type handler for '${name}' must be a function.`);setOwnProperty(types,name,handler)}function registerValidatorHandler(validators,name,handler){if(typeof handler!==`function`)throw new Error(`Validator handler for '${name}' must be a function.`);setOwnProperty(validators,name,handler)}function createHandlerRegistry(source={}){const registry=Object.create(null);for(const[name,handler]of Object.entries(source))setOwnProperty(registry,name,handler);return registry}function installPlugin(plugin,api){if(typeof plugin.install!==`function`)throw new Error(`Plugin must have an install method.`);plugin.install(api)}function attachRegistryMetadata(target,types,validators){factoryTypesBySource.set(target,types);factoryValidatorsBySource.set(target,validators);Object.defineProperty(target,registryMetadataSymbol,{value:Object.freeze({getTypes:()=>types,getValidators:()=>validators}),enumerable:false,configurable:false,writable:false})}function extractRegistryMetadata(source){if(!source||typeof source!==`object`&&typeof source!==`function`)return null;const types=factoryTypesBySource.get(source);const validators=factoryValidatorsBySource.get(source);if(types&&validators)return{types,validators};const symbolMetadata=source[registryMetadataSymbol];if(symbolMetadata&&typeof symbolMetadata.getTypes===`function`&&typeof symbolMetadata.getValidators===`function`)return{types:symbolMetadata.getTypes(),validators:symbolMetadata.getValidators()};if(typeof source===`object`&&source.types&&typeof source.types===`object`&&source.validators&&typeof source.validators===`object`&&typeof source.create===`function`&&typeof source.replace===`function`&&typeof source.patch===`function`&&typeof source.toJsonSchema===`function`)return{types:source.types,validators:source.validators};return null}function normalizeFactorySources(sources){if(sources.length===1&&Array.isArray(sources[0]))return sources[0];return sources}function areEquivalentHandlers(left,right){return left===right}function mergeRegistryHandlers(target,source,kind){for(const[name,handler]of Object.entries(source)){if(Object.hasOwn(target,name)&&!areEquivalentHandlers(target[name],handler))throw new Error(`Cannot merge schema factories with conflicting ${kind} "${name}".`);setOwnProperty(target,name,handler)}}function resolveMergedRegistries(fallbackTypes,fallbackValidators,sources){const normalizedSources=normalizeFactorySources(sources).filter(Boolean);if(normalizedSources.length<1)return{types:createHandlerRegistry(fallbackTypes),validators:createHandlerRegistry(fallbackValidators)};const mergedTypes=Object.create(null);const mergedValidators=Object.create(null);for(const source of normalizedSources){const metadata=extractRegistryMetadata(source);if(!metadata)throw new Error(`Factory sources must be schema instances or schema factories created by json-rest-schema.`);mergeRegistryHandlers(mergedTypes,metadata.types,`type`);mergeRegistryHandlers(mergedValidators,metadata.validators,`validator`)}return{types:mergedTypes,validators:mergedValidators}}function createSchemaFactory({types={},validators={},installCore=true}={}){const factoryTypes=createHandlerRegistry(types);const factoryValidators=createHandlerRegistry(validators);const factory=(structure,options={})=>{const schema=new Schema(structure,factoryTypes,factoryValidators,options.operations);attachRegistryMetadata(schema,factoryTypes,factoryValidators);return schema};attachRegistryMetadata(factory,factoryTypes,factoryValidators);factory.addType=(name,handler)=>{registerTypeHandler(factoryTypes,name,handler)};factory.addValidator=(name,handler)=>{registerValidatorHandler(factoryValidators,name,handler)};factory.use=plugin=>{installPlugin(plugin,{addType:factory.addType,addValidator:factory.addValidator})};factory.createFactory=(...sources)=>{const mergedRegistries=resolveMergedRegistries(factoryTypes,factoryValidators,sources);return createSchemaFactory({types:mergedRegistries.types,validators:mergedRegistries.validators,installCore:false})};if(installCore)factory.use(CorePlugin);return factory}var createSchema=createSchemaFactory({installCore:true});var JSON_REST_SCHEMA_MODES=new Set([`create`,`replace`,`patch`]);var JSON_REST_SCHEMA_ERRORS=Object.freeze({REQUIRED:{messageKey:`required`,code:`kernel.validation.field.required`},TYPE_CAST_FAILED:{messageKey:`default`,code:`kernel.validation.field.typeCastFailed`},NOT_NULLABLE:{messageKey:`default`,code:`kernel.validation.field.notNullable`},MIN_LENGTH:{messageKey:`minLength`,code:`kernel.validation.field.minLength`},MAX_LENGTH:{messageKey:`maxLength`,code:`kernel.validation.field.maxLength`},MIN_ITEMS:{messageKey:`minItems`,code:`kernel.validation.field.minItems`},MAX_ITEMS:{messageKey:`maxItems`,code:`kernel.validation.field.maxItems`},MIN_VALUE:{messageKey:`min`,code:`kernel.validation.field.minValue`},MAX_VALUE:{messageKey:`max`,code:`kernel.validation.field.maxValue`},PATTERN:{messageKey:`pattern`,code:`kernel.validation.field.pattern`},ENUM_VALUE:{messageKey:`enum`,code:`kernel.validation.field.enumValue`},FIELD_NOT_ALLOWED:{messageKey:`additionalProperties`,code:`kernel.validation.field.notAllowed`},CUSTOM_VALIDATOR_FAILED:{messageKey:`validator`,code:``},STRICT_BOOLEAN:{messageKey:`default`,code:`kernel.validation.field.strictBoolean`},RANGE_EXCEEDED:{messageKey:`default`,code:`kernel.validation.field.rangeExceeded`},NOT_EMPTY:{messageKey:`default`,code:`kernel.validation.field.notEmpty`}});var INVALID_VALUE=Object.freeze({code:`kernel.validation.invalid`,message:`Invalid value.`});var JSON_REST_SCHEMA_METHODS=Object.freeze([`create`,`replace`,`patch`,`toJsonSchema`]);function isJsonRestSchemaInstance(value){return Boolean(value)&&typeof value===`object`&&JSON_REST_SCHEMA_METHODS.every(name=>typeof value[name]===`function`)}function resolveSchemaDefinitionMode(schemaDefinition=null,{defaultMode=`create`,context=`schema definition.mode`}={}){const source=normalizeObject(schemaDefinition);const fallbackMode=normalizeText(defaultMode).toLowerCase()||`create`;const rawMode=Object.prototype.hasOwnProperty.call(source,`mode`)?normalizeText(source.mode).toLowerCase():``;if(!rawMode)return fallbackMode;if(!JSON_REST_SCHEMA_MODES.has(rawMode))throw new TypeError(`${context} must be one of: create, replace, patch.`);return rawMode}function resolveJsonRestSchemaFieldMessages(schemaDefinition=null,fieldName=``){const normalizedFieldName=normalizeText(fieldName);if(!normalizedFieldName)return{};const source=normalizeObject(schemaDefinition);if(!isJsonRestSchemaInstance(source.schema))return{};return normalizeObject(source.schema.getFieldMessages(normalizedFieldName))}function resolveJsonRestSchemaParentFieldMessages(schemaDefinition=null,fieldName=``){const segments=normalizeText(fieldName).split(`.`).filter(Boolean);if(segments.length<2)return{};segments.pop();return resolveJsonRestSchemaFieldMessages(schemaDefinition,segments.join(`.`))}function resolveFieldMessageOverride(messages,key){const value=key?messages[key]:void 0;if(typeof value===`string`){const message=normalizeText(value);return message?{message}:null}if(!isRecord(value))return null;const message=normalizeText(value.message);if(!message)return null;const code=normalizeText(value.code);return code?{message,code,params:normalizeObject(value.params)}:{message}}function resolveJsonRestSchemaFieldError(fieldName,entry,schemaDefinition=null){const errorCode=normalizeText(entry?.code).toUpperCase();const known=JSON_REST_SCHEMA_ERRORS[errorCode]||{};const issueParams=normalizeObject(entry?.params);const directMessages=resolveJsonRestSchemaFieldMessages(schemaDefinition,fieldName);const messages=errorCode===`FIELD_NOT_ALLOWED`&&Object.keys(directMessages).length<1?resolveJsonRestSchemaParentFieldMessages(schemaDefinition,fieldName):directMessages;const override=resolveFieldMessageOverride(messages,known.messageKey)||resolveFieldMessageOverride(messages,`default`);if(override)return override.code?{message:override.message,code:override.code,params:{...issueParams,...override.params}}:{message:override.message};const libraryMessage=normalizeText(entry?.message);if(libraryMessage)return known.code?{message:libraryMessage,code:known.code,params:issueParams}:{message:libraryMessage};const rawCode=normalizeText(entry?.code);return rawCode?{message:rawCode}:{...INVALID_VALUE,params:{}}}function normalizeJsonRestSchemaFieldErrors(errors={},schemaDefinition=null){const source=normalizeObject(errors);const fieldErrors={};const fieldErrorCodes={};for(const[fieldName,entry]of Object.entries(source)){const normalizedFieldName=normalizeText(fieldName);if(!normalizedFieldName)continue;if(typeof entry===`string`){fieldErrors[normalizedFieldName]=entry;continue}const{message,code,params}=resolveJsonRestSchemaFieldError(normalizedFieldName,entry,schemaDefinition);fieldErrors[normalizedFieldName]=message;if(code)fieldErrorCodes[normalizedFieldName]={code,params}}return{fieldErrors,fieldErrorCodes}}function isSchemaDefinitionObject(value){return Boolean(value)&&typeof value===`object`&&!Array.isArray(value)&&(Object.prototype.hasOwnProperty.call(value,`schema`)||Object.prototype.hasOwnProperty.call(value,`mode`))}function normalizeSingleSchemaDefinition(value,{context=`schema definition`,defaultMode=``}={}){if(value==null)return null;if(!isSchemaDefinitionObject(value))throw new TypeError(`${context} must be a schema definition object.`);const source=normalizeObject(value);if(!Object.prototype.hasOwnProperty.call(source,`schema`))throw new TypeError(`${context}.schema is required.`);if(!isJsonRestSchemaInstance(source.schema))throw new TypeError(`${context}.schema must be a json-rest-schema schema instance.`);const normalized={schema:source.schema};const resolvedDefaultMode=normalizeText(defaultMode).toLowerCase();normalized.mode=resolveSchemaDefinitionMode(source,{defaultMode:resolvedDefaultMode||`patch`,context:`${context}.mode`});return Object.freeze(normalized)}function executeJsonRestSchemaDefinition(value,payload,{context=`schema definition`,defaultMode=``}={}){const normalized=normalizeSingleSchemaDefinition(value,{context,defaultMode});if(!normalized)return null;return normalized.schema[normalized.mode](payload)}function createCursorListValidator(itemValidator){const itemDefinition=normalizeSingleSchemaDefinition(itemValidator,{context:`cursor list item`,defaultMode:`replace`});return deepFreeze({schema:createSchema({items:{type:`array`,required:true,items:itemDefinition.schema},nextCursor:{type:`string`,required:false,nullable:true,minLength:1}}),mode:`replace`})}var cursorPaginationQuerySchema=createSchema({cursor:{type:`id`,required:false},limit:{type:`number`,required:false,min:1,unsigned:true}});var cursorPaginationQueryValidator=Object.freeze({schema:cursorPaginationQuerySchema,mode:`patch`});var HTML_TIME_STRING_SCHEMA=Object.freeze({type:`string`,pattern:`^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$`,minLength:5});var NULLABLE_HTML_TIME_STRING_SCHEMA=Object.freeze({...HTML_TIME_STRING_SCHEMA,nullable:true});var SCHEMA_VALIDATION_FAILED_MESSAGE=`Schema validation failed.`;function buildSchemaValidationError({message=SCHEMA_VALIDATION_FAILED_MESSAGE,fieldErrors=null,fieldErrorCodes=null,errors=null,cause,statusCode=null}={}){const error=new Error(message,cause?{cause}:void 0);if(message===SCHEMA_VALIDATION_FAILED_MESSAGE){error.messageCode=`kernel.validation.schemaFailed`;error.messageParams={}}if(Number.isInteger(statusCode)&&statusCode>=400&&statusCode<=599)error.statusCode=statusCode;if(isRecord(fieldErrors)){const codes=isRecord(fieldErrorCodes)&&Object.keys(fieldErrorCodes).length>0?fieldErrorCodes:null;error.fieldErrors=fieldErrors;if(codes)error.fieldErrorCodes=codes;error.details={...error.details||{},fieldErrors,...codes?{fieldErrorCodes:codes}:{}}}else if(errors!==null&&errors!==void 0)error.details={...error.details||{},errors};return error}function validateSchemaPayload(schemaDefinition,payload,{phase=`input`,context=`schema definition`,statusCode=null}={}){if(schemaDefinition==null)return payload;const result=executeJsonRestSchemaDefinition(schemaDefinition,payload,{defaultMode:phase===`output`?`replace`:`patch`,context});const{fieldErrors,fieldErrorCodes}=normalizeJsonRestSchemaFieldErrors(result.errors,schemaDefinition);if(Object.keys(fieldErrors).length>0)throw buildSchemaValidationError({fieldErrors,fieldErrorCodes,statusCode});return result.validatedObject??payload}var VALIDATION_ISSUE_CODES=new Map([{keyword:`required`,code:`kernel.validation.required`},{keyword:`type`,code:`kernel.validation.type`},{keyword:`minLength`,code:`kernel.validation.minLength`},{keyword:`maxLength`,code:`kernel.validation.maxLength`},{keyword:`minimum`,code:`kernel.validation.minimum`},{keyword:`maximum`,code:`kernel.validation.maximum`},{keyword:`exclusiveMinimum`,code:`kernel.validation.exclusiveMinimum`},{keyword:`exclusiveMaximum`,code:`kernel.validation.exclusiveMaximum`},{keyword:`multipleOf`,code:`kernel.validation.multipleOf`},{keyword:`pattern`,code:`kernel.validation.pattern`},{keyword:`format`,code:`kernel.validation.format`},{keyword:`enum`,code:`kernel.validation.enum`},{keyword:`const`,code:`kernel.validation.const`},{keyword:`minItems`,code:`kernel.validation.minItems`},{keyword:`maxItems`,code:`kernel.validation.maxItems`},{keyword:`additionalItems`,code:`kernel.validation.additionalItems`},{keyword:`uniqueItems`,code:`kernel.validation.uniqueItems`},{keyword:`minProperties`,code:`kernel.validation.minProperties`},{keyword:`maxProperties`,code:`kernel.validation.maxProperties`},{keyword:`additionalProperties`,code:`kernel.validation.additionalProperties`},{keyword:`propertyNames`,code:`kernel.validation.propertyNames`},{keyword:`oneOf`,code:`kernel.validation.oneOf`},{keyword:`anyOf`,code:`kernel.validation.anyOf`},{keyword:`not`,code:`kernel.validation.not`},{keyword:`if`,code:`kernel.validation.if`}].map(({keyword,code})=>[keyword,code]));var RECORD_ID_PATTERN=`^[1-9][0-9]*$`;var recordIdSchema=deepFreeze({type:`string`,minLength:1,pattern:RECORD_ID_PATTERN});var nullableRecordIdSchema=deepFreeze({...recordIdSchema,nullable:true});var recordIdParamsValidator=deepFreeze({schema:createSchema({recordId:{...recordIdSchema,required:true,messages:{pattern:{code:`kernel.validation.recordIdInvalid`,message:`Record id must be a canonical positive integer string.`}}}}),mode:`patch`});export{isJsonRestSchemaInstance as a,normalizeSingleSchemaDefinition as i,validateSchemaPayload as n,createSchema as o,createCursorListValidator as r,normalizeObjectInput as s,RECORD_ID_PATTERN as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var GITHUB_BODY_MAX_LENGTH=65536;function githubProjectRepositoryName(project){return project?.githubRepository?.fullName||project?.repository?.github?.fullName||``}function githubProjectAvailable(project){return Boolean(githubProjectRepositoryName(project))&&project?.repositoryMode!==`managed_git`}function githubIssuesSiblingPath(issuesPath,name){return issuesPath.replace(/\/issues$/u,`/${name}`)}function githubIssueLabelsPath(issuesPath){return githubIssuesSiblingPath(issuesPath,`issue-labels`)}function githubIssueMentionsPath(issuesPath){return githubIssuesSiblingPath(issuesPath,`issue-mentions`)}function invalidateGithubIssueQueries(queryClient,basePath,issuePath){return Promise.all([queryClient.invalidateQueries({queryKey:[`vibe64.issue`,issuePath]}),queryClient.invalidateQueries({queryKey:[`vibe64.issues`,basePath]}),queryClient.invalidateQueries({queryKey:[`vibe64.issueMentions`,githubIssueMentionsPath(basePath)]})])}function invalidateGithubProjectQueries(queryClient,issuesPath){const labelsPath=githubIssueLabelsPath(issuesPath);const mentionsPath=githubIssueMentionsPath(issuesPath);const prsPath=githubIssuesSiblingPath(issuesPath,`pull-requests`);return queryClient.invalidateQueries({predicate:({queryKey})=>{if(!Array.isArray(queryKey))return false;const[resource,path]=queryKey;return resource===`vibe64.issues`&&path===issuesPath||resource===`vibe64.issue`&&path?.startsWith(`${issuesPath}/`)||resource===`vibe64.issueLabels`&&path===labelsPath||resource===`vibe64.issueMentions`&&path===mentionsPath||[`vibe64.pullRequests`,`vibe64.pullRequest`].includes(resource)&&path===prsPath}})}export{githubProjectRepositoryName as a,githubProjectAvailable as i,githubIssueLabelsPath as n,invalidateGithubIssueQueries as o,githubIssueMentionsPath as r,invalidateGithubProjectQueries as s,GITHUB_BODY_MAX_LENGTH as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as useId,Et as unref,G as renderList,H as openBlock,K as renderSlot,Kt as normalizeClass,N as nextTick,O as inject,Tt as toValue,Xt as toDisplayString,_ as createSlots,b as createVNode,d as createBaseVNode,f as createBlock,gt as reactive,i as Fragment,it as watch,m as createElementBlock,mt as onScopeDispose,ot as withCtx,p as createCommentVNode,st as withDirectives,u as computed,vt as ref,xt as shallowRef,y as createTextVNode}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{S as VIcon,cr as vShow,lr as withKeys,mt as useDisplay,ur as withModifiers}from"./VChip-D2IukBZw.js";import{s as normalizeObject}from"./normalize-BD25VwNK.js";import{r as VProgressCircular,t as VBtn}from"./VBtn-2vbH580C.js";import{t as VDialog}from"./VDialog-B2W9wqR8.js";import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper-DNW4j-dv.js";import{r as useRealtimeEvent}from"./useRealtimeEvent-B4oRg9Dt.js";var VIBE64_AI_TASKS_KEY=Symbol(`vibe64.ai-tasks`);var AI_TASK_PHASES=Object.freeze({STARTING:`starting`,WORKING:`working`,CHECKING:`checking`,NEEDS_YOU:`needs_you`,CANCELLING:`cancelling`,DONE:`done`,NOT_DONE:`not_done`});var AI_TASK_REASONS=Object.freeze({AI_STUCK:`ai_stuck`,AI_UNAVAILABLE:`ai_unavailable`,ARCHIVED:`archived`,CANCELLED:`cancelled`,CHECK_STUCK:`check_stuck`,DRAFT_WAITING:`draft_waiting`,INTERRUPTED:`interrupted`,NO_RESULT:`no_result`,QUESTION:`question`,STOPPED:`stopped`,TURN_FAILED:`turn_failed`,UNCONFIRMED:`unconfirmed`,YOUR_TURN:`your_turn`});var AI_TASK_CHECKERS=Object.freeze({AGENT:`agent`,PERSON:`person`,VIBE64:`vibe64`});var AI_TASK_ACTIVE_PHASES=Object.freeze([AI_TASK_PHASES.STARTING,AI_TASK_PHASES.WORKING,AI_TASK_PHASES.CHECKING,AI_TASK_PHASES.CANCELLING]);var AI_TASK_ENDED_PHASES=Object.freeze([AI_TASK_PHASES.DONE,AI_TASK_PHASES.NOT_DONE]);function aiTaskEnded(task){return AI_TASK_ENDED_PHASES.includes(task.phase)}var AI_TASK_MESSAGES=Object.freeze({actions:Object.freeze({aiSetup:`Open AI setup`,answer:`Answer`,back:`Back`,cancel:`Cancel`,cancelling:`Cancelling…`,checkNow:`Check now`,close:`Close`,closing:`Closing…`,continue:`Continue`,details:`Details`,endNotDone:`End as not done`,finish:`Finish`,hide:`Hide`,keepGoing:`Keep going`,openChat:`Open chat`,review:`Review resolved conflicts`}),button:Object.freeze({busy:`Being fixed…`,fix:`Fix it with AI`,opening:`Opening…`,result:`See result`}),chat:Object.freeze({answer:`Type your answer…`,message:`Message the AI…`}),outcome:Object.freeze({done:`Done`,notDone:`Not done`,problem:`The problem`,seeConversation:`See the conversation`,showResult:`Show the result`,whatHappened:`What happened`,whatTheAiDid:`What the AI did`,whatsNext:`What's next`}),progress:Object.freeze({activity:`Activity`,unavailable:`Nothing is lost. The fix continues from here.`}),status:Object.freeze({aiStuck:`The AI could not finish this`,aiUnavailable:`The AI account can't run this right now`,cancelling:`Cancelling…`,draftWaiting:`The check failed. Your unsent message is waiting.`,interrupted:`Vibe64 restarted while the AI was working`,noResult:`The AI stopped without saying it finished`,question:`The AI needs your answer`,starting:`Starting…`,stopped:`Stopped. Tell the AI what to do next.`,turnFailed:`The AI ran into an error`,unconfirmed:`Vibe64 couldn't confirm the result`,working:`The AI is working on this`,yourTurn:`Your turn`}),tray:Object.freeze({cancelling:`Cancelling…`,done:`Done`,needsYou:`Needs you`,notDone:`Not done`,yourTurn:`Your turn`}),views:Object.freeze({chat:`Chat`,label:`Task views`,progress:`Progress`,waiting:`The AI is waiting for your answer`}),closeFailed:`That didn't finish. Try again.`,requestFailed:`That didn't reach Vibe64. Try again.`,attempt:(attempt,limit)=>`Attempt ${attempt} of ${limit}`,retrying:(attempt,limit)=>`The AI is trying again (attempt ${attempt} of ${limit})`,cancelQuestion:noun=>`Cancel this ${noun}? The AI stops. Anything it has changed stays in the session.`,cancelConfirm:noun=>`Cancel ${noun}`,cancelledByYou:noun=>`You cancelled this ${noun}.`,cancelledBy:(name,noun)=>`${name} cancelled this ${noun}.`,whatsNext:()=>`The problem is still there. Anything the AI changed stays in the session. To try again, close this and choose Fix it with AI.`,toast:(title,outcome)=>`${title}: ${outcome}.`});var AI_TASK_ACTIONS=Object.freeze({AI_SETUP:`ai-setup`,ANSWER:`answer`,CHECK:`check`,CONTINUE:`continue`,END:`end`,FINISH:`finish`,OPEN_CHAT:`open-chat`,REVIEW:`review`});var action=(id,label,primary=false)=>Object.freeze({id,label,primary});var OPEN_CHAT=action(AI_TASK_ACTIONS.OPEN_CHAT,AI_TASK_MESSAGES.actions.openChat);var CHECK_NOW=action(AI_TASK_ACTIONS.CHECK,AI_TASK_MESSAGES.actions.checkNow,true);var CONTINUE=action(AI_TASK_ACTIONS.CONTINUE,AI_TASK_MESSAGES.actions.continue,true);var NEEDS_YOU=Object.freeze({[AI_TASK_REASONS.QUESTION]:{status:AI_TASK_MESSAGES.status.question,chat:true,dot:true,actions:[action(AI_TASK_ACTIONS.ANSWER,AI_TASK_MESSAGES.actions.answer,true)]},[AI_TASK_REASONS.YOUR_TURN]:{glyph:`turn`,status:AI_TASK_MESSAGES.status.yourTurn,tray:AI_TASK_MESSAGES.tray.yourTurn,chat:true,dot:true,actions:[action(AI_TASK_ACTIONS.FINISH,AI_TASK_MESSAGES.actions.finish,true)]},[AI_TASK_REASONS.AI_STUCK]:{status:AI_TASK_MESSAGES.status.aiStuck,chat:true,actions:[action(AI_TASK_ACTIONS.END,AI_TASK_MESSAGES.actions.endNotDone),action(AI_TASK_ACTIONS.OPEN_CHAT,AI_TASK_MESSAGES.actions.openChat,true)]},[AI_TASK_REASONS.CHECK_STUCK]:{check:true,diagnostic:true,actions:[OPEN_CHAT,CHECK_NOW]},[AI_TASK_REASONS.NO_RESULT]:{status:AI_TASK_MESSAGES.status.noResult,actions:[OPEN_CHAT,CHECK_NOW]},[AI_TASK_REASONS.STOPPED]:{status:AI_TASK_MESSAGES.status.stopped,actions:[OPEN_CHAT,CONTINUE]},[AI_TASK_REASONS.AI_UNAVAILABLE]:{status:AI_TASK_MESSAGES.status.aiUnavailable,note:AI_TASK_MESSAGES.progress.unavailable,actions:[action(AI_TASK_ACTIONS.AI_SETUP,AI_TASK_MESSAGES.actions.aiSetup),CONTINUE]},[AI_TASK_REASONS.TURN_FAILED]:{status:AI_TASK_MESSAGES.status.turnFailed,actions:[OPEN_CHAT,CONTINUE]},[AI_TASK_REASONS.INTERRUPTED]:{status:AI_TASK_MESSAGES.status.interrupted,actions:[CONTINUE]},[AI_TASK_REASONS.UNCONFIRMED]:{status:AI_TASK_MESSAGES.status.unconfirmed,check:true,actions:[CHECK_NOW]},[AI_TASK_REASONS.DRAFT_WAITING]:{status:AI_TASK_MESSAGES.status.draftWaiting,chat:true,check:true,diagnostic:true,actions:[action(AI_TASK_ACTIONS.OPEN_CHAT,AI_TASK_MESSAGES.actions.openChat,true)]}});function stepsOf(task,needs){const[work,check]=task.steps;const counted=task.check.retryLimit>0?AI_TASK_MESSAGES.attempt(task.attempt,task.check.retryLimit):``;const ended=aiTaskEnded(task);const atCheck=task.phase===AI_TASK_PHASES.CHECKING||task.checkRunning||needs?.check===true;const passed=task.phase===AI_TASK_PHASES.DONE;const workState=passed||atCheck?`done`:ended?`failed`:`active`;const checkState=passed?`done`:needs?.check||ended&&atCheck?`failed`:atCheck?`active`:`pending`;const steps=[{label:work,state:workState,attempt:workState===`active`?counted:``}];if(check)steps.push({label:check,state:checkState,attempt:atCheck&&!ended?counted:``});return steps}function endedMessage(task,viewerId){if(task.message)return task.message;const by=task.endedBy;return by?.name&&by.id!==viewerId?AI_TASK_MESSAGES.cancelledBy(by.name,task.noun):AI_TASK_MESSAGES.cancelledByYou(task.noun)}function outcomeOf(task,viewerId){if(task.phase===AI_TASK_PHASES.DONE)return{heading:AI_TASK_MESSAGES.outcome.done,happened:task.message,report:task.report,next:``};return{heading:AI_TASK_MESSAGES.outcome.notDone,happened:endedMessage(task,viewerId),report:``,next:AI_TASK_MESSAGES.whatsNext()}}function runningStatus(task){if(task.phase===AI_TASK_PHASES.STARTING)return AI_TASK_MESSAGES.status.starting;if(task.phase===AI_TASK_PHASES.CANCELLING)return AI_TASK_MESSAGES.status.cancelling;if(task.phase===AI_TASK_PHASES.CHECKING)return task.waiting?task.message:task.check.label;return task.attempt>1?AI_TASK_MESSAGES.retrying(task.attempt,task.check.retryLimit):AI_TASK_MESSAGES.status.working}function noteOf(task,needs){if(task.phase===AI_TASK_PHASES.CANCELLING)return task.checkRunning?task.check.unstoppable:``;if(!needs)return``;return[needs.status&&task.message!==needs.status?task.message:``,needs.diagnostic&&!task.message.includes(task.diagnostic)?task.diagnostic:``,needs.note].filter(Boolean).join(` `)}function projectAiTask(task,{viewerId}){const ended=aiTaskEnded(task);const needs=task.phase===AI_TASK_PHASES.NEEDS_YOU?NEEDS_YOU[task.reason]:null;const review=needs?.check&&task.reason===AI_TASK_REASONS.CHECK_STUCK&&task.conflictReview?[action(AI_TASK_ACTIONS.REVIEW,AI_TASK_MESSAGES.actions.review)]:[];const done=task.phase===AI_TASK_PHASES.DONE;const running=!ended&&!needs;return{glyph:done?`done`:ended?`not-done`:needs?needs.glyph||`attention`:`working`,status:done?AI_TASK_MESSAGES.outcome.done:ended?AI_TASK_MESSAGES.outcome.notDone:needs?needs.status||task.message:runningStatus(task),tray:done?AI_TASK_MESSAGES.tray.done:ended?AI_TASK_MESSAGES.tray.notDone:task.phase===AI_TASK_PHASES.CANCELLING?AI_TASK_MESSAGES.tray.cancelling:needs?needs.tray||AI_TASK_MESSAGES.tray.needsYou:task.tray,ended,chatDot:needs?.dot===true,opensOn:needs?.chat?`chat`:`progress`,composerOpen:Boolean(needs)||task.phase===AI_TASK_PHASES.WORKING,composerHint:task.reason===AI_TASK_REASONS.QUESTION?AI_TASK_MESSAGES.chat.answer:AI_TASK_MESSAGES.chat.message,note:running&&task.phase!==AI_TASK_PHASES.CANCELLING?``:noteOf(task,needs),steps:stepsOf(task,needs),actions:needs?[...review,...needs.actions]:[],cancelQuestion:AI_TASK_MESSAGES.cancelQuestion(task.noun),outcome:ended?outcomeOf(task,viewerId):null}}function aiTaskFooterActions(actions,view){if(view!==`chat`)return actions;return actions.filter(({id})=>id!==AI_TASK_ACTIONS.ANSWER&&id!==AI_TASK_ACTIONS.OPEN_CHAT)}function aiTaskTime(at){const date=new Date(at);return Number.isNaN(date.getTime())?``:date.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}var SESSION_CHANGED_EVENT=`vibe64.session.changed`;var AI_TASK_CHANGED=`ai-task-changed`;function useAiTasks({sessionId,sessionsApiPath,projectSlug,enabled,request,onClosed}){const task=shallowRef(null);const loaded=ref(false);const error=ref(``);const cancelRequested=ref(false);const closing=ref(false);const starting=ref(false);const viewerId=ref(``);let readGeneration=0;const tasksPath=()=>`${toValue(sessionsApiPath)}/${encodeURIComponent(toValue(sessionId))}/ai-tasks`;const taskPath=(suffix=``)=>`${tasksPath()}/${encodeURIComponent(task.value.id)}${suffix}`;function remember(next){if(task.value?.id===next.id&&next.revision<task.value.revision)return;task.value=next}async function load(){const generation=++readGeneration;if(!toValue(enabled)||!toValue(sessionId))return;try{const{tasks,viewerId:viewer}=await request(tasksPath(),{method:`GET`});if(generation!==readGeneration)return;viewerId.value=viewer;const[saved=null]=tasks;if(saved)remember(saved);else task.value=null;loaded.value=true}catch{}}async function start(kind,input){error.value=``;starting.value=true;try{const answer=await request(tasksPath(),{method:`POST`,body:{kind,input}});remember(answer.task);return answer.task}catch(failure){error.value=failure.message||AI_TASK_MESSAGES.requestFailed;return null}finally{starting.value=false}}async function act(suffix,body={}){error.value=``;try{remember((await request(taskPath(suffix),{method:`POST`,body})).task)}catch(failure){error.value=failure.message||AI_TASK_MESSAGES.requestFailed;load()}}async function cancel(){cancelRequested.value=true;await act(`/cancel`);cancelRequested.value=false}const check=(input={})=>act(`/check`,input);const continueTask=()=>act(`/continue`);const finish=()=>act(`/finish`);async function close(){error.value=``;closing.value=true;try{await request(taskPath(),{method:`DELETE`});task.value=null}catch{error.value=AI_TASK_MESSAGES.closeFailed}finally{closing.value=false}}const matchesSession=payload=>payload.projectSlug===toValue(projectSlug)&&payload.sessionId===toValue(sessionId)&&payload.reason===AI_TASK_CHANGED;useRealtimeEvent({enabled:computed(()=>toValue(enabled)),event:SESSION_CHANGED_EVENT,matches:({payload={}}={})=>matchesSession(payload),onEvent({payload}){if(payload.aiTask){remember(payload.aiTask);return}if(payload.aiTaskClosed?.id!==task.value?.id)return;const closedHere=closing.value;task.value=null;if(!closedHere)onClosed(payload.aiTaskClosed)}});useRealtimeEvent({enabled:computed(()=>toValue(enabled)),event:`connect`,onEvent:()=>void load()});watch(()=>[toValue(sessionId),toValue(enabled)],([,on],previous)=>{if(previous?.[0]!==toValue(sessionId)){task.value=null;loaded.value=false}if(on)load()},{immediate:true});return{cancel,cancelRequested,check,close,closing,continueTask,error,finish,load,loaded,start,starting,task,viewerId}}var WINDOW_QUERY=`aiTask`;function useAiTaskWindow({task,loaded,active,opensOn,route,router}){const view=ref(`progress`);const transcriptOpen=ref(false);let opener=null;const wanted=computed(()=>String(route.query[WINDOW_QUERY]||``));const open=computed(()=>toValue(active)&&Boolean(wanted.value)&&toValue(task)?.id===wanted.value);function withoutWindow(){const{[WINDOW_QUERY]:_taskId,...query}=route.query;return{path:route.path,query,hash:route.hash}}async function show(element=null){const current=toValue(task);if(!current)return;opener=element;if(open.value)return;await router.push({path:route.path,query:{...route.query,[WINDOW_QUERY]:current.id},hash:route.hash})}function hide(){if(wanted.value)router.replace(withoutWindow())}function setView(next){view.value=next}watch(open,isOpen=>{if(!isOpen)return;view.value=toValue(opensOn);transcriptOpen.value=false},{immediate:true});watch(()=>[wanted.value,toValue(loaded),toValue(task)?.id,toValue(active)],()=>{if(wanted.value&&toValue(active)&&toValue(loaded)&&toValue(task)?.id!==wanted.value)router.replace(withoutWindow())},{immediate:true});return{hide,open,opener:()=>opener?.isConnected?opener:null,setView,show,transcriptOpen,view}}function useAiTaskHost({sessionId,sessionsApiPath,projectSlug,enabled,active,request,route,router,openAiSetup,reviewResolved,fallbackFocus}){const toast=ref(null);const tasks=useAiTasks({sessionId,sessionsApiPath,projectSlug,enabled,request,onClosed(closed){const heading=closed.phase===`done`?AI_TASK_MESSAGES.outcome.done:AI_TASK_MESSAGES.outcome.notDone;toast.value={text:AI_TASK_MESSAGES.toast(closed.title,heading),action:false}}});const projection=computed(()=>tasks.task.value&&projectAiTask(tasks.task.value,{viewerId:tasks.viewerId.value}));const taskWindow=useAiTaskWindow({task:tasks.task,loaded:tasks.loaded,active,opensOn:()=>projection.value?.opensOn||`progress`,route,router});function returnFocusTarget(){return taskWindow.opener()||document.querySelector(`[data-vibe64-ai-task-tray]`)||fallbackFocus()}async function start(kind,opener,input){const task=await tasks.start(kind,input);if(task)await nextTick();if(task)taskWindow.show(opener);else toast.value={text:tasks.error.value,action:false};return task}async function close(){const target=returnFocusTarget();await tasks.close();if(tasks.task.value)return;taskWindow.hide();await nextTick();(target?.isConnected?target:fallbackFocus())?.focus({preventScroll:true})}function run(actionId){const{task}=tasks;if(actionId===AI_TASK_ACTIONS.ANSWER||actionId===AI_TASK_ACTIONS.OPEN_CHAT)taskWindow.setView(`chat`);else if(actionId===AI_TASK_ACTIONS.CHECK)tasks.check();else if(actionId===AI_TASK_ACTIONS.CONTINUE)tasks.continueTask();else if(actionId===AI_TASK_ACTIONS.FINISH)tasks.finish();else if(actionId===AI_TASK_ACTIONS.END)tasks.cancel();else if(actionId===AI_TASK_ACTIONS.AI_SETUP)openAiSetup();else if(actionId===AI_TASK_ACTIONS.REVIEW&&task.value)reviewResolved()}function seeToastResult(){toast.value=null;taskWindow.show(null)}watch(()=>tasks.task.value&&aiTaskEnded(tasks.task.value),(ended,wasEnded)=>{if(!ended||wasEnded!==false||taskWindow.open.value||!toValue(active))return;toast.value={text:AI_TASK_MESSAGES.toast(tasks.task.value.title,projection.value.outcome.heading),action:true}});return reactive({cancel:tasks.cancel,cancelRequested:tasks.cancelRequested,check:tasks.check,close,closing:tasks.closing,error:tasks.error,hide:taskWindow.hide,open:taskWindow.open,projection,returnFocusTarget,run,seeToastResult,setTranscript:open=>{taskWindow.transcriptOpen.value=open},setView:taskWindow.setView,show:taskWindow.show,start,starting:tasks.starting,task:tasks.task,toast,transcriptOpen:taskWindow.transcriptOpen,view:taskWindow.view})}var _sfc_main$4={__name:`Vibe64AiTaskButton`,props:{kind:{required:true,type:String},allowed:{required:true,type:Boolean},title:{required:true,type:String},input:{required:true,type:Object}},emits:[`done`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const tasks=inject(VIBE64_AI_TASKS_KEY);const own=computed(()=>tasks.task?.kind===props.kind?tasks.task:null);const linked=computed(()=>Boolean(own.value));const label=computed(()=>{if(tasks.starting)return AI_TASK_MESSAGES.button.opening;if(!own.value)return AI_TASK_MESSAGES.button.fix;return tasks.projection.ended?AI_TASK_MESSAGES.button.result:AI_TASK_MESSAGES.button.busy});const disabled=computed(()=>!own.value&&(!props.allowed||tasks.starting));watch(()=>own.value?.phase===AI_TASK_PHASES.DONE?own.value.id:``,doneId=>{if(doneId)emit(`done`)});function activate(event){const opener=event.currentTarget;if(own.value)tasks.show(opener);else tasks.start(props.kind,opener,props.input)}return(_ctx,_cache)=>{return openBlock(),createBlock(VBtn,{"aria-busy":label.value===unref(AI_TASK_MESSAGES).button.opening?`true`:void 0,class:`vibe64-ai-task-button`,"data-vibe64-ai-task-button":``,disabled:disabled.value,"prepend-icon":`$smartToy`,size:`small`,title:__props.title,type:`button`,variant:`tonal`,onClick:activate},createSlots({default:withCtx(()=>[createTextVNode(toDisplayString(label.value)+` `,1)]),_:2},[linked.value?{name:`append`,fn:withCtx(()=>[createVNode(VIcon,{icon:`$arrowForward`,size:`16`,"aria-hidden":`true`})]),key:`0`}:void 0]),1032,[`aria-busy`,`disabled`,`title`])}}};var Vibe64AiTaskButton_default=_plugin_vue_export_helper_default(_sfc_main$4,[[`__scopeId`,`data-v-2233af9d`]]);var _hoisted_1$3=[`aria-label`,`title`];var _hoisted_2$3={class:`vibe64-ai-task-tray__label`};var _sfc_main$3={__name:`Vibe64AiTaskTray`,setup(__props){const tasks=inject(VIBE64_AI_TASKS_KEY);const glyphIcons={attention:`$errorFilled`,done:`$checkCircleFilled`,"not-done":`$cancel`,turn:`$circle`};return(_ctx,_cache)=>{return openBlock(),createElementBlock(`button`,{"aria-label":`${unref(tasks).task.title}: ${unref(tasks).projection.tray}`,class:normalizeClass([`vibe64-ai-task-tray`,`vibe64-ai-task-tray--${unref(tasks).projection.glyph}`]),"data-vibe64-ai-task-tray":``,title:unref(tasks).projection.tray,type:`button`,onClick:_cache[0]||(_cache[0]=$event=>unref(tasks).show($event.currentTarget))},[unref(tasks).projection.glyph===`working`?(openBlock(),createBlock(VProgressCircular,{key:0,indeterminate:``,size:`16`,width:`2`,"aria-hidden":`true`})):(openBlock(),createBlock(VIcon,{key:1,icon:glyphIcons[unref(tasks).projection.glyph],size:`18`,"aria-hidden":`true`},null,8,[`icon`])),createBaseVNode(`span`,_hoisted_2$3,toDisplayString(unref(tasks).projection.tray),1)],10,_hoisted_1$3)}}};var Vibe64AiTaskTray_default=_plugin_vue_export_helper_default(_sfc_main$3,[[`__scopeId`,`data-v-56857b35`]]);var PHONE_WIDTH=600;var SHORT_HEIGHT=560;var EXPANDED_WIDTH=960;function aiTaskFit(width,height){const phone=width<PHONE_WIDTH;if(phone||height<SHORT_HEIGHT)return{fullscreen:true,phone,width:void 0,height:void 0};return width<EXPANDED_WIDTH?{fullscreen:false,phone,width:`min(92vw, 46rem)`,height:`88dvh`}:{fullscreen:false,phone,width:`46rem`,height:`min(80dvh, 46rem)`}}var REDUCED_MOTION=`(prefers-reduced-motion: reduce)`;function useAiTaskFocus({title,views,selectedView,setView,returnFocusTarget}){const tabElements=new Map;const motionQuery=globalThis.matchMedia(REDUCED_MOTION);const reducedMotion=ref(motionQuery.matches);const noteMotion=event=>{reducedMotion.value=event.matches};motionQuery.addEventListener(`change`,noteMotion);onScopeDispose(()=>motionQuery.removeEventListener(`change`,noteMotion));function focusTitle(){title.value?.focus({preventScroll:true})}function returnFocus(){returnFocusTarget()?.focus({preventScroll:true})}function setTab(view,element){if(element)tabElements.set(view,element);else tabElements.delete(view)}async function moveBetweenViews(event){const index=views.indexOf(selectedView());const next={ArrowLeft:views[(index+views.length-1)%views.length],ArrowRight:views[(index+1)%views.length],End:views.at(-1),Home:views[0]}[event.key];if(!next)return;event.preventDefault();setView(next);await nextTick();tabElements.get(next)?.focus()}return{focusTitle,moveBetweenViews,reducedMotion,returnFocus,setTab}}var _hoisted_1$2={class:`ai-task-outcome`};var _hoisted_2$2={key:0};var _hoisted_3$2={key:1};var _sfc_main$2={__name:`Vibe64AiTaskOutcome`,props:{task:{required:true,type:Object},projection:{required:true,type:Object}},emits:[`see-conversation`],setup(__props,{emit:__emit}){const emit=__emit;return(_ctx,_cache)=>{return openBlock(),createElementBlock(`div`,_hoisted_1$2,[createBaseVNode(`section`,null,[createBaseVNode(`h3`,null,toDisplayString(unref(AI_TASK_MESSAGES).outcome.problem),1),createBaseVNode(`p`,null,toDisplayString(__props.task.problem.summary),1)]),createBaseVNode(`section`,null,[createBaseVNode(`h3`,null,toDisplayString(unref(AI_TASK_MESSAGES).outcome.whatHappened),1),createBaseVNode(`p`,null,toDisplayString(__props.projection.outcome.happened),1)]),__props.projection.outcome.report?(openBlock(),createElementBlock(`section`,_hoisted_2$2,[createBaseVNode(`h3`,null,toDisplayString(unref(AI_TASK_MESSAGES).outcome.whatTheAiDid),1),createBaseVNode(`p`,null,toDisplayString(__props.projection.outcome.report),1)])):createCommentVNode(``,true),__props.projection.outcome.next?(openBlock(),createElementBlock(`section`,_hoisted_3$2,[createBaseVNode(`h3`,null,toDisplayString(unref(AI_TASK_MESSAGES).outcome.whatsNext),1),createBaseVNode(`p`,null,toDisplayString(__props.projection.outcome.next),1)])):createCommentVNode(``,true),createVNode(VBtn,{class:`ai-task-outcome__conversation`,"data-vibe64-ai-task-transcript":``,variant:`text`,onClick:_cache[0]||(_cache[0]=$event=>emit(`see-conversation`))},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(AI_TASK_MESSAGES).outcome.seeConversation),1)]),_:1})])}}};var Vibe64AiTaskOutcome_default=_plugin_vue_export_helper_default(_sfc_main$2,[[`__scopeId`,`data-v-bc318273`]]);var _hoisted_1$1={class:`ai-task-progress`};var _hoisted_2$1={class:`ai-task-progress__steps`};var _hoisted_3$1={class:`ai-task-progress__label`};var _hoisted_4$1={key:0,class:`ai-task-progress__attempt`};var _hoisted_5$1={key:0,class:`ai-task-progress__note`};var _hoisted_6$1={key:1,class:`ai-task-progress__output`};var _hoisted_7$1=[`aria-label`];var _hoisted_8$1={class:`ai-task-progress__heading`};var _hoisted_9$1=[`datetime`];var _sfc_main$1={__name:`Vibe64AiTaskProgress`,props:{task:{required:true,type:Object},projection:{required:true,type:Object},output:{required:true,type:Boolean},commentary:{required:true,type:Array}},setup(__props){const props=__props;const stepIcons={active:`$radioOn`,done:`$checkCircleFilled`,failed:`$cancel`,pending:`$circle`};const activity=computed(()=>[...props.task.log,...props.commentary].sort((a,b)=>a.at.localeCompare(b.at)));return(_ctx,_cache)=>{return openBlock(),createElementBlock(`div`,_hoisted_1$1,[createBaseVNode(`ol`,_hoisted_2$1,[(openBlock(true),createElementBlock(Fragment,null,renderList(__props.projection.steps,step=>{return openBlock(),createElementBlock(`li`,{key:step.label,class:normalizeClass([`ai-task-progress__step`,`ai-task-progress__step--${step.state}`])},[createVNode(VIcon,{icon:stepIcons[step.state],size:`18`,"aria-hidden":`true`},null,8,[`icon`]),createBaseVNode(`span`,_hoisted_3$1,toDisplayString(step.label),1),step.attempt?(openBlock(),createElementBlock(`span`,_hoisted_4$1,toDisplayString(step.attempt),1)):createCommentVNode(``,true)],2)}),128))]),__props.projection.note?(openBlock(),createElementBlock(`p`,_hoisted_5$1,toDisplayString(__props.projection.note),1)):createCommentVNode(``,true),_ctx.$slots[`check-output`]&&__props.output?(openBlock(),createElementBlock(`details`,_hoisted_6$1,[createBaseVNode(`summary`,null,toDisplayString(__props.task.check.output),1),renderSlot(_ctx.$slots,`check-output`,{},void 0,true)])):createCommentVNode(``,true),createBaseVNode(`section`,{class:`ai-task-progress__activity`,"aria-label":unref(AI_TASK_MESSAGES).progress.activity},[createBaseVNode(`h3`,_hoisted_8$1,toDisplayString(unref(AI_TASK_MESSAGES).progress.activity),1),createBaseVNode(`ol`,null,[(openBlock(true),createElementBlock(Fragment,null,renderList(activity.value,entry=>{return openBlock(),createElementBlock(`li`,{key:`${entry.at}:${entry.text}`},[createBaseVNode(`time`,{datetime:entry.at},toDisplayString(unref(aiTaskTime)(entry.at)),9,_hoisted_9$1),createBaseVNode(`span`,null,toDisplayString(entry.text),1)])}),128))])],8,_hoisted_7$1)])}}};var Vibe64AiTaskProgress_default=_plugin_vue_export_helper_default(_sfc_main$1,[[`__scopeId`,`data-v-1d71ea78`]]);var _hoisted_1=[`aria-labelledby`,`data-vibe64-ai-task-phase`,`data-vibe64-ai-task-reason`];var _hoisted_2={class:`ai-task__header`};var _hoisted_3={class:`ai-task__heading`};var _hoisted_4=[`id`];var _hoisted_5={"aria-live":`polite`,class:`ai-task__status`,"data-vibe64-ai-task-status":``};var _hoisted_6={key:0,class:`ai-task__commands`};var _hoisted_7={class:`ai-task__problem`};var _hoisted_8=[`title`];var _hoisted_9=[`aria-expanded`,`aria-label`];var _hoisted_10={class:`ai-task__details-word`};var _hoisted_11={key:0,class:`ai-task__details`,"data-vibe64-ai-task-details-text":``,tabindex:`0`};var _hoisted_12=[`aria-label`];var _hoisted_13=[`id`,`aria-controls`,`aria-selected`,`data-vibe64-ai-task-view`,`tabindex`,`onClick`];var _hoisted_14=[`aria-label`];var _hoisted_15={class:`ai-task__body`};var _hoisted_16=[`id`,`aria-labelledby`];var _hoisted_17=[`id`,`aria-labelledby`,`role`];var _hoisted_18={key:1,class:`ai-task__error`,role:`alert`};var _hoisted_19={key:2,class:`ai-task__footer ai-task__footer--question`};var _hoisted_20={class:`ai-task__actions`};var _hoisted_21={key:3,class:`ai-task__footer`};var _hoisted_22={class:`ai-task__actions`};var _hoisted_23={key:4,class:`ai-task__footer`};var _hoisted_24={class:`ai-task__actions`};var _sfc_main={__name:`Vibe64AiTaskWindow`,props:{source:{required:true,type:Object},commentary:{required:true,type:Array},output:{required:true,type:Boolean}},setup(__props){const props=__props;const glyphIcons={attention:`$errorFilled`,done:`$checkCircleFilled`,"not-done":`$cancel`,turn:`$circle`};const titleId=useId();const title=ref(null);const task=computed(()=>props.source.task);const projection=computed(()=>props.source.projection);const footerActions=computed(()=>aiTaskFooterActions(projection.value.actions,props.source.view));const{width,height}=useDisplay();const fit=computed(()=>aiTaskFit(width.value,height.value));const detailsOpen=ref(false);const confirmingCancel=ref(false);const cancelling=computed(()=>props.source.cancelRequested||task.value.phase===`cancelling`);const tabs=[{id:`progress`,label:AI_TASK_MESSAGES.views.progress},{id:`chat`,label:AI_TASK_MESSAGES.views.chat}];const{focusTitle,moveBetweenViews,reducedMotion,returnFocus,setTab}=useAiTaskFocus({title,views:tabs.map(tab=>tab.id),selectedView:()=>props.source.view,setView:view=>props.source.setView(view),returnFocusTarget:()=>props.source.returnFocusTarget()});function requestCancel(){if(cancelling.value)props.source.cancel();else confirmingCancel.value=true}function cancel(){confirmingCancel.value=false;props.source.cancel()}function escape(){if(projection.value.ended)props.source.close();else props.source.hide()}watch(()=>projection.value.ended,async ended=>{if(!ended)return;confirmingCancel.value=false;await nextTick();focusTitle()});return(_ctx,_cache)=>{return openBlock(),createBlock(VDialog,{"aria-labelledby":unref(titleId),fullscreen:fit.value.fullscreen,height:fit.value.height,"model-value":__props.source.open,"no-click-animation":``,persistent:``,width:fit.value.width,transition:unref(reducedMotion)?false:void 0,onAfterEnter:unref(focusTitle),onAfterLeave:unref(returnFocus),onKeydown:withKeys(withModifiers(escape,[`stop`,`prevent`]),[`esc`])},{default:withCtx(()=>[createBaseVNode(`section`,{"aria-labelledby":unref(titleId),class:normalizeClass([`ai-task`,{"ai-task--fullscreen":fit.value.fullscreen,"ai-task--ended":projection.value.ended}]),"data-vibe64-ai-task":``,"data-vibe64-ai-task-phase":task.value.phase,"data-vibe64-ai-task-reason":task.value.reason},[createBaseVNode(`header`,_hoisted_2,[createBaseVNode(`span`,{class:normalizeClass([`ai-task__glyph`,`ai-task__glyph--${projection.value.glyph}`]),"aria-hidden":`true`},[projection.value.glyph===`working`?(openBlock(),createBlock(VProgressCircular,{key:0,indeterminate:!unref(reducedMotion),"model-value":unref(reducedMotion)?60:void 0,size:`20`,width:`2`},null,8,[`indeterminate`,`model-value`])):(openBlock(),createBlock(VIcon,{key:1,icon:glyphIcons[projection.value.glyph],size:`22`},null,8,[`icon`]))],2),createBaseVNode(`div`,_hoisted_3,[createBaseVNode(`h2`,{id:unref(titleId),ref_key:`title`,ref:title,tabindex:`-1`},toDisplayString(projection.value.ended?projection.value.outcome.heading:task.value.title),9,_hoisted_4),createBaseVNode(`p`,_hoisted_5,toDisplayString(projection.value.ended?task.value.title:projection.value.status),1)]),!projection.value.ended?(openBlock(),createElementBlock(`div`,_hoisted_6,[createVNode(VBtn,{"data-vibe64-ai-task-hide":``,variant:`text`,onClick:__props.source.hide},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(AI_TASK_MESSAGES).actions.hide),1)]),_:1},8,[`onClick`]),createVNode(VBtn,{"aria-busy":cancelling.value?`true`:void 0,"data-vibe64-ai-task-cancel":``,variant:`text`,onClick:requestCancel},{default:withCtx(()=>[createTextVNode(toDisplayString(cancelling.value?unref(AI_TASK_MESSAGES).actions.cancelling:unref(AI_TASK_MESSAGES).actions.cancel),1)]),_:1},8,[`aria-busy`])])):createCommentVNode(``,true)]),!projection.value.ended?(openBlock(),createElementBlock(Fragment,{key:0},[createBaseVNode(`div`,_hoisted_7,[createBaseVNode(`span`,{class:`ai-task__problem-line`,title:task.value.problem.summary},toDisplayString(task.value.problem.summary),9,_hoisted_8),task.value.problem.details?(openBlock(),createElementBlock(`button`,{key:0,"aria-expanded":detailsOpen.value?`true`:`false`,"aria-label":unref(AI_TASK_MESSAGES).actions.details,class:`ai-task__details-toggle`,"data-vibe64-ai-task-details":``,type:`button`,onClick:_cache[0]||(_cache[0]=$event=>detailsOpen.value=!detailsOpen.value)},[createBaseVNode(`span`,_hoisted_10,toDisplayString(unref(AI_TASK_MESSAGES).actions.details),1),createVNode(VIcon,{icon:detailsOpen.value?`$collapse`:`$expand`,size:`18`,"aria-hidden":`true`},null,8,[`icon`])],8,_hoisted_9)):createCommentVNode(``,true)]),detailsOpen.value?(openBlock(),createElementBlock(`pre`,_hoisted_11,toDisplayString(task.value.problem.details),1)):createCommentVNode(``,true),createBaseVNode(`div`,{"aria-label":unref(AI_TASK_MESSAGES).views.label,class:`ai-task__views`,role:`tablist`,onKeydown:_cache[1]||(_cache[1]=(...args)=>unref(moveBetweenViews)&&unref(moveBetweenViews)(...args))},[(openBlock(),createElementBlock(Fragment,null,renderList(tabs,tab=>{return createBaseVNode(`button`,{id:`${unref(titleId)}-${tab.id}-tab`,key:tab.id,ref_for:true,ref:element=>unref(setTab)(tab.id,element),"aria-controls":`${unref(titleId)}-${tab.id}`,"aria-selected":__props.source.view===tab.id?`true`:`false`,class:normalizeClass([`ai-task__view`,{"ai-task__view--selected":__props.source.view===tab.id}]),"data-vibe64-ai-task-view":tab.id,role:`tab`,tabindex:__props.source.view===tab.id?0:-1,type:`button`,onClick:$event=>__props.source.setView(tab.id)},[createTextVNode(toDisplayString(tab.label)+` `,1),tab.id===`chat`&&projection.value.chatDot?(openBlock(),createElementBlock(`span`,{key:0,class:`ai-task__dot`,role:`img`,"aria-label":unref(AI_TASK_MESSAGES).views.waiting},null,8,_hoisted_14)):createCommentVNode(``,true)],10,_hoisted_13)}),64))],40,_hoisted_12)],64)):createCommentVNode(``,true),createBaseVNode(`div`,_hoisted_15,[!projection.value.ended?withDirectives((openBlock(),createElementBlock(`section`,{key:0,id:`${unref(titleId)}-progress`,"aria-labelledby":`${unref(titleId)}-progress-tab`,class:`ai-task__panel`,role:`tabpanel`},[createVNode(Vibe64AiTaskProgress_default,{commentary:__props.commentary,output:__props.output,projection:projection.value,task:task.value},{"check-output":withCtx(()=>[renderSlot(_ctx.$slots,`check-output`,{},void 0,true)]),_:3},8,[`commentary`,`output`,`projection`,`task`])],8,_hoisted_16)),[[vShow,__props.source.view===`progress`]]):!__props.source.transcriptOpen?(openBlock(),createBlock(Vibe64AiTaskOutcome_default,{key:1,projection:projection.value,task:task.value,onSeeConversation:_cache[2]||(_cache[2]=$event=>__props.source.setTranscript(true))},null,8,[`projection`,`task`])):createCommentVNode(``,true),withDirectives(createBaseVNode(`section`,{id:`${unref(titleId)}-chat`,"aria-labelledby":projection.value.ended?void 0:`${unref(titleId)}-chat-tab`,class:`ai-task__panel`,role:projection.value.ended?void 0:`tabpanel`},[renderSlot(_ctx.$slots,`chat`,{visible:__props.source.open&&(projection.value.ended?__props.source.transcriptOpen:__props.source.view===`chat`)},void 0,true)],8,_hoisted_17),[[vShow,!projection.value.ended?__props.source.view===`chat`:__props.source.transcriptOpen]])]),__props.source.error?(openBlock(),createElementBlock(`p`,_hoisted_18,toDisplayString(__props.source.error),1)):createCommentVNode(``,true),confirmingCancel.value?(openBlock(),createElementBlock(`footer`,_hoisted_19,[createBaseVNode(`p`,null,toDisplayString(projection.value.cancelQuestion),1),createBaseVNode(`div`,_hoisted_20,[createVNode(VBtn,{"data-vibe64-ai-task-keep-going":``,variant:`text`,onClick:_cache[3]||(_cache[3]=$event=>confirmingCancel.value=false)},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(AI_TASK_MESSAGES).actions.keepGoing),1)]),_:1}),createVNode(VBtn,{color:`error`,"data-vibe64-ai-task-cancel-confirm":``,variant:`flat`,onClick:cancel},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(AI_TASK_MESSAGES).cancelConfirm(task.value.noun)),1)]),_:1})])])):projection.value.ended?(openBlock(),createElementBlock(`footer`,_hoisted_21,[createBaseVNode(`div`,_hoisted_22,[__props.source.transcriptOpen?(openBlock(),createBlock(VBtn,{key:0,variant:`text`,onClick:_cache[4]||(_cache[4]=$event=>__props.source.setTranscript(false))},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(AI_TASK_MESSAGES).outcome.showResult),1)]),_:1})):createCommentVNode(``,true),createVNode(VBtn,{"aria-busy":__props.source.closing?`true`:void 0,color:`primary`,"data-vibe64-ai-task-close":``,variant:`flat`,onClick:__props.source.close},{default:withCtx(()=>[createTextVNode(toDisplayString(__props.source.closing?unref(AI_TASK_MESSAGES).actions.closing:unref(AI_TASK_MESSAGES).actions.close),1)]),_:1},8,[`aria-busy`,`onClick`])])])):footerActions.value.length?(openBlock(),createElementBlock(`footer`,_hoisted_23,[createBaseVNode(`div`,_hoisted_24,[(openBlock(true),createElementBlock(Fragment,null,renderList(footerActions.value,item=>{return openBlock(),createBlock(VBtn,{key:item.id,color:item.primary?`primary`:void 0,"data-vibe64-ai-task-action":item.id,variant:item.primary?`flat`:`text`,onClick:$event=>__props.source.run(item.id)},{default:withCtx(()=>[createTextVNode(toDisplayString(item.label),1)]),_:2},1032,[`color`,`data-vibe64-ai-task-action`,`variant`,`onClick`])}),128))])])):createCommentVNode(``,true)],10,_hoisted_1)]),_:3},8,[`aria-labelledby`,`fullscreen`,`height`,`model-value`,`width`,`transition`,`onAfterEnter`,`onAfterLeave`,`onKeydown`])}}};var Vibe64AiTaskWindow_default=_plugin_vue_export_helper_default(_sfc_main,[[`__scopeId`,`data-v-5f35de55`]]);var REPOSITORY_STATUS_SESSION_REASONS=new Set([`claude-stream-turn-idle`,`codex-app-server-turn-idle`,`opencode-server-turn-idle`,`repository-canonical-changed`,`session-pull-request`,`session-repository-checked`,`session-save-completed`,`session-save-failed`,`session-save-started`,`session-save-update-required`,`session-starter-applied`,`session-turn-checkpoint-failed`,`session-turn-checkpoint-updated`,`session-update-completed`,`session-update-failed`,`session-update-started`]);var REPOSITORY_UPDATE_CHECK_FAILED_REASON=`session-repository-check-failed`;var REPOSITORY_CANONICAL_RECHECK_REASONS=new Set([`repository-canonical-changed`,`session-pull-request`,`session-save-failed`,`session-save-update-required`,`session-update-failed`]);function repositoryStatusSessionId(payload={}){const event=normalizeObject(payload);return String(event.sessionId||event.session?.sessionId||``).trim()}function repositoryStatusRealtimeShouldRefresh(payload={}){return REPOSITORY_STATUS_SESSION_REASONS.has(String(normalizeObject(payload).reason||``).trim())}function repositoryStatusRealtimeNeedsCanonicalCheck(payload={}){return REPOSITORY_CANONICAL_RECHECK_REASONS.has(String(normalizeObject(payload).reason||``).trim())}export{Vibe64AiTaskWindow_default as a,useAiTaskHost as c,repositoryStatusSessionId as i,AI_TASK_PHASES as l,repositoryStatusRealtimeNeedsCanonicalCheck as n,Vibe64AiTaskTray_default as o,repositoryStatusRealtimeShouldRefresh as r,Vibe64AiTaskButton_default as s,REPOSITORY_UPDATE_CHECK_FAILED_REASON as t,VIBE64_AI_TASKS_KEY as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Et as unref,H as openBlock,N as nextTick,Xt as toDisplayString,b as createVNode,d as createBaseVNode,f as createBlock,i as Fragment,it as watch,m as createElementBlock,ot as withCtx,p as createCommentVNode,u as computed,vt as ref,y as createTextVNode}from"./runtime-core.esm-bundler-Bi1P1jMa.js";import{S as VIcon,_ as VProgressLinear}from"./VChip-D2IukBZw.js";import{t as useEndpointResource}from"./useEndpointResource-61E93qP-.js";import{t as VSelect}from"./VSelect-9lMtP5cu.js";import{t as VAlert}from"./VAlert-DyCQWe9P.js";import{t as VTextField}from"./VTextField-BMvaWVTN.js";import{i as scopedDevelopmentApiUrl}from"./studioUrls-oIU1Eq_t.js";import{l as requestVibe64AiOnboarding,y as useModelRouting}from"./client-DnjkdG6K.js";import{t as VBtn}from"./VBtn-2vbH580C.js";import{t as VSheet}from"./VSheet-D5wAuyc2.js";import{t as VDialog}from"./VDialog-B2W9wqR8.js";import{i as VCardTitle,n as VCardText,o as VCardActions,t as VCard}from"./VCard-BFqQSnAE.js";import{t as VSpacer}from"./VSpacer-GgPR_AzN.js";import{t as VSkeletonLoader}from"./VSkeletonLoader-C5ZRrPV4.js";import{t as VSwitch}from"./VSwitch-DUkp5sfW.js";import{t as VTextarea}from"./VTextarea-CLaWcpd_.js";import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper-DNW4j-dv.js";import{t as useUiFeedback}from"./useUiFeedback-CycH_fvY.js";import{t as readRefOrGetterValue}from"./vueRefOrGetterValue-y-4f_In7.js";import{L as vibe64SessionPath,k as vibe64RepositoryApiPath,o as VIBE64_SESSIONS_API_SUFFIX}from"./vibe64SessionRequestConfig-DVRCRAex.js";import{b as sameVibe64AssistantSelection,c as vibe64AssistantSelectionLabel}from"./shared-X5MxTHwl.js";import{j as requestVibe64AccountConnectionsDialog,k as Vibe64SessionAssistantMenu_default}from"./index-Bvd00puv.js";import{a as vibe64SessionPullRequest,i as vibe64SessionDisplayTitle}from"./vibe64SessionViewModel-CQCds_jb.js";import{a as githubProjectRepositoryName,t as GITHUB_BODY_MAX_LENGTH}from"./vibe64GithubProject-DNl0aDcC.js";var _hoisted_1$1={class:`d-flex align-center justify-space-between ga-2 pa-5 pb-2`};var _hoisted_2$1={class:`d-flex align-center ga-3`};var _hoisted_3$1={class:`text-label-large`};var _hoisted_4$1={class:`text-body-medium mt-1`};var _hoisted_5$1={key:0,role:`status`};var _sfc_main$1={__name:`Vibe64CreatePullRequestDialog`,props:{modelValue:Boolean,dashboardContext:{required:true,type:Object}},emits:[`update:modelValue`,`created`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const title=ref(``);const body=ref(``);const draft=ref(true);const pending=ref(false);const destinationReview=ref(null);const feedback=useUiFeedback({source:`vibe64.pullRequests.create`});const session=computed(()=>props.dashboardContext.session||{});const source=computed(()=>vibe64SessionPullRequest(session.value));const repository=computed(()=>githubProjectRepositoryName(props.dashboardContext.projectContext));const branch=computed(()=>{if(source.value?.headBranch)return source.value.headBranch;const destination=props.dashboardContext.workState?.destination;if(destination?.mode===`github`&&destination.branch!==props.dashboardContext.projectContext?.repository?.defaultBranch)return destination.branch;return`vibe64/pr-${props.dashboardContext.sessionId}`});const base=computed(()=>source.value?.baseBranch||props.dashboardContext.projectContext?.repository?.defaultBranch||``);const path=computed(()=>vibe64SessionPath(readRefOrGetterValue(props.dashboardContext.sessionsApiPath),props.dashboardContext.sessionId,`/pull-request`));const resource=useEndpointResource({path,queryKey:computed(()=>[`vibe64.createPullRequest`,path.value]),enabled:false});watch(()=>props.modelValue,open=>{if(open)destinationReview.value=props.dashboardContext.workState?.destination?{...props.dashboardContext.workState.destination}:null},{immediate:true});watch(()=>props.dashboardContext.sessionId,()=>{title.value=source.value?.title||vibe64SessionDisplayTitle(session.value);body.value=source.value?.body||``;draft.value=true},{immediate:true});async function submit(){if(pending.value||!title.value.trim())return;pending.value=true;try{const result=await resource.save({title:title.value.trim(),body:body.value,draft:draft.value,destinationReview:destinationReview.value},{method:`POST`});feedback.success(`Pull request created. Future commits update its source branch.`);emit(`created`,result.pullRequest);emit(`update:modelValue`,false);props.dashboardContext.refreshSessionWork?.()}catch(error){feedback.error(error,`The pull request could not be confirmed. Retry to check GitHub and continue.`)}finally{pending.value=false}}return(_ctx,_cache)=>{return openBlock(),createBlock(VDialog,{"model-value":__props.modelValue,"max-width":`38rem`,scrollable:``,persistent:pending.value,"onUpdate:modelValue":_cache[5]||(_cache[5]=$event=>emit(`update:modelValue`,$event))},{default:withCtx(()=>[createVNode(VCard,{rounded:`xl`},{default:withCtx(()=>[createBaseVNode(`div`,_hoisted_1$1,[createBaseVNode(`div`,_hoisted_2$1,[createVNode(VIcon,{icon:`$callMerge`,color:`primary`}),_cache[6]||(_cache[6]=createBaseVNode(`h2`,{class:`text-title-large`},`Create pull request`,-1))]),createVNode(VBtn,{icon:`$close`,size:`48`,variant:`text`,"aria-label":`Close pull request dialog`,disabled:pending.value,onClick:_cache[0]||(_cache[0]=$event=>emit(`update:modelValue`,false))},null,8,[`disabled`])]),createVNode(VCardText,{class:`d-flex flex-column ga-3`},{default:withCtx(()=>[createVNode(VSheet,{color:`surface-light`,rounded:`lg`,class:`pa-3 pr-destination`},{default:withCtx(()=>[createBaseVNode(`div`,_hoisted_3$1,toDisplayString(repository.value),1),createBaseVNode(`div`,_hoisted_4$1,toDisplayString(branch.value)+` → `+toDisplayString(base.value),1),_cache[7]||(_cache[7]=createBaseVNode(`p`,{class:`text-body-small on-surface-variant mt-2 mb-0`},`The base branch stays unchanged.`,-1))]),_:1}),_cache[8]||(_cache[8]=createBaseVNode(`p`,{class:`text-body-small ma-0`},`Save open file edits first.`,-1)),!destinationReview.value?(openBlock(),createElementBlock(`p`,_hoisted_5$1,`Refresh repository status before creating a pull request.`)):createCommentVNode(``,true),createVNode(VTextField,{modelValue:title.value,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>title.value=$event),label:`Title`,variant:`outlined`,maxlength:`256`,disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`disabled`]),createVNode(VTextarea,{modelValue:body.value,"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>body.value=$event),label:`Description`,placeholder:`What changed, and how did you check it?`,variant:`outlined`,rows:`3`,"auto-grow":``,maxlength:unref(GITHUB_BODY_MAX_LENGTH),disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`maxlength`,`disabled`]),createVNode(VSwitch,{modelValue:draft.value,"onUpdate:modelValue":_cache[3]||(_cache[3]=$event=>draft.value=$event),color:`primary`,label:`Create as draft`,disabled:pending.value,"hide-details":``},null,8,[`modelValue`,`disabled`]),_cache[9]||(_cache[9]=createBaseVNode(`details`,{class:`pr-details text-body-small`},[createBaseVNode(`summary`,{class:`py-3`},`What gets pushed`),createBaseVNode(`p`,null,`All saved file changes are committed and pushed to the PR branch. Database data and chat history are separate. GitHub automation may run; this does not deploy the app.`)],-1))]),_:1}),createVNode(VCardActions,{class:`pa-5 pt-2`},{default:withCtx(()=>[createVNode(VSpacer),createVNode(VBtn,{variant:`text`,disabled:pending.value,onClick:_cache[4]||(_cache[4]=$event=>emit(`update:modelValue`,false))},{default:withCtx(()=>[..._cache[10]||(_cache[10]=[createTextVNode(`Cancel`,-1)])]),_:1},8,[`disabled`]),createVNode(VBtn,{color:`primary`,variant:`flat`,rounded:`pill`,disabled:pending.value||!title.value.trim()||!destinationReview.value||__props.dashboardContext.sourceOperationsSuspended,"aria-busy":pending.value,onClick:submit},{default:withCtx(()=>[createTextVNode(toDisplayString(pending.value?`Creating…`:draft.value?`Create draft PR`:`Create pull request`),1)]),_:1},8,[`disabled`,`aria-busy`])]),_:1})]),_:1})]),_:1},8,[`model-value`,`persistent`])}}};var Vibe64CreatePullRequestDialog_default=_plugin_vue_export_helper_default(_sfc_main$1,[[`__scopeId`,`data-v-84ea6dc2`]]);var _hoisted_1={class:`vibe64-assistant-dialog__title-copy`};var _hoisted_2={class:`text-body-small`};var _hoisted_3={key:2,class:`vibe64-assistant-dialog__ai`};var _hoisted_4={class:`text-body-medium mb-0`};var _hoisted_5={key:3,class:`d-flex flex-column ga-2`};var _hoisted_6={key:0,class:`d-flex flex-column ga-3 mt-3`};var _hoisted_7={key:0,class:`text-body-small`,style:{"overflow-wrap":`anywhere`}};var _hoisted_8={key:0,class:`vibe64-assistant-dialog__progress`,role:`status`,"aria-live":`polite`};var _sfc_main={__name:`Vibe64AssistantSessionDialog`,props:{modelValue:Boolean,toolbar:{required:true,type:Object}},emits:[`created`,`update:model-value`],setup(__props,{emit:__emit}){const props=__props;const emit=__emit;const routing=useModelRouting({enabled:computed(()=>props.modelValue),view:`main`});const mainSelection=routing.mainChatSelection;const openConnectionSettings=()=>requestVibe64AccountConnectionsDialog({section:`ai`});const canChooseSessionAi=computed(()=>routing.resource.data.value?.canConfigure===true);const sessionAi=ref(null);const customOpen=ref(false);const changeButton=ref(null);const aiSummary=computed(()=>sessionAi.value?`This session runs on: ${vibe64AssistantSelectionLabel(sessionAi.value)}`:`Runs on your main AI: ${vibe64AssistantSelectionLabel(mainSelection.value)}`);function openSessionAiChoice(){if(canChooseSessionAi.value&&!submitting.value)customOpen.value=true}function chooseSessionAi(selection){sessionAi.value=sameVibe64AssistantSelection(selection,mainSelection.value)?null:selection;return{ok:true}}function useMainAi(){sessionAi.value=null}function setUpAi(){close();requestVibe64AiOnboarding()}const submitButton=ref(null);const submitting=computed(()=>props.toolbar.createSessionRunning===true);const branchMode=ref(`project`);const chooseBranch=computed(()=>branchMode.value!==`project`);const createBranch=computed(()=>branchMode.value===`new`);const branchName=ref(``);const newBranchName=ref(``);const branchProject=computed(()=>props.toolbar.projectContext||{});const branchSelectionAvailable=computed(()=>!props.toolbar.repositoryBranchSelectionDisabled&&[`github`,`managed_git`].includes(branchProject.value.repositoryMode||branchProject.value.repository?.mode));const branchChoices=computed(()=>[{title:`Project branch (${branchProject.value.repository?.defaultBranch||`main`})`,value:`project`},{title:`Create a new branch`,value:`new`},{title:`Use an existing branch`,value:`existing`}]);const branchRepository=computed(()=>branchProject.value.githubRepository?.fullName||branchProject.value.repository?.github?.fullName||branchProject.value.slug);const branchPath=computed(()=>scopedDevelopmentApiUrl(`${vibe64RepositoryApiPath(`/api${VIBE64_SESSIONS_API_SUFFIX}`)}/branches`,branchProject.value.slug));const branches=useEndpointResource({path:branchPath,queryKey:computed(()=>[`vibe64.branches`,branchPath.value]),enabled:computed(()=>props.modelValue&&branchSelectionAvailable.value&&chooseBranch.value),queryOptions:{retry:false},fallbackLoadError:`Repository branches could not load.`});const selectedBranch=computed(()=>branches.data.value?.branches?.find(item=>item.name===branchName.value));const branchAlreadyExists=computed(()=>branches.data.value?.branches?.some(item=>item.name===newBranchName.value.trim()));const branchSelectionReady=computed(()=>{if(!chooseBranch.value)return true;if(!selectedBranch.value||branches.isLoading.value||branches.loadError.value)return false;return!createBranch.value||Boolean(newBranchName.value.trim())&&!branchAlreadyExists.value});watch(()=>branches.data.value,value=>{if(!value?.branches?.some(item=>item.name===branchName.value))branchName.value=value?.defaultBranch||``},{immediate:true});function close(){if(!submitting.value)emit(`update:model-value`,false)}async function submit(){if(!mainSelection.value||submitting.value||!branchSelectionReady.value)return;let response;try{const options={};if(chooseBranch.value)options.repositoryBranch={name:createBranch.value?newBranchName.value.trim():branchName.value,...createBranch.value?{fromBranch:branchName.value}:{},expectedCommit:selectedBranch.value.commit};response=await props.toolbar.createSession(sessionAi.value||{},options)}catch{return}if(response?.ok!==false&&response?.sessionId){emit(`created`,response);emit(`update:model-value`,false)}}watch(()=>props.modelValue,open=>{if(!open)return;branchMode.value=`project`;branchName.value=branches.data.value?.defaultBranch||``;newBranchName.value=``;sessionAi.value=null;customOpen.value=false},{immediate:true});watch(submitting,async(running,wasRunning)=>{if(running||!wasRunning||!props.modelValue)return;await nextTick();const target=submitButton.value?.$el;if(target?.isConnected===true)target.focus({preventScroll:true})});return(_ctx,_cache)=>{return openBlock(),createBlock(VDialog,{"model-value":__props.modelValue,persistent:submitting.value,"max-width":`38rem`,scrollable:``,"onUpdate:modelValue":_cache[6]||(_cache[6]=$event=>!$event&&close())},{default:withCtx(()=>[createVNode(VCard,{class:`vibe64-assistant-dialog`,rounded:`xl`},{default:withCtx(()=>[createVNode(VCardTitle,{class:`vibe64-assistant-dialog__title`},{default:withCtx(()=>[createBaseVNode(`span`,_hoisted_1,[_cache[7]||(_cache[7]=createBaseVNode(`strong`,{class:`text-title-large`},`Start an AI session`,-1)),createBaseVNode(`small`,_hoisted_2,toDisplayString(sessionAi.value?`Starts in Custom. Choose Senior, Junior or Auto from chat.`:`Starts in Auto. Choose Senior or Junior from chat.`),1)]),createVNode(VBtn,{"aria-label":`Close AI session dialog`,disabled:submitting.value,icon:`$close`,title:`Close`,variant:`text`,onClick:close},null,8,[`disabled`])]),_:1}),createVNode(VCardText,{class:`vibe64-assistant-dialog__body`},{default:withCtx(()=>[unref(routing).resource.isInitialLoading.value?(openBlock(),createBlock(VSkeletonLoader,{key:0,type:`list-item-two-line`})):unref(routing).loadError.value?(openBlock(),createBlock(VAlert,{key:1,type:`error`,variant:`tonal`},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(routing).loadError.value)+` `,1),createVNode(VBtn,{variant:`text`,onClick:_cache[0]||(_cache[0]=$event=>unref(routing).resource.reload())},{default:withCtx(()=>[..._cache[8]||(_cache[8]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):unref(mainSelection)?(openBlock(),createElementBlock(`div`,_hoisted_3,[createBaseVNode(`p`,_hoisted_4,[createTextVNode(toDisplayString(aiSummary.value)+` `,1),canChooseSessionAi.value?(openBlock(),createBlock(VBtn,{key:0,ref_key:`changeButton`,ref:changeButton,disabled:submitting.value,size:`small`,variant:`text`,onClick:openSessionAiChoice},{default:withCtx(()=>[..._cache[9]||(_cache[9]=[createTextVNode(` Change `,-1)])]),_:1},8,[`disabled`])):createCommentVNode(``,true),sessionAi.value?(openBlock(),createBlock(VBtn,{key:1,disabled:submitting.value,size:`small`,variant:`text`,onClick:useMainAi},{default:withCtx(()=>[..._cache[10]||(_cache[10]=[createTextVNode(`Use main AI`,-1)])]),_:1},8,[`disabled`])):createCommentVNode(``,true)]),createVNode(VBtn,{class:`vibe64-assistant-dialog__main-ai`,disabled:submitting.value,"prepend-icon":`$settings`,size:`small`,variant:`text`,onClick:openConnectionSettings},{default:withCtx(()=>[..._cache[11]||(_cache[11]=[createTextVNode(` Change main AI for all sessions `,-1)])]),_:1},8,[`disabled`])])):(openBlock(),createElementBlock(`div`,_hoisted_5,[_cache[13]||(_cache[13]=createBaseVNode(`strong`,null,`No AI is set up yet`,-1)),_cache[14]||(_cache[14]=createBaseVNode(`span`,{class:`text-body-small`},`Set up your AI, then come back to start a session.`,-1)),createVNode(VBtn,{color:`primary`,variant:`flat`,class:`align-self-start`,onClick:setUpAi},{default:withCtx(()=>[..._cache[12]||(_cache[12]=[createTextVNode(`Set up your AI`,-1)])]),_:1})])),branchSelectionAvailable.value?(openBlock(),createElementBlock(Fragment,{key:4},[createVNode(VSelect,{modelValue:branchMode.value,"onUpdate:modelValue":_cache[1]||(_cache[1]=$event=>branchMode.value=$event),items:branchChoices.value,label:`Work on`,disabled:submitting.value,"hide-details":``,class:`mt-4`},null,8,[`modelValue`,`items`,`disabled`]),chooseBranch.value?(openBlock(),createElementBlock(`div`,_hoisted_6,[createBranch.value?(openBlock(),createBlock(VTextField,{key:0,modelValue:newBranchName.value,"onUpdate:modelValue":_cache[2]||(_cache[2]=$event=>newBranchName.value=$event),label:`New branch name`,placeholder:`e.g. improve-booking`,maxlength:`255`,disabled:submitting.value,"error-messages":newBranchName.value.trim()&&branchAlreadyExists.value?`That branch already exists. Choose an existing branch instead.`:``,"hide-details":`auto`},null,8,[`modelValue`,`disabled`,`error-messages`])):createCommentVNode(``,true),unref(branches).isLoading.value?(openBlock(),createBlock(VSkeletonLoader,{key:1,type:`list-item-two-line, paragraph`})):unref(branches).loadError.value?(openBlock(),createBlock(VAlert,{key:2,type:`error`,variant:`tonal`},{default:withCtx(()=>[createTextVNode(toDisplayString(unref(branches).loadError.value)+` `,1),createVNode(VBtn,{variant:`text`,onClick:_cache[3]||(_cache[3]=$event=>unref(branches).reload())},{default:withCtx(()=>[..._cache[15]||(_cache[15]=[createTextVNode(`Try again`,-1)])]),_:1})]),_:1})):(openBlock(),createElementBlock(Fragment,{key:3},[createVNode(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_7,toDisplayString(createBranch.value?`Creates the branch and opens a new session.`:`Opens a new session on this branch.`)+` Your changes will be saved to `+toDisplayString(branchRepository.value)+`:`+toDisplayString(createBranch.value?newBranchName.value.trim()||`your new branch`:branchName.value)+`. `,1)):createCommentVNode(``,true),_cache[16]||(_cache[16]=createBaseVNode(`p`,{class:`text-body-small`},`Deploying the app still uses the project branch.`,-1))],64))])):createCommentVNode(``,true)],64)):createCommentVNode(``,true)]),_:1}),submitting.value?(openBlock(),createElementBlock(`div`,_hoisted_8,[createVNode(VProgressLinear,{indeterminate:``,color:`primary`,rounded:``}),_cache[17]||(_cache[17]=createBaseVNode(`p`,{class:`text-body-small mb-0`},` Copying the project source for the new session. This can take a little while for a large project. Any connected repositories and workspace setup then continue in the session, which shows their progress. `,-1))])):createCommentVNode(``,true),createVNode(VCardActions,{class:`vibe64-assistant-dialog__actions`},{default:withCtx(()=>[createVNode(VBtn,{disabled:submitting.value,variant:`text`,onClick:close},{default:withCtx(()=>[..._cache[18]||(_cache[18]=[createTextVNode(`Cancel`,-1)])]),_:1},8,[`disabled`]),createVNode(VBtn,{ref_key:`submitButton`,ref:submitButton,"aria-busy":submitting.value?`true`:void 0,color:`primary`,disabled:!unref(mainSelection)||submitting.value||!branchSelectionReady.value,variant:`flat`,onClick:submit},{default:withCtx(()=>[createTextVNode(toDisplayString(submitting.value?`Creating session…`:chooseBranch.value&&createBranch.value?`Create branch & session`:`Create session`),1)]),_:1},8,[`aria-busy`,`disabled`])]),_:1}),createVNode(Vibe64SessionAssistantMenu_default,{modelValue:customOpen.value,"onUpdate:modelValue":_cache[5]||(_cache[5]=$event=>customOpen.value=$event),target:changeButton.value?.$el||null,selection:sessionAi.value||unref(mainSelection),"can-configure":canChooseSessionAi.value,"changes-disabled":submitting.value,"save-selection":chooseSessionAi},null,8,[`modelValue`,`target`,`selection`,`can-configure`,`changes-disabled`])]),_:1})]),_:1},8,[`model-value`,`persistent`])}}};var Vibe64AssistantSessionDialog_default=_plugin_vue_export_helper_default(_sfc_main,[[`__scopeId`,`data-v-64d684e1`]]);var CREATED_SESSION_FOCUS_TIMEOUT_MS=2e3;async function focusCreatedVibe64SessionTab(sessionId=``){const normalizedSessionId=String(sessionId||``).trim();if(!normalizedSessionId||typeof document===`undefined`)return false;const deadline=Date.now()+CREATED_SESSION_FOCUS_TIMEOUT_MS;while(Date.now()<deadline){const dialogVisible=[...document.querySelectorAll(`.vibe64-assistant-dialog`)].some(element=>element.getClientRects().length>0);const target=[...document.querySelectorAll(`[data-vibe64-session-id]`)].find(element=>element.getAttribute(`data-vibe64-session-id`)===normalizedSessionId&&element.getClientRects().length>0);if(!dialogVisible&&target){target.focus({preventScroll:true});return document.activeElement===target}await new Promise(resolve=>{(globalThis.requestAnimationFrame||(callback=>setTimeout(callback,16)))(resolve)})}return false}export{Vibe64AssistantSessionDialog_default as n,Vibe64CreatePullRequestDialog_default as r,focusCreatedVibe64SessionTab as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.pr-destination[data-v-84ea6dc2]{overflow-wrap:anywhere}.pr-details summary[data-v-84ea6dc2]{cursor:pointer;min-height:48px}.vibe64-assistant-dialog__progress[data-v-64d684e1]{gap:.5rem;padding:0 1.5rem .5rem;display:grid}.vibe64-assistant-dialog[data-v-64d684e1]{border:1px solid rgb(var(--v-theme-outline-variant))}.vibe64-assistant-dialog__title[data-v-64d684e1]{justify-content:space-between;align-items:center;padding:1rem 1.25rem .75rem;display:flex}.vibe64-assistant-dialog__title-copy[data-v-64d684e1]{gap:.15rem;display:grid}.vibe64-assistant-dialog__title-copy small[data-v-64d684e1]{color:rgba(var(--v-theme-on-surface), .66);white-space:normal}.vibe64-assistant-dialog__body[data-v-64d684e1]{padding:.25rem 1.25rem 1rem!important}.vibe64-assistant-dialog__ai[data-v-64d684e1]{overflow-wrap:anywhere;justify-items:start;gap:.25rem;display:grid}.vibe64-assistant-dialog__main-ai[data-v-64d684e1]{margin-inline-start:-.5rem}.vibe64-assistant-dialog__actions[data-v-64d684e1]{border-top:1px solid rgb(var(--v-theme-outline-variant));justify-content:flex-end;gap:.5rem;padding:.75rem 1.25rem}@media (width<=600px){.vibe64-assistant-dialog__body[data-v-64d684e1],.vibe64-assistant-dialog__actions[data-v-64d684e1],.vibe64-assistant-dialog__title[data-v-64d684e1]{padding-inline:1rem!important}}
|