@codexhost/cli-win32-arm64 0.26.0-rc.1 → 0.26.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 +135 -3
- package/app/console-web.js +72 -2
- package/app/desktop-controller.mjs +73 -2
- package/app/host-runtime.mjs +127 -4
- package/app/plugins/antigravity/plugin.mjs +72 -2
- package/app/plugins/claude-code/plugin.mjs +72 -2
- package/app/plugins/codebuddy/plugin.mjs +72 -2
- package/app/plugins/codex-usage/plugin.mjs +72 -2
- package/app/plugins/copilot/plugin.mjs +72 -2
- package/app/plugins/cursor-cli/plugin.mjs +72 -2
- package/app/plugins/deepseek-harness/plugin.mjs +72 -2
- package/app/plugins/devin/plugin.mjs +72 -2
- package/app/plugins/grok/plugin.mjs +72 -2
- package/app/plugins/hermes/plugin.mjs +72 -2
- package/app/plugins/kimi-code/plugin.mjs +72 -2
- package/app/plugins/kiro-cli/plugin.mjs +72 -2
- package/app/plugins/omp/plugin.mjs +72 -2
- package/app/plugins/opencode/plugin.mjs +72 -2
- package/app/plugins/pi/plugin.mjs +72 -2
- package/app/plugins/qoder/plugin.mjs +72 -2
- package/app/plugins/qoder-cn/plugin.mjs +72 -2
- package/app/plugins/qwen-code/plugin.mjs +72 -2
- package/app/plugins/workbuddy/plugin.mjs +72 -2
- package/app/plugins/zcode/plugin.mjs +72 -2
- package/app/renderer-extension.js +72 -2
- package/app/web/assets/index-BDWdtbFT.js +203 -0
- package/app/web/assets/index-jLAmV7OU.css +1 -0
- package/app/web/codexhost-settings.js +34 -34
- package/app/web/index.html +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-api-workspace-controller/client.js +3 -3
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +74 -74
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +91 -91
- package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +9 -9
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-files/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 +129 -8
- package/app/web-modules/server.mjs +60119 -56050
- package/bin/codexhost.exe +0 -0
- package/libexec/codexhost-node-repl.exe +0 -0
- package/libexec/codexhost-shell.exe +0 -0
- package/libexec/codexhost-shim.exe +0 -0
- package/libexec/codexhost-updater.exe +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-Bl_9AU27.js +0 -203
- package/app/web/assets/index-arwoPpaG.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-api-workspace-controller`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-api-gateway/client"),i=e("@deepseek-ai/dsh-client-store"),a=e("@deepseek-ai/cordis");var o=class{remote;canStartProjectless=!1;items=[];archivedSessionIds=[];pinnedSessionIds=[];threadSections=[];state=`loading`;phase=`pending`;error=null;orderRequestGeneration=0;orderFrameGeneration=0;committedOrder=[];archiveRequestSeq=0;pendingArchives=/* @__PURE__ */ new Map;pinRequestSeq=0;removedIds=/* @__PURE__ */ new Set;listeners=/* @__PURE__ */ new Set;snapshotCache;snapshotDirty=!1;notificationPending=!1;notificationScheduled=!1;notificationGeneration=0;constructor(e){this.remote=e,this.snapshotCache=this.buildSnapshot()}async create(e){let t=await this.remote.create(e);return t.ok&&this.upsert(t.value.workspace),t}async initializeDefault(e){let t=await this.remote.initializeDefault(e);return t.ok&&t.value!==void 0&&this.upsert(t.value.workspace),t}async rename(e,t){let n=await this.remote.rename({workspaceId:e,title:t});return n.ok&&this.upsert(n.value.workspace),n}async delete(e){let t=await this.remote.delete({workspaceId:e});return t.ok&&this.remove(e,!0),t}async insertBefore(e,t){let n=++this.orderRequestGeneration,r=this.orderFrameGeneration,i=this.items.map(e=>e.workspaceId);this.installOrder(s(i,e,t));let a=await this.remote.insertBefore({workspaceId:e,...t===void 0?{}:{beforeWorkspaceId:t}});return n===this.orderRequestGeneration&&r===this.orderFrameGeneration&&this.installOrder(a.ok?a.value.workspaceIds:this.committedOrder,a.ok),a}async insertSessionBefore(e,t,n){let r=await this.remote.insertSessionBefore({workspaceId:e,sessionId:t,...n===void 0?{}:{beforeSessionId:n}});return r.ok&&this.upsert(r.value.workspace),r}archiveSession(e,t={}){let n=this.pendingArchives.get(e);if(n!==void 0)return n.promise;this.archiveRequestSeq++;let r={observed:!1,promise:Promise.resolve().then(async()=>{try{let n=await this.remote.archiveSession({sessionId:e,scope:`single`,...t.stopActivity===!0?{stopActivity:!0}:{}});return n.ok&&this.pendingArchives.get(e)===r&&!r.observed&&(this.installArchived([.../* @__PURE__ */ new Set([...this.archivedSessionIds,e])]),this.installPinned(this.pinnedSessionIds.filter(t=>t!==e))),n}finally{this.pendingArchives.get(e)===r&&(this.pendingArchives.delete(e),this.invalidate())}})};return this.pendingArchives.set(e,r),this.invalidate(),r.promise}async unarchiveSession(e){let t=++this.archiveRequestSeq;this.pendingArchives.delete(e),this.invalidate();let n=await this.remote.unarchiveSession({sessionId:e,scope:`single`});return n.ok&&t===this.archiveRequestSeq&&this.installArchived(n.value.archivedSessionIds),n}async pinSession(e){let t=++this.pinRequestSeq,n=await this.remote.pinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}async unpinSession(e){let t=++this.pinRequestSeq,n=await this.remote.unpinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}replaceBaseline(e){this.orderFrameGeneration++,this.archiveRequestSeq++,this.pinRequestSeq++,this.canStartProjectless=e.canStartProjectless===!0,this.installViews(e.items),this.installArchived(e.archivedSessionIds),this.installPinned(e.pinnedSessionIds),this.threadSections=e.threadSections??[],this.state=`idle`,this.phase=`ready`,this.error=null,this.invalidate()}moveSessionToSection(e){return this.remote.moveSessionToSection(e)}upsertView(e){this.upsert(e)}removeView(e){this.remove(e)}replaceOrder(e){this.orderFrameGeneration++,this.installOrder(e,!0)}replaceArchived(e){this.archiveRequestSeq++,this.installArchived(e)}replacePinned(e){this.pinRequestSeq++,this.installPinned(e)}replaceThreadSections(e){this.threadSections=e,this.invalidate()}handleCarrierFailure(){this.state=`loading`,this.error=null,this.invalidate()}handleStreamFailure(e){if(!(0,r.isRemoteFailure)(e))throw e;this.state=`error`,this.error=e,this.invalidate()}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getSnapshot(){return this.refreshSnapshot(),this.snapshotCache}buildSnapshot(){let e=new Set([...this.pendingArchives].filter(([,e])=>!e.observed).map(([e])=>e));return{items:this.items,canStartProjectless:this.canStartProjectless,archivedSessionIds:e.size===0?this.archivedSessionIds:[.../* @__PURE__ */ new Set([...this.archivedSessionIds,...e])],pinnedSessionIds:e.size===0?this.pinnedSessionIds:this.pinnedSessionIds.filter(t=>!e.has(t)),threadSections:this.threadSections,state:this.state,phase:this.phase,error:this.error}}installArchived(e){for(let t of e){let e=this.pendingArchives.get(t);e!==void 0&&(e.observed=!0)}e.length===this.archivedSessionIds.length&&e.every((e,t)=>e===this.archivedSessionIds[t])||(this.archivedSessionIds=[...e],this.invalidate())}installPinned(e){e.length===this.pinnedSessionIds.length&&e.every((e,t)=>e===this.pinnedSessionIds[t])||(this.pinnedSessionIds=[...e],this.invalidate())}installOrder(e,t=!1){t&&(this.committedOrder=[...e]);let n=new Map(e.map((e,t)=>[e,t])),r=[...this.items].sort((e,t)=>(n.get(e.workspaceId)??2**53-1)-(n.get(t.workspaceId)??2**53-1));r.every((e,t)=>e===this.items[t])||(this.items=r,this.invalidate())}upsert(e){if(this.removedIds.has(e.workspaceId))return;let t=this.items.findIndex(t=>t.workspaceId===e.workspaceId),n=this.items[t];n!==void 0&&Date.parse(e.updatedAt)<Date.parse(n.updatedAt)||(this.committedOrder.includes(e.workspaceId)||(this.committedOrder=[e.workspaceId,...this.committedOrder]),this.items=t===-1?[e,...this.items]:this.items.map((n,r)=>r===t?e:n),this.invalidate())}remove(e,t=!1){this.removedIds.add(e),this.committedOrder=this.committedOrder.filter(t=>t!==e);let n=this.items.filter(t=>t.workspaceId!==e);n.length===this.items.length?t&&this.invalidate(!0):(this.items=n,this.invalidate(t))}installViews(e){let t=/* @__PURE__ */ new Map;for(let n of e)this.removedIds.has(n.workspaceId)||t.set(n.workspaceId,n);this.items=[...t.values()],this.committedOrder=e.map(e=>e.workspaceId)}invalidate(e=!1){if(this.snapshotDirty=!0,this.notificationPending=!0,e){this.notificationGeneration++,this.notificationScheduled=!1,this.flush();return}if(this.notificationScheduled)return;this.notificationScheduled=!0;let t=++this.notificationGeneration;queueMicrotask(()=>{t===this.notificationGeneration&&(this.notificationScheduled=!1,this.flush())})}flush(){this.notificationPending&&this.listeners.size!==0&&(this.notificationPending=!1,this.refreshSnapshot(),(0,i.notifySubscribers)(this.listeners,`[workspace-controller]`))}refreshSnapshot(){this.snapshotDirty&&(this.snapshotDirty=!1,this.snapshotCache=this.buildSnapshot())}};function s(e,t,n){if(!e.includes(t)||n!==void 0&&!e.includes(n)||n===t)return[...e];let r=e.filter(e=>e!==t),i=n===void 0?r.length:r.indexOf(n);return[...r.slice(0,i),t,...r.slice(i)]}var c=class extends Error{rpcError;name=`WorkspaceCreateError`;constructor(e){super(`workspace create failed: ${e.code}: ${e.message}`),this.rpcError=e}},l=class extends Error{rpcError;name=`WorkspaceArchiveError`;constructor(e){super(`workspace session archive failed: ${e.code}: ${e.message}`),this.rpcError=e}},u=class extends a.Service{model;list;constructor(e,t){super(e,`workspaces`),this.model=t,this.list=t}async create(e){let t=await this.model.create(e);if(!t.ok)throw new c(t.error);return t.value.workspace}async initializeDefault(e){let t=await this.model.initializeDefault(e);if(!t.ok)throw new c(t.error);return t.value?.workspace}async rename(e,t){let n=await this.model.rename(e,t);if(!n.ok)throw d(`rename`,n.error);return n.value.workspace}async delete(e){let t=await this.model.delete(e);if(!t.ok)throw d(`delete`,t.error)}async insertBefore(e,t){let n=await this.model.insertBefore(e,t);if(!n.ok)throw d(`reorder`,n.error)}async archiveSession(e,t={}){let n=await this.model.archiveSession(e,t);if(!n.ok)throw new l(n.error)}async unarchiveSession(e){let t=await this.model.unarchiveSession(e);if(!t.ok)throw d(`session unarchive`,t.error)}async pinSession(e){let t=await this.model.pinSession(e);if(!t.ok)throw d(`session pin`,t.error)}async moveSessionToSection(e,t){let n=await this.model.moveSessionToSection({sessionId:e,sectionId:t});if(!n.ok)throw d(`move to section`,n.error);if(n.value.sectionId!==t)throw Error(`The requested section change was not confirmed.`)}async unpinSession(e){let t=await this.model.unpinSession(e);if(!t.ok)throw d(`session unpin`,t.error)}async insertSessionBefore(e,t,n){let r=await this.model.insertSessionBefore(e,t,n);if(!r.ok)throw d(`move`,r.error);return r.value.workspace}};function d(e,t){return/* @__PURE__ */ Error(`workspace ${e} failed: ${t.code}: ${t.message}`)}let f=[`remote`,`remote.workspace`];function p(e){let t=new o(e.remote.workspace);new u(e,t);let n=m(e.remote,{accept:t,carrierFailed:()=>{t.handleCarrierFailure()},failed:e=>{t.handleStreamFailure(e)}});n.start(),e.effect(()=>async()=>{await n.dispose()},`workspace-controller.client.control`)}function m(e,t){let n=e.$stream({name:`Workspace state stream`,open:t=>e.workspace.follow(t),ended:e=>e?new r.RemoteStreamCarrierError(`Workspace state stream ended without a terminal result`):/* @__PURE__ */ Error(`Workspace state stream ended before its opening snapshot`),...t.carrierFailed===void 0?{}:{carrierFailed:t.carrierFailed}});return new r.RemoteSnapshotStream(n,{name:`Workspace state stream`,isSnapshot:e=>e.type===`baseline`,replace:e=>{t.accept.replaceBaseline(e.value)},update:e=>{h(t.accept,e)},failed:t.failed})}function h(e,t){switch(t.type){case`upsert`:e.upsertView(t.workspace);return;case`remove`:e.removeView(t.workspaceId);return;case`order`:e.replaceOrder(t.workspaceIds);return;case`archived`:e.replaceArchived(t.archivedSessionIds);return;case`pinned`:e.replacePinned(t.pinnedSessionIds);return;case`threadSections`:e.replaceThreadSections(t.threadSections);return;
|
|
1
|
+
window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-api-workspace-controller`,factory:e=>{var t={exports:{}},n=t.exports;Object.defineProperty(n,Symbol.toStringTag,{value:`Module`});let r=e("@deepseek-ai/dsh-api-gateway/client"),i=e("@deepseek-ai/dsh-client-store"),a=e("@deepseek-ai/cordis");var o=class{remote;canStartProjectless=!1;items=[];archivedSessionIds=[];pinnedSessionIds=[];threadSections=[];state=`loading`;phase=`pending`;error=null;orderRequestGeneration=0;orderFrameGeneration=0;committedOrder=[];archiveRequestSeq=0;pendingArchives=/* @__PURE__ */ new Map;pinRequestSeq=0;removedIds=/* @__PURE__ */ new Set;listeners=/* @__PURE__ */ new Set;snapshotCache;snapshotDirty=!1;notificationPending=!1;notificationScheduled=!1;notificationGeneration=0;constructor(e){this.remote=e,this.snapshotCache=this.buildSnapshot()}async create(e){let t=await this.remote.create(e);return t.ok&&this.upsert(t.value.workspace),t}async initializeDefault(e){let t=await this.remote.initializeDefault(e);return t.ok&&t.value!==void 0&&this.upsert(t.value.workspace),t}async rename(e,t){let n=await this.remote.rename({workspaceId:e,title:t});return n.ok&&this.upsert(n.value.workspace),n}async delete(e){let t=await this.remote.delete({workspaceId:e});return t.ok&&this.remove(e,{immediate:!0,recordRemoved:!0}),t}async insertBefore(e,t){let n=++this.orderRequestGeneration,r=this.orderFrameGeneration,i=this.items.map(e=>e.workspaceId);this.installOrder(c(i,e,t));let a=await this.remote.insertBefore({workspaceId:e,...t===void 0?{}:{beforeWorkspaceId:t}});return n===this.orderRequestGeneration&&r===this.orderFrameGeneration&&this.installOrder(a.ok?a.value.workspaceIds:this.committedOrder,a.ok),a}async insertSessionBefore(e,t,n){let r=await this.remote.insertSessionBefore({workspaceId:e,sessionId:t,...n===void 0?{}:{beforeSessionId:n}});return r.ok&&this.upsert(r.value.workspace),r}archiveSession(e,t={}){let n=this.pendingArchives.get(e);if(n!==void 0)return n.promise;this.archiveRequestSeq++;let r={observed:!1,promise:Promise.resolve().then(async()=>{try{let n=await this.remote.archiveSession({sessionId:e,scope:`single`,...t.stopActivity===!0?{stopActivity:!0}:{}});return n.ok&&this.pendingArchives.get(e)===r&&!r.observed&&(this.installArchived([.../* @__PURE__ */ new Set([...this.archivedSessionIds,e])]),this.installPinned(this.pinnedSessionIds.filter(t=>t!==e))),n}finally{this.pendingArchives.get(e)===r&&(this.pendingArchives.delete(e),this.invalidate())}})};return this.pendingArchives.set(e,r),this.invalidate(),r.promise}async unarchiveSession(e){let t=++this.archiveRequestSeq;this.pendingArchives.delete(e),this.invalidate();let n=await this.remote.unarchiveSession({sessionId:e,scope:`single`});return n.ok&&t===this.archiveRequestSeq&&this.installArchived(n.value.archivedSessionIds),n}async pinSession(e){let t=++this.pinRequestSeq,n=await this.remote.pinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}async unpinSession(e){let t=++this.pinRequestSeq,n=await this.remote.unpinSession({sessionId:e});return n.ok&&t===this.pinRequestSeq&&this.installPinned(n.value.pinnedSessionIds),n}replaceBaseline(e){this.orderFrameGeneration++,this.archiveRequestSeq++,this.pinRequestSeq++,this.canStartProjectless=e.canStartProjectless===!0,this.installViews(e.items),this.installArchived(e.archivedSessionIds),this.installPinned(e.pinnedSessionIds),this.threadSections=e.threadSections??[],this.state=`idle`,this.phase=`ready`,this.error=null,this.invalidate()}moveSessionToSection(e){return this.remote.moveSessionToSection(e)}upsertView(e){this.upsert(e)}removeView(e){this.remove(e)}replaceOrder(e){this.orderFrameGeneration++,this.installOrder(e,!0)}replaceArchived(e){this.archiveRequestSeq++,this.installArchived(e)}replacePinned(e){this.pinRequestSeq++,this.installPinned(e)}replaceThreadSections(e){this.threadSections=e,this.invalidate()}handleCarrierFailure(){this.state=`loading`,this.error=null,this.invalidate()}handleStreamFailure(e){if(!(0,r.isRemoteFailure)(e))throw e;this.state=`error`,this.error=e,this.invalidate()}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}getSnapshot(){return this.refreshSnapshot(),this.snapshotCache}buildSnapshot(){let e=new Set([...this.pendingArchives].filter(([,e])=>!e.observed).map(([e])=>e));return{items:this.items,canStartProjectless:this.canStartProjectless,archivedSessionIds:e.size===0?this.archivedSessionIds:[.../* @__PURE__ */ new Set([...this.archivedSessionIds,...e])],pinnedSessionIds:e.size===0?this.pinnedSessionIds:this.pinnedSessionIds.filter(t=>!e.has(t)),threadSections:this.threadSections,state:this.state,phase:this.phase,error:this.error}}installArchived(e){for(let t of e){let e=this.pendingArchives.get(t);e!==void 0&&(e.observed=!0)}e.length===this.archivedSessionIds.length&&e.every((e,t)=>e===this.archivedSessionIds[t])||(this.archivedSessionIds=[...e],this.invalidate())}installPinned(e){e.length===this.pinnedSessionIds.length&&e.every((e,t)=>e===this.pinnedSessionIds[t])||(this.pinnedSessionIds=[...e],this.invalidate())}installOrder(e,t=!1){t&&(this.committedOrder=[...e]);let n=new Map(e.map((e,t)=>[e,t])),r=[...this.items].sort((e,t)=>(n.get(e.workspaceId)??2**53-1)-(n.get(t.workspaceId)??2**53-1));r.every((e,t)=>e===this.items[t])||(this.items=r,this.invalidate())}upsert(e){if(this.removedIds.has(e.workspaceId))return;let t=this.items.findIndex(t=>t.workspaceId===e.workspaceId),n=this.items[t];n!==void 0&&Date.parse(e.updatedAt)<Date.parse(n.updatedAt)||(this.committedOrder.includes(e.workspaceId)||(this.committedOrder=[e.workspaceId,...this.committedOrder]),this.items=t===-1?[e,...this.items]:this.items.map((n,r)=>r===t?e:n),this.invalidate())}remove(e,t={}){let{immediate:n=!1,recordRemoved:r=!1}=t;r&&!s(e)&&this.removedIds.add(e),this.committedOrder=this.committedOrder.filter(t=>t!==e);let i=this.items.filter(t=>t.workspaceId!==e);i.length===this.items.length?n&&this.invalidate(!0):(this.items=i,this.invalidate(n))}installViews(e){let t=/* @__PURE__ */ new Map;for(let n of e)this.removedIds.has(n.workspaceId)||t.set(n.workspaceId,n);this.items=[...t.values()],this.committedOrder=e.map(e=>e.workspaceId)}invalidate(e=!1){if(this.snapshotDirty=!0,this.notificationPending=!0,e){this.notificationGeneration++,this.notificationScheduled=!1,this.flush();return}if(this.notificationScheduled)return;this.notificationScheduled=!0;let t=++this.notificationGeneration;queueMicrotask(()=>{t===this.notificationGeneration&&(this.notificationScheduled=!1,this.flush())})}flush(){this.notificationPending&&this.listeners.size!==0&&(this.notificationPending=!1,this.refreshSnapshot(),(0,i.notifySubscribers)(this.listeners,`[workspace-controller]`))}refreshSnapshot(){this.snapshotDirty&&(this.snapshotDirty=!1,this.snapshotCache=this.buildSnapshot())}};function s(e){return e.startsWith(`remote-workspace:`)}function c(e,t,n){if(!e.includes(t)||n!==void 0&&!e.includes(n)||n===t)return[...e];let r=e.filter(e=>e!==t),i=n===void 0?r.length:r.indexOf(n);return[...r.slice(0,i),t,...r.slice(i)]}var l=class extends Error{rpcError;name=`WorkspaceCreateError`;constructor(e){super(`workspace create failed: ${e.code}: ${e.message}`),this.rpcError=e}},u=class extends Error{rpcError;name=`WorkspaceArchiveError`;constructor(e){super(`workspace session archive failed: ${e.code}: ${e.message}`),this.rpcError=e}},d=class extends a.Service{model;list;constructor(e,t){super(e,`workspaces`),this.model=t,this.list=t}async create(e){let t=await this.model.create(e);if(!t.ok)throw new l(t.error);return t.value.workspace}async initializeDefault(e){let t=await this.model.initializeDefault(e);if(!t.ok)throw new l(t.error);return t.value?.workspace}async rename(e,t){let n=await this.model.rename(e,t);if(!n.ok)throw f(`rename`,n.error);return n.value.workspace}async delete(e){let t=await this.model.delete(e);if(!t.ok)throw f(`delete`,t.error)}async insertBefore(e,t){let n=await this.model.insertBefore(e,t);if(!n.ok)throw f(`reorder`,n.error)}async archiveSession(e,t={}){let n=await this.model.archiveSession(e,t);if(!n.ok)throw new u(n.error)}async unarchiveSession(e){let t=await this.model.unarchiveSession(e);if(!t.ok)throw f(`session unarchive`,t.error)}async pinSession(e){let t=await this.model.pinSession(e);if(!t.ok)throw f(`session pin`,t.error)}async moveSessionToSection(e,t){let n=await this.model.moveSessionToSection({sessionId:e,sectionId:t});if(!n.ok)throw f(`move to section`,n.error);if(n.value.sectionId!==t)throw Error(`The requested section change was not confirmed.`)}async unpinSession(e){let t=await this.model.unpinSession(e);if(!t.ok)throw f(`session unpin`,t.error)}async insertSessionBefore(e,t,n){let r=await this.model.insertSessionBefore(e,t,n);if(!r.ok)throw f(`move`,r.error);return r.value.workspace}};function f(e,t){return/* @__PURE__ */ Error(`workspace ${e} failed: ${t.code}: ${t.message}`)}let p=[`remote`,`remote.workspace`];function m(e){let t=new o(e.remote.workspace);new d(e,t);let n=h(e.remote,{accept:t,carrierFailed:()=>{t.handleCarrierFailure()},failed:e=>{t.handleStreamFailure(e)}});n.start(),e.effect(()=>async()=>{await n.dispose()},`workspace-controller.client.control`)}function h(e,t){let n=e.$stream({name:`Workspace state stream`,open:t=>e.workspace.follow(t),ended:e=>e?new r.RemoteStreamCarrierError(`Workspace state stream ended without a terminal result`):/* @__PURE__ */ Error(`Workspace state stream ended before its opening snapshot`),...t.carrierFailed===void 0?{}:{carrierFailed:t.carrierFailed}});return new r.RemoteSnapshotStream(n,{name:`Workspace state stream`,isSnapshot:e=>e.type===`baseline`,replace:e=>{t.accept.replaceBaseline(e.value)},update:e=>{g(t.accept,e)},failed:t.failed})}function g(e,t){switch(t.type){case`upsert`:e.upsertView(t.workspace);return;case`remove`:e.removeView(t.workspaceId);return;case`order`:e.replaceOrder(t.workspaceIds);return;case`archived`:e.replaceArchived(t.archivedSessionIds);return;case`pinned`:e.replacePinned(t.pinnedSessionIds);return;case`threadSections`:e.replaceThreadSections(t.threadSections);return;
|
|
2
2
|
/* v8 ignore next -- the generated Remote codec validates this closed union */
|
|
3
|
-
default:return
|
|
3
|
+
default:return _(t)}}
|
|
4
4
|
/* v8 ignore next 3 -- closed-union backstop after generated Remote validation */
|
|
5
|
-
function
|
|
5
|
+
function _(e){throw Error(`unreachable Workspace increment: ${JSON.stringify(e)}`)}return n.ClientWorkspaceModel=o,n.WorkspaceArchiveError=u,n.WorkspaceController=d,n.WorkspaceCreateError=l,n.apply=m,n.createWorkspaceStateStream=h,n.inject=p,t.exports}});
|