@codexhost/cli-linux-arm64 0.19.0 → 0.20.0
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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +24 -3
- package/app/console-web.js +1095 -682
- package/app/desktop-controller.mjs +40 -4
- package/app/host-runtime.mjs +1572 -1120
- package/app/plugins/antigravity/plugin.mjs +8753 -4274
- package/app/plugins/claude-code/plugin.mjs +26 -3
- package/app/plugins/codebuddy/plugin.mjs +41 -5
- package/app/plugins/codex-usage/plugin.mjs +26 -3
- package/app/plugins/copilot/plugin.mjs +26 -3
- package/app/plugins/cursor-cli/plugin.mjs +26 -3
- package/app/plugins/deepseek-harness/plugin.mjs +26 -3
- package/app/plugins/devin/plugin.mjs +25 -3
- package/app/plugins/grok/plugin.mjs +26 -3
- package/app/plugins/hermes/plugin.mjs +25 -3
- package/app/plugins/kimi-code/plugin.mjs +26 -3
- package/app/plugins/kiro-cli/plugin.mjs +26 -3
- package/app/plugins/omp/plugin.mjs +44 -6
- package/app/plugins/opencode/plugin.mjs +26 -3
- package/app/plugins/pi/plugin.mjs +45 -6
- package/app/plugins/qoder/plugin.mjs +48 -4
- package/app/plugins/qoder-cn/plugin.mjs +48 -4
- package/app/plugins/qwen-code/plugin.mjs +26 -3
- package/app/plugins/workbuddy/plugin.mjs +45 -8
- package/app/plugins/zcode/plugin.mjs +26 -3
- package/app/renderer-extension.js +1411 -737
- package/app/web/assets/index-D6-hvggd.css +1 -0
- package/app/web/assets/index-D85gPBbQ.js +201 -0
- package/app/web/assets/langs/{graphql-B8vkg11W.js → graphql-ChAeyPkT.js} +1 -1
- package/app/web/assets/langs/{http-DmoDEjMt.js → http-BvreBIbD.js} +1 -1
- package/app/web/assets/langs/{php-DJ5ovfAM.js → php-D8omCIuJ.js} +1 -1
- package/app/web/assets/langs/{rst-U5-R5x3p.js → rst-Do7RLLCS.js} +1 -1
- package/app/web/assets/langs/{ruby-VKVsnS0H.js → ruby-rH_O_vse.js} +1 -1
- package/app/web/assets/langs/{svelte-C20lOv9V.js → svelte-xZy73wAj.js} +1 -1
- package/app/web/assets/langs/{vue-z6Y-lzP-.js → vue-C4DW8agZ.js} +1 -1
- package/app/web/assets/{vendor-dSL872WO.js → vendor-C9g2bw8s.js} +3 -3
- package/app/web/codexhost-settings.js +1101 -684
- package/app/web/index.html +4 -3
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -69
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +13 -13
- package/app/web/plugins/deepseek-ai__dsh-client-ui-session/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
- package/app/web-modules/server.mjs +138 -70
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-BNQIOOHE.css +0 -1
- package/app/web/assets/index-Feo4BkqN.js +0 -199
|
@@ -4,4 +4,4 @@ window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-session`,factory:e=
|
|
|
4
4
|
/* v8 ignore next 2 -- scan() stops stepping once the view is invalid. */
|
|
5
5
|
case`invalid`:return;
|
|
6
6
|
/* v8 ignore next 2 -- Every scanner mode has a handler above. */
|
|
7
|
-
default:d(this.#r)}}fail(){this.#d=this.#n,this.#r=`invalid`,this.#c=null}beginKey(e){this.#r=`key`,this.#a=e+1,this.#o=!1,this.#i=!1}stepKey(e,t){if(e<` `){this.fail();return}if(this.#i){this.#i=!1;return}if(e===`\\`){this.#i=!0,this.#o=!0;return}if(e!==`"`)return;let n=this.slice(this.#a,t);if(this.#o)try{this.#s=JSON.parse(`"${n}"`)}catch{this.fail();return}else this.#s=n;this.#r=`colon`}open(e){this.#p.has(this.#s)||this.#m.push(this.#s),this.#p.set(this.#s,e),this.#c=e}beginValue(e,t){l(e)||(e===`"`?(this.open({kind:`string`,start:t+1,end:-1,needsDecoding:!1,invalidAt:void 0,length:void 0,text:void 0,prefixes:void 0}),this.#i=!1,this.#r=`string`):e===`}`||e===`,`||e===`:`||e===`]`?this.fail():(this.open({kind:`value`,start:t,end:-1,parsed:void 0,invalid:!1}),e===`{`||e===`[`?(this.#r=`nested`,this.#l=[e===`{`?`}`:`]`],this.#u=!1,this.#i=!1):this.#r=`scalar`))}stepScalar(e,t){(e===`,`||e===`}`||l(e))&&(this.closeValue(t),this.#r=e===`,`?`key-only`:e===`}`?`closed`:`comma-or-end`)}stepNested(e,t){if(this.#u)this.#u=!1;else if(e===`"`)this.#u=!0;else if(e===`{`||e===`[`)this.#l.push(e===`{`?`}`:`]`);else if(e===`}`||e===`]`){if(this.#l.pop()!==e){this.fail();return}this.#l.length===0&&(this.closeValue(t+1),this.#r=`comma-or-end`)}}closeValue(e){let t=this.#c;t.end=e,this.#c=null}});function d(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}var f=class{keys=/* @__PURE__ */ new WeakMap;valueSet=/* @__PURE__ */ new Set;values=this.valueSet;get(e){return this.keys.get(e)}has(e){return this.keys.has(e)}set(e,t){if(this.keys.has(e)){let n=this.keys.get(e);if(n===t)return this;this.valueSet.delete(n)}return this.keys.set(e,t),this.valueSet.add(t),this}delete(e){if(!this.keys.has(e))return!1;let t=this.keys.get(e),n=this.keys.delete(e);return this.valueSet.delete(t),n}clear(){this.keys=/* @__PURE__ */ new WeakMap,this.valueSet.clear()}};function p(e,{empty:t,children:n}){return e.key===void 0?/* @__PURE__ */ (0,o.jsx)(o.Fragment,{children:t?.()??null}):/* @__PURE__ */ (0,o.jsx)(o.Fragment,{children:n})}var m=class{precedence;changed;values=/* @__PURE__ */ new Map;constructor(e,t){this.precedence=e,this.changed=t}valuesSnapshot(){return[...this.values.values()].map(e=>e.interaction)}publish(e,t){if(this.values.has(e.key))throw Error(`ui-session: duplicate pending interaction key '${e.key}'`);this.values.set(e.key,{interaction:e,delegate:t}),this.changed();let n=!0;return()=>{n&&(n=!1,this.values.delete(e.key)&&this.changed())}}release(){let e=[...this.values.values()].map(e=>e.delegate);return this.values.clear(),e}};let h={hooks:[`session`],keyedHooks:[`projection`],props:[`sessionId`],resolve:e=>({hooks:{session:e.session},keyedHooks:{projection:t=>e.session.projections.faceOf(t)},props:{sessionId:e.sessionId}})};var g=class extends r.Service{sessions;descriptors=[h];bindings=new f;absent;current;pendingDomains=[];pendingSnapshot=/* @__PURE__ */ new Map;running=/* @__PURE__ */ new Map;completionUnread=/* @__PURE__ */ new Set;statusSnapshot=/* @__PURE__ */ new Map;statusListeners=/* @__PURE__ */ new Set;mainRetainId;disposeMainRetain=()=>{};active=!0;sessionStatus={getSnapshot:()=>this.statusSnapshot,subscribe:e=>(this.statusListeners.add(e),()=>{this.statusListeners.delete(e)})};adapter;constructor(e,t){super(e,`uiSession`),this.sessions=t,this.absent=_(this.materializeAbsent()),this.current=_(this.absent.value),this.adapter={current:this.current,bindingSource:e=>this.bindingSource(e),renderArea:p},e.effect(()=>{let n=t.list.subscribe(()=>{this.publishMain()}),r=t.list.subscribe(()=>{this.reconcileStatus()}),i=e.remote.$on(`api-session/status`,(e,t)=>{this.observeRunning(e,t)});return this.publishMain(),this.reconcileStatus(),()=>{this.active=!1,n(),r(),i(),this.disposeMainRetain();let e=[...this.bindings.values];this.bindings.clear();for(let t of e)t.release()}},`ui-session: Session binding projection`)}bindingSource(e){if(!this.active||e===void 0)return this.absent;let t=e.binding;if(this.sessions.binding(e.sessionId)!==t)throw Error(`ui-session: Session reference is not active in this Controller`);return this.sourceFor(t)}provide(e){let t=e,n=this.ctx.effect(()=>{this.descriptors.push(t);try{this.rebuildBindings()}catch(e){throw this.descriptors.pop(),e}return()=>{let e=this.descriptors.indexOf(t);this.descriptors.splice(e,1),this.rebuildBindings()}},`uiSession.provide()`);return()=>{n()}}registerPendingInteraction(e){let t=new m(e,()=>{this.publishPendingInteractions()}),n=t;return this.ctx.effect(()=>(this.pendingDomains.push(n),this.publishPendingInteractions(),async()=>{let e=t.release(),r=this.pendingDomains.indexOf(n);this.pendingDomains.splice(r,1),this.publishPendingInteractions(),await Promise.allSettled(e.map(e=>Promise.resolve().then(e)))}),`uiSession.registerPendingInteraction()`),(e,n)=>t.publish(e,n)}rebuildBindings(){let e=this.materializeAbsent(),t=[...this.bindings.values].map(e=>({source:e.source,value:this.materialize(e.owner)}));this.absent.value=e;for(let{source:e,value:n}of t)e.value=n;(0,i.notifySubscribers)(this.absent.listeners,`[ui-session] absent binding`);for(let{source:e}of t)(0,i.notifySubscribers)(e.listeners,`[ui-session] Session binding`);this.publishMain()}sourceFor(e){let t=this.bindings.get(e);if(t!==void 0)return t.source;let n=this.createMaterializedBinding(e);return this.bindings.set(e,n),n.source}publishMain(){if(!this.active)return;let e=this.sessions.list.getSnapshot().byId,t=this.current.value.key,n=t!==void 0&&(this.sessions.retainInfo(t).getSnapshot().retainedBy.mainView??0)>0?t:Object.values(e).find(e=>(e.retainedBy.mainView??0)>0)?.id;this.watchMainRetention(n);let r=n===void 0?void 0:this.sessions.binding(n),a=r===void 0?this.absent.value:this.sourceFor(r).value;this.current.value!==a&&(this.current.value=a,(0,i.notifySubscribers)(this.current.listeners,`[ui-session] main binding`))}watchMainRetention(e){e!==this.mainRetainId&&(this.disposeMainRetain(),this.mainRetainId=e,this.disposeMainRetain=e===void 0?()=>{}:this.sessions.retainInfo(e).subscribe(()=>{this.publishMain()}))}publishPendingInteractions(){let e=/* @__PURE__ */ new Map;for(let t of this.pendingDomains)for(let n of t.valuesSnapshot()){let r=t.precedence(n),i=e.get(n.sessionId);(i===void 0||r>=i.precedence)&&e.set(n.sessionId,{interaction:n,precedence:r})}let t=new Map([...e].map(([e,t])=>[e,t.interaction]));E(this.pendingSnapshot,t)||(this.pendingSnapshot=t,this.publishStatus())}observeRunning(e,t){let n=this.running.get(e),r=this.sessions.list.getSnapshot().phase===`pending`;this.running.set(e,t),t?this.completionUnread.delete(e):(n===!0||n===void 0&&r)&&!this.isMain(e)&&this.completionUnread.add(e),this.publishStatus()}reconcileStatus(){let e=this.sessions.list.getSnapshot(),t=new Set(Object.keys(e.byId));for(let t of e.ids){let n=e.byId[t],r=this.running.get(t);r===void 0?this.running.set(t,n.running):r!==n.running&&this.observeRunning(t,n.running)}for(let e of t)this.isMain(e)&&this.completionUnread.delete(e);if(e.phase===`ready`)for(let e of this.running.keys())t.has(e)||(this.running.delete(e),this.completionUnread.delete(e));this.publishStatus()}isMain(e){return(this.sessions.list.getSnapshot().byId[e]?.retainedBy.mainView??0)>0}publishStatus(){let e=/* @__PURE__ */ new Set([...Object.keys(this.sessions.list.getSnapshot().byId),...this.running.keys(),...this.pendingSnapshot.keys(),...this.completionUnread]),t=/* @__PURE__ */ new Map;for(let n of e)t.set(n,{running:this.running.get(n),pendingInteraction:this.pendingSnapshot.get(n),completionUnread:this.completionUnread.has(n)});T(this.statusSnapshot,t)||(this.statusSnapshot=t,(0,i.notifySubscribers)(this.statusListeners,`[ui-session] Session status`))}createMaterializedBinding(e){let t=this.materialize(e);this.ctx.slots.bindStoreScope(t);let n=_(t),r=e.ctx.effect(()=>()=>{this.bindings.get(e)===a&&this.bindings.delete(e),n.value=this.absent.value,(0,i.notifySubscribers)(n.listeners,`[ui-session] Session binding`),this.publishMain()},`ui-session: binding ${e.sessionId}`),a={owner:e,source:n,release:()=>{r()}};return a}materialize(e){let t={},n={},r={},i=/* @__PURE__ */ new Set;for(let a of this.descriptors){let o=a.resolve(e);v(a,o),b(`hook`,t,a.hooks,o.hooks,i),b(`keyed hook`,n,a.keyedHooks,o.keyedHooks,i),b(`prop`,r,a.props,o.props,i)}return{key:e.sessionId,ctx:e.ctx,hooks:t,keyedHooks:n,props:r}}materializeAbsent(){let e={},t={},n={},r=/* @__PURE__ */ new Set;for(let i of this.descriptors)x(`hook`,e,i.hooks,r),x(`keyed hook`,t,i.keyedHooks,r),x(`prop`,n,i.props,r);return{key:void 0,hooks:e,keyedHooks:t,props:n}}};function _(e){let t={value:e,listeners:/* @__PURE__ */ new Set,getSnapshot:()=>t.value,subscribe:e=>(t.listeners.add(e),()=>{t.listeners.delete(e)})};return t}function v(e,t){y(`hook`,e.hooks,t.hooks),y(`keyed hook`,e.keyedHooks,t.keyedHooks),y(`prop`,e.props,t.props)}function y(e,t,n){for(let r of Object.keys(n??{}))if(!(t??[]).includes(r))throw Error(`uiSession.provide: undeclared ${e} '${r}'`)}function b(e,t,n,r,i){for(let a of n??[]){S(e,a,i);let n=r?.[a];if(n===void 0)throw Error(`uiSession.provide: missing ${e} '${a}'`);t[a]=n}}function x(e,t,n,r){for(let i of n??[])S(e,i,r),t[i]=void 0}function S(e,t,n){let r=e===`prop`?t:(0,a.standardHookPropName)(t);if(n.has(r))throw Error(`uiSession.provide: duplicate ${e} '${t}' at prop '${r}'`);n.add(r)}let C=[`sessions`,`slots`,`remote`];function w(e){let t=new g(e,e.sessions);e.slots.provideRoot({hooks:{sessions:e.sessions.list,sessionStatus:t.sessionStatus},keyedHooks:{sessionRetainInfo:t=>e.sessions.retainInfo(t)}}),e.slots.installScope(`session`,t.adapter)}function T(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(e===void 0||e.running!==r.running||e.pendingInteraction!==r.pendingInteraction||e.completionUnread!==r.completionUnread)return!1}return!0}function E(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}return n.UiSession=g,n.apply=w,n.inject=C,t.exports}});
|
|
7
|
+
default:d(this.#r)}}fail(){this.#d=this.#n,this.#r=`invalid`,this.#c=null}beginKey(e){this.#r=`key`,this.#a=e+1,this.#o=!1,this.#i=!1}stepKey(e,t){if(e<` `){this.fail();return}if(this.#i){this.#i=!1;return}if(e===`\\`){this.#i=!0,this.#o=!0;return}if(e!==`"`)return;let n=this.slice(this.#a,t);if(this.#o)try{this.#s=JSON.parse(`"${n}"`)}catch{this.fail();return}else this.#s=n;this.#r=`colon`}open(e){this.#p.has(this.#s)||this.#m.push(this.#s),this.#p.set(this.#s,e),this.#c=e}beginValue(e,t){l(e)||(e===`"`?(this.open({kind:`string`,start:t+1,end:-1,needsDecoding:!1,invalidAt:void 0,length:void 0,text:void 0,prefixes:void 0}),this.#i=!1,this.#r=`string`):e===`}`||e===`,`||e===`:`||e===`]`?this.fail():(this.open({kind:`value`,start:t,end:-1,parsed:void 0,invalid:!1}),e===`{`||e===`[`?(this.#r=`nested`,this.#l=[e===`{`?`}`:`]`],this.#u=!1,this.#i=!1):this.#r=`scalar`))}stepScalar(e,t){(e===`,`||e===`}`||l(e))&&(this.closeValue(t),this.#r=e===`,`?`key-only`:e===`}`?`closed`:`comma-or-end`)}stepNested(e,t){if(this.#u)this.#u=!1;else if(e===`"`)this.#u=!0;else if(e===`{`||e===`[`)this.#l.push(e===`{`?`}`:`]`);else if(e===`}`||e===`]`){if(this.#l.pop()!==e){this.fail();return}this.#l.length===0&&(this.closeValue(t+1),this.#r=`comma-or-end`)}}closeValue(e){let t=this.#c;t.end=e,this.#c=null}});function d(e,t){let n=JSON.stringify(e)??String(e);throw Error(`unreachable variant${t?` in ${t}`:``}: ${n}`)}var f=class{keys=/* @__PURE__ */ new WeakMap;valueSet=/* @__PURE__ */ new Set;values=this.valueSet;get(e){return this.keys.get(e)}has(e){return this.keys.has(e)}set(e,t){if(this.keys.has(e)){let n=this.keys.get(e);if(n===t)return this;this.valueSet.delete(n)}return this.keys.set(e,t),this.valueSet.add(t),this}delete(e){if(!this.keys.has(e))return!1;let t=this.keys.get(e),n=this.keys.delete(e);return this.valueSet.delete(t),n}clear(){this.keys=/* @__PURE__ */ new WeakMap,this.valueSet.clear()}};function p(e,{empty:t,children:n}){return e.key===void 0?/* @__PURE__ */ (0,o.jsx)(o.Fragment,{children:t?.()??null}):/* @__PURE__ */ (0,o.jsx)(o.Fragment,{children:n})}var m=class{precedence;changed;values=/* @__PURE__ */ new Map;constructor(e,t){this.precedence=e,this.changed=t}valuesSnapshot(){return[...this.values.values()].map(e=>e.interaction)}publish(e,t){if(this.values.has(e.key))throw Error(`ui-session: duplicate pending interaction key '${e.key}'`);this.values.set(e.key,{interaction:e,delegate:t}),this.changed();let n=!0;return()=>{n&&(n=!1,this.values.delete(e.key)&&this.changed())}}release(){let e=[...this.values.values()].map(e=>e.delegate);return this.values.clear(),e}};let h={hooks:[`session`],keyedHooks:[`projection`],props:[`sessionId`],resolve:e=>({hooks:{session:e.session},keyedHooks:{projection:t=>e.session.projections.faceOf(t)},props:{sessionId:e.sessionId}})};var g=class extends r.Service{sessions;descriptors=[h];bindings=new f;absent;current;pendingDomains=[];pendingSnapshot=/* @__PURE__ */ new Map;running=/* @__PURE__ */ new Map;completionUnread=/* @__PURE__ */ new Set;statusSnapshot=/* @__PURE__ */ new Map;statusListeners=/* @__PURE__ */ new Set;mainRetainId;disposeMainRetain=()=>{};active=!0;sessionStatus={getSnapshot:()=>this.statusSnapshot,subscribe:e=>(this.statusListeners.add(e),()=>{this.statusListeners.delete(e)})};adapter;constructor(e,t){super(e,`uiSession`),this.sessions=t,this.absent=_(this.materializeAbsent()),this.current=_(this.absent.value),this.adapter={current:this.current,bindingSource:e=>this.bindingSource(e),renderArea:p},e.effect(()=>{let n=t.list.subscribe(()=>{this.publishMain()}),r=t.list.subscribe(()=>{this.reconcileStatus()}),i=e.remote.$on(`api-session/status`,(e,t)=>{this.observeRunning(e,t)});return this.publishMain(),this.reconcileStatus(),()=>{this.active=!1,n(),r(),i(),this.disposeMainRetain();let e=[...this.bindings.values];this.bindings.clear();for(let t of e)t.release()}},`ui-session: Session binding projection`)}bindingSource(e){if(!this.active||e===void 0)return this.absent;let t=e.binding;if(this.sessions.binding(e.sessionId)!==t)throw Error(`ui-session: Session reference is not active in this Controller`);return this.sourceFor(t)}provide(e){let t=e,n=this.ctx.effect(()=>{this.descriptors.push(t);try{this.rebuildBindings()}catch(e){throw this.descriptors.pop(),e}return()=>{let e=this.descriptors.indexOf(t);this.descriptors.splice(e,1),this.rebuildBindings()}},`uiSession.provide()`);return()=>{n()}}registerPendingInteraction(e){let t=new m(e,()=>{this.publishPendingInteractions()}),n=t;return this.ctx.effect(()=>(this.pendingDomains.push(n),this.publishPendingInteractions(),async()=>{let e=t.release(),r=this.pendingDomains.indexOf(n);this.pendingDomains.splice(r,1),this.publishPendingInteractions(),await Promise.allSettled(e.map(e=>Promise.resolve().then(e)))}),`uiSession.registerPendingInteraction()`),(e,n)=>t.publish(e,n)}markCompletionsRead(e){let t=!1;for(let n of e)this.completionUnread.delete(n)&&(t=!0);t&&this.publishStatus()}rebuildBindings(){let e=this.materializeAbsent(),t=[...this.bindings.values].map(e=>({source:e.source,value:this.materialize(e.owner)}));this.absent.value=e;for(let{source:e,value:n}of t)e.value=n;(0,i.notifySubscribers)(this.absent.listeners,`[ui-session] absent binding`);for(let{source:e}of t)(0,i.notifySubscribers)(e.listeners,`[ui-session] Session binding`);this.publishMain()}sourceFor(e){let t=this.bindings.get(e);if(t!==void 0)return t.source;let n=this.createMaterializedBinding(e);return this.bindings.set(e,n),n.source}publishMain(){if(!this.active)return;let e=this.sessions.list.getSnapshot().byId,t=this.current.value.key,n=t!==void 0&&(this.sessions.retainInfo(t).getSnapshot().retainedBy.mainView??0)>0?t:Object.values(e).find(e=>(e.retainedBy.mainView??0)>0)?.id;this.watchMainRetention(n);let r=n===void 0?void 0:this.sessions.binding(n),a=r===void 0?this.absent.value:this.sourceFor(r).value;this.current.value!==a&&(this.current.value=a,(0,i.notifySubscribers)(this.current.listeners,`[ui-session] main binding`))}watchMainRetention(e){e!==this.mainRetainId&&(this.disposeMainRetain(),this.mainRetainId=e,this.disposeMainRetain=e===void 0?()=>{}:this.sessions.retainInfo(e).subscribe(()=>{this.publishMain()}))}publishPendingInteractions(){let e=/* @__PURE__ */ new Map;for(let t of this.pendingDomains)for(let n of t.valuesSnapshot()){let r=t.precedence(n),i=e.get(n.sessionId);(i===void 0||r>=i.precedence)&&e.set(n.sessionId,{interaction:n,precedence:r})}let t=new Map([...e].map(([e,t])=>[e,t.interaction]));E(this.pendingSnapshot,t)||(this.pendingSnapshot=t,this.publishStatus())}observeRunning(e,t){let n=this.running.get(e),r=this.sessions.list.getSnapshot().phase===`pending`;this.running.set(e,t),t?this.completionUnread.delete(e):(n===!0||n===void 0&&r)&&!this.isMain(e)&&this.completionUnread.add(e),this.publishStatus()}reconcileStatus(){let e=this.sessions.list.getSnapshot(),t=new Set(Object.keys(e.byId));for(let t of e.ids){let n=e.byId[t],r=this.running.get(t);r===void 0?this.running.set(t,n.running):r!==n.running&&this.observeRunning(t,n.running)}for(let e of t)this.isMain(e)&&this.completionUnread.delete(e);if(e.phase===`ready`)for(let e of this.running.keys())t.has(e)||(this.running.delete(e),this.completionUnread.delete(e));this.publishStatus()}isMain(e){return(this.sessions.list.getSnapshot().byId[e]?.retainedBy.mainView??0)>0}publishStatus(){let e=/* @__PURE__ */ new Set([...Object.keys(this.sessions.list.getSnapshot().byId),...this.running.keys(),...this.pendingSnapshot.keys(),...this.completionUnread]),t=/* @__PURE__ */ new Map;for(let n of e)t.set(n,{running:this.running.get(n),pendingInteraction:this.pendingSnapshot.get(n),completionUnread:this.completionUnread.has(n)});T(this.statusSnapshot,t)||(this.statusSnapshot=t,(0,i.notifySubscribers)(this.statusListeners,`[ui-session] Session status`))}createMaterializedBinding(e){let t=this.materialize(e);this.ctx.slots.bindStoreScope(t);let n=_(t),r=e.ctx.effect(()=>()=>{this.bindings.get(e)===a&&this.bindings.delete(e),n.value=this.absent.value,(0,i.notifySubscribers)(n.listeners,`[ui-session] Session binding`),this.publishMain()},`ui-session: binding ${e.sessionId}`),a={owner:e,source:n,release:()=>{r()}};return a}materialize(e){let t={},n={},r={},i=/* @__PURE__ */ new Set;for(let a of this.descriptors){let o=a.resolve(e);v(a,o),b(`hook`,t,a.hooks,o.hooks,i),b(`keyed hook`,n,a.keyedHooks,o.keyedHooks,i),b(`prop`,r,a.props,o.props,i)}return{key:e.sessionId,ctx:e.ctx,hooks:t,keyedHooks:n,props:r}}materializeAbsent(){let e={},t={},n={},r=/* @__PURE__ */ new Set;for(let i of this.descriptors)x(`hook`,e,i.hooks,r),x(`keyed hook`,t,i.keyedHooks,r),x(`prop`,n,i.props,r);return{key:void 0,hooks:e,keyedHooks:t,props:n}}};function _(e){let t={value:e,listeners:/* @__PURE__ */ new Set,getSnapshot:()=>t.value,subscribe:e=>(t.listeners.add(e),()=>{t.listeners.delete(e)})};return t}function v(e,t){y(`hook`,e.hooks,t.hooks),y(`keyed hook`,e.keyedHooks,t.keyedHooks),y(`prop`,e.props,t.props)}function y(e,t,n){for(let r of Object.keys(n??{}))if(!(t??[]).includes(r))throw Error(`uiSession.provide: undeclared ${e} '${r}'`)}function b(e,t,n,r,i){for(let a of n??[]){S(e,a,i);let n=r?.[a];if(n===void 0)throw Error(`uiSession.provide: missing ${e} '${a}'`);t[a]=n}}function x(e,t,n,r){for(let i of n??[])S(e,i,r),t[i]=void 0}function S(e,t,n){let r=e===`prop`?t:(0,a.standardHookPropName)(t);if(n.has(r))throw Error(`uiSession.provide: duplicate ${e} '${t}' at prop '${r}'`);n.add(r)}let C=[`sessions`,`slots`,`remote`];function w(e){let t=new g(e,e.sessions);e.slots.provideRoot({hooks:{sessions:e.sessions.list,sessionStatus:t.sessionStatus},keyedHooks:{sessionRetainInfo:t=>e.sessions.retainInfo(t)}}),e.slots.installScope(`session`,t.adapter)}function T(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e){let e=t.get(n);if(e===void 0||e.running!==r.running||e.pendingInteraction!==r.pendingInteraction||e.completionUnread!==r.completionUnread)return!1}return!0}function E(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}return n.UiSession=g,n.apply=w,n.inject=C,t.exports}});
|