@x-otto/session 0.0.1-alpha.4 → 0.0.1-alpha.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/in-memory-session.ts","../src/message-bytes.ts","../src/store.ts","../src/memory-persistence.ts","../src/file-persistence.ts","../src/session-repository.ts","../src/session-write-lease.ts","../src/relational-session-persistence.ts","../src/relational-bridge.ts","../src/replacement-blob-codec.ts","../src/replacement-hydrator.ts","../src/constants.ts","../src/sqlite-session-repository.ts","../src/remote-persistence.ts"],"mappings":";;;KAIY,YAAA;EACN,IAAA;EAAiB,EAAA;EAAY,QAAA;EAAmB,OAAA,EAAS,CAAA;EAAG,SAAA;AAAA;EAE5D,IAAA;EACA,EAAA;EACA,QAAA;EACA,OAAA;EACA,cAAA;EAJA;;;;;;EAWA,WAAA,GAAc,CAAA;EAOd;;;;;;EAAA,mBAAA;EACA,SAAA;AAAA;;;;;;;;EAQA,IAAA;EAAe,EAAA;EAAY,QAAA;EAAmB,SAAA;AAAA;AAAA,UAEnC,cAAA;EACf,OAAA;EACA,QAAA,EAAU,CAAA;AAAA;;;;;;UAQK,sBAAA;EACf,WAAA;EAkCA;;;;;;;AA+BF;;;;;EApDE,QAAA;EACA,KAAA;EACA,SAAA;EACA,aAAA;EACA,qBAAA;EACA,SAAA;EA0DuB;EAxDvB,OAAA;EAwDuB;;;;EAnDvB,YAAA;EAuDI;EArDJ,YAAA;EA4De;;;;;;EArDf,UAAA;EAyDA;;;;;EAnDA,qBAAA;EA6De;;;;EAxDf,eAAA;EA2DA;;;;;;AAeF;EAlEE,YAAA;;;;;;EAMA,SAAA;AAAA;;;;UAMe,UAAA;EACf,EAAA;EACA,IAAA;EACA,IAAA;EACA,OAAA;AAAA;;;;;UAOe,QAAA;EACf,EAAA;EACA,KAAA;EACA,MAAA;EACA,IAAA;AAAA;;;;;UAOe,UAAA;EAC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BAAA,CAAkB,SAAA,UAAmB,SAAA,UAAmB,KAAA,WAAgB,OAAA,CAAQ,QAAA;EAgBhF,kBAAA,CAAmB,SAAA,UAAmB,IAAA,WAAe,OAAA;EAOrD,QAAA,CAAS,KAAA,EAAO,aAAA;IAAgB,IAAA;IAAc,OAAA;EAAA,KAAqB,OAAA;EAYnE,QAAA,CAAS,MAAA,sBAA4B,OAAA,CAAQ,GAAA;EAW7C,gBAAA,CAAiB,SAAA,UAAmB,QAAA,sBAA8B,OAAA,CAAQ,QAAA;Eb7bzD;;;;;EAAA,Qaidd,YAAA;AAAA;;;UCtkBM,+BAAA;EACf,OAAA;EACA,OAAA,QAAe,OAAA;IAAU,KAAA;EAAA;EACzB,UAAA,SAAmB,OAAA,CAAQ,MAAA;EAC3B,KAAA,SAAc,UAAA,CAAW,KAAA;EACzB,SAAA;EdNoD;EcQpD,MAAA;EdRgE;;;;;;;;;;EcmBhE,KAAA;AAAA;AAAA,cAGW,wBAAA,sBACH,iBAAA,CAAkB,eAAA,CAAgB,CAAA,cAC/B,kBAAA,CAAmB,CAAA;EdKoB;;;AAEpD;;EAFoD,ScEzC,SAAA;cAEG,OAAA,EAAS,+BAAA;EAAA,cAkBE,YAAA,CAAA;EAAA,cAGA,YAAA,CAAA;EAAA,UAIJ,SAAA,CAAU,QAAA,EAAU,eAAA,CAAgB,CAAA;EdzB7C;;;AAQZ;;;Ec2BQ,cAAA,CAAe,KAAA,WAAgB,OAAA;AAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/in-memory-session.ts","../src/residency-policy.ts","../src/message-bytes.ts","../src/store.ts","../src/memory-persistence.ts","../src/session-repository.ts","../src/session-write-lease.ts","../src/relational-session-persistence.ts","../src/relational-bridge.ts","../src/replacement-blob-codec.ts","../src/replacement-hydrator.ts","../src/constants.ts","../src/sqlite-session-repository.ts","../src/session-archive-store.ts","../src/remote-persistence.ts"],"mappings":";;;KAIY,YAAA;EACN,IAAA;EAAiB,EA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UAAmB,KAAA,EAAO,UAAA,GAAa,OAAA;EdlB/C;EcoBJ,WAAA,CAAY,SAAA,UAAmB,QAAA;AAAA;;;;;cAOpB,mBAAA;EAAA,iBACM,UAAA;EAAA,iBACA,SAAA;EAAA,iBACA,IAAA;cAEL,OAAA,EAAS,uBAAA;EAAA,QAMb,WAAA;EdlBJ;;;EcyBE,cAAA,CAAe,SAAA,WAAoB,OAAA;EdhBV;;;Ec2CzB,sBAAA,CAAuB,SAAA,WAAoB,OAAA;AAAA;;;UCzElC,+BAAA;EACf,OAAA;EACA,OAAA,QAAe,OAAA;IAAU,KAAA;EAAA;EACzB,UAAA,SAAmB,OAAA,CAAQ,MAAA;EAC3B,KAAA,SAAc,UAAA,CAAW,KAAA;EACzB,SAAA;EfJiC;EeMjC,MAAA;EfN6D;;;;;;;;;;EeiB7D,KAAA;AAAA;AAAA,cAGW,wBAAA,sBACH,iBAAA,CAAkB,eAAA,CAAgB,CAAA,cAC/B,kBAAA,CAAmB,CAAA;EfOC;;;;;EAAA,SeAtB,SAAA;cAEG,OAAA,EAAS,+BAAA;EAAA,cAkBE,YAAA,CAAA;EAAA,cAGA,YAAA,CAAA;EAAA,UAIJ,SAAA,CAAU,QAAA,EAAU,eAAA,CAAgB,CAAA;EfPxC;;;;;;EeiBT,cAAA,CAAe,KAAA,WAAgB,OAAA;AAAA"}
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
- import{DiskPersistence as e,MemoryPersistenceBase as t,RemotePersistence as n,RemotePersistenceError as r,RemoteSnapshotConflictError as i,acquireDb as a,paginate as o,releaseDb as s}from"@x-otto/persistence";import{currentHostname as c,decodeLeaseToken as l,encodeLeaseToken as u,isProcessAlive as d,normalizeEnv as f}from"@x-otto/env";import{readFile as p,readdir as m,stat as h}from"node:fs/promises";import{dirname as g,join as _,resolve as v}from"node:path";import{createHash as y,randomUUID as b}from"node:crypto";import{closeSync as ee,createWriteStream as x,existsSync as S,mkdirSync as C,openSync as w,readFileSync as T,renameSync as te,rmSync as ne,statSync as E,unlinkSync as D,utimesSync as O,writeSync as k}from"node:fs";import{createGzip as A,gunzipSync as j}from"node:zlib";const M={derived:0,ai:1,custom:2};function N(e){if(typeof e!=`object`||!e)return 0;let t=e,n=0,r=t.tool_calls;if(Array.isArray(r))for(let e of r){if(typeof e!=`object`||!e)continue;let t=e.function;t&&typeof t==`object`&&typeof t.arguments==`string`&&(n+=t.arguments.length)}let i=t.content;if(typeof i==`string`)return n+i.length;if(!Array.isArray(i))return n;for(let e of i){if(typeof e!=`object`||!e)continue;let t=e;typeof t.text==`string`&&(n+=t.text.length);let r=t.source;r&&typeof r==`object`&&typeof r.data==`string`&&(n+=r.data.length),typeof t.data==`string`&&(n+=t.data.length);let i=t.image_url;i&&typeof i==`object`&&typeof i.url==`string`&&(n+=i.url.length),t.type===`tool_call`&&typeof t.arguments==`object`&&t.arguments!=null&&(n+=JSON.stringify(t.arguments).length),t.type===`tool_use`&&t.input!=null&&(n+=JSON.stringify(t.input).length)}return n}var P=class{sessionEntries=[];entryMap=new Map;_estimatedContentBytes=0;get estimatedContentBytes(){return this._estimatedContentBytes}get messageCount(){return this.meta.messageCount}verifyEstimatedContentBytes(){let e=0;for(let t of this.sessionEntries)if(t.type===`message`)e+=N(t.message);else if(t.type===`compaction`&&t.replacement)for(let n of t.replacement)e+=N(n);return{counter:this._estimatedContentBytes,recomputed:e,drift:e-this._estimatedContentBytes}}meta;panelState={};constructor(e,t,n){this.id=e;let r=Date.now();this.meta={createdAt:r,lastActiveAt:r,messageCount:0,compactionCount:0,parentSessionId:t,forkPoint:n,tags:[]}}_leafId=void 0;get leafId(){return this._leafId}markActivity(){this.meta.lastActiveAt=Date.now()}append(e){let t={type:`message`,id:crypto.randomUUID(),parentId:this._leafId,message:e,timestamp:Date.now()};this._leafId=t.id,this.sessionEntries.push(t),this.entryMap.set(t.id,t),this.meta.messageCount++,this.markActivity(),this._estimatedContentBytes+=N(e)}removeLast(){if(!this._leafId)return;let e=this.entryMap.get(this._leafId);if(!e||e.type!==`message`)return;let t=this.sessionEntries.lastIndexOf(e);t!==-1&&(this.sessionEntries.splice(t,1),this.entryMap.delete(e.id),this._leafId=e.parentId,this.meta.messageCount=Math.max(0,this.meta.messageCount-1),this._estimatedContentBytes-=N(e.message))}compact(e,t){let n=this.getBranchMessageEntries();if(t<=0||t>n.length)return;let r={type:`compaction`,id:crypto.randomUUID(),parentId:this._leafId,summary:e,compactedCount:t,timestamp:Date.now()};this.sessionEntries.push(r),this.entryMap.set(r.id,r),this.meta.compactionCount++,this.markActivity(),this._leafId=r.id}recordCompaction(e,t){let n=this.findActiveCompaction(),r={type:`compaction`,id:crypto.randomUUID(),parentId:this._leafId,summary:e,compactedCount:t.length,replacement:[...t],timestamp:Date.now()};for(let e of t)this._estimatedContentBytes+=N(e);this.sessionEntries.push(r),this.entryMap.set(r.id,r),this.meta.compactionCount++,this.markActivity(),this._leafId=r.id,n&&n.replacement!=null&&this.replacementStripEligibility?.(n.id)===!0&&this.stripReplacementInPlace(n.id)}replacementStripEligibility;setReplacementStripEligibility(e){this.replacementStripEligibility=e}findActiveCompaction(){return this._leafId?this.findActiveCompactionFrom(this._leafId):void 0}stripReplacementInPlace(e){let t=this.entryMap.get(e);if(!t||t.type!==`compaction`)return;let n=t;if(n.replacement==null)return;for(let e of n.replacement)this._estimatedContentBytes-=N(e);this._estimatedContentBytes<0&&(this._estimatedContentBytes=0);let{replacement:r,...i}=n,a={...i,replacementStripped:!0};this.entryMap.set(e,a);let o=this.sessionEntries.findIndex(t=>t.id===e);o>=0&&(this.sessionEntries[o]=a)}clearContext(e){let t={type:`clear`,id:crypto.randomUUID(),parentId:this._leafId,timestamp:Date.now()};this.sessionEntries.push(t),this.entryMap.set(t.id,t),this.markActivity(),this._leafId=t.id,e?.purge===!0&&this.purgeBeforeBoundary(t.id)}purgeClearedHistory(){let e;for(let t=this.sessionEntries.length-1;t>=0;t--)if(this.sessionEntries[t].type===`clear`){e=this.sessionEntries[t].id;break}return e?this.purgeBeforeBoundary(e):{removedCount:0,strippedReplacements:0}}purgeBeforeBoundary(e){let t=this.sessionEntries.findIndex(t=>t.id===e);if(t<0)return{removedCount:0,strippedReplacements:0};let n=0,r=0,i=0,a=t;for(;r<a;){let e=this.sessionEntries[r];e.type===`message`?(this._estimatedContentBytes-=N(e.message),this.entryMap.delete(e.id),this.sessionEntries.splice(r,1),a--,i++):(e.type===`compaction`&&e.replacement!=null&&(this.stripReplacementInPlace(e.id),n++),r++)}return this._estimatedContentBytes<0&&(this._estimatedContentBytes=0),this.meta.messageCount-=i,{removedCount:i,strippedReplacements:n}}branch(e){if(!this.entryMap.has(e))throw Error(`Entry "${e}" not found in session "${this.id}"`);let t=this.findActiveCompactionFrom(e);if(t&&t.replacementStripped)throw Error(`branch: target chain's active compaction boundary "${t.id}" has a stripped replacement (RFC-160); hydrate it via loadEntriesByIds before branching`);this._leafId=e,this.markActivity()}findActiveCompactionFrom(e){let t=new Set,n=this.entryMap.get(e);for(;n&&!t.has(n.id);){if(t.add(n.id),n.type===`compaction`)return n;if(n.type===`clear`)return;n=n.parentId?this.entryMap.get(n.parentId):void 0}}entries(){return this.sessionEntries}branchEntries(){return this.walkBranch()}buildContext(){let e=this.walkBranch(),t=this.lastBoundaryIndex(e),n=e.slice(t+1).filter(e=>e.type===`message`).map(e=>e.message);if(t===-1)return{messages:n};let r=e[t];if(r.type===`clear`)return{messages:n};let i=r;return{summary:i.summary,messages:i.replacement?[...i.replacement,...n]:n}}messages(){return this.walkBranch().filter(e=>e.type===`message`).map(e=>e.message)}visibleMessages(){let e=this.walkBranch(),t=-1;for(let n=e.length-1;n>=0;n--)if(e[n]?.type===`clear`){t=n;break}return e.slice(t+1).filter(e=>e.type===`message`).map(e=>e.message)}metadata(){return{...this.meta,tags:[...this.meta.tags],...this.meta.config?{config:structuredClone(this.meta.config)}:{}}}setTitle(e,t){let n=this.meta.titleSource==null?-1:M[this.meta.titleSource];return M[t]<n?!1:(this.meta.title=e,this.meta.titleSource=t,!0)}setSdkVersion(e){this.meta.sdkVersion=e}setArchived(e){this.meta.archived=e}setPinned(e,t){this.meta.pinned=e,this.meta.pinGroup=e?t:void 0}touchIfActivity(e){e?.touch!==!1&&this.markActivity()}getTodoList(){return this.panelState.todoList}setTodoList(e,t){this.panelState.todoList=[...e],this.touchIfActivity(t)}getEditedFiles(){return this.panelState.editedFiles}setEditedFiles(e,t){this.panelState.editedFiles=e.slice(0,50),this.touchIfActivity(t)}getInputHistory(){return this.meta.config?.inputHistory}setInputHistory(e){if(e.length===0){this.meta.config?.inputHistory!==void 0&&delete this.meta.config.inputHistory;return}this.meta.config||(this.meta.config={}),this.meta.config.inputHistory=e.slice(-100)}getSubagents(){return this.panelState.subagents}setSubagents(e,t){this.panelState.subagents=e.slice(0,100),this.touchIfActivity(t)}getTurnSummaries(){return this.panelState.turnSummaries}setTurnSummaries(e,t){this.panelState.turnSummaries=e.slice(-200),this.touchIfActivity(t)}getTurnCount(){return this.meta.config?.turnCount}setTurnCount(e){this.meta.config||(this.meta.config={}),this.meta.config.turnCount=e}getDrafts(){return this.panelState.drafts}setDrafts(e,t){this.panelState.drafts=e.slice(0,50),this.touchIfActivity(t)}capStoredHistory(e,t){let n=0;for(let e of this.sessionEntries)e.type===`message`&&n++;if(n<=e)return{capped:!1,removedCount:0,boundaryLimited:!1,activeOversized:!1};let r=n-e,{removed:i,boundaryLimited:a}=this.removeOldestMessages(r,t);return this.meta.messageCount=n-i,{capped:i>0,removedCount:i,boundaryLimited:a,activeOversized:this.meta.messageCount>e}}wouldTrimTouchActiveContext(e){let t=this.meta.messageCount;if(t<=e)return!1;let n=t-e,r=this.findActiveCompaction()?.id;if(r===void 0)return!0;let i=0;for(let e of this.sessionEntries){if(e.id===r)break;e.type===`message`&&i++}return i<n}wouldByteTrimTouchActiveContext(e){if(e<=0||this._estimatedContentBytes<=e)return!1;let t=this.findActiveCompaction()?.id;if(t===void 0)return!0;let n=0;for(let e of this.sessionEntries){if(e.id===t)break;e.type===`message`&&(n+=N(e.message))}return this._estimatedContentBytes-n>e}capStoredHistoryByBytes(e,t){if(e<=0||this._estimatedContentBytes<=e)return{capped:!1,removedCount:0,boundaryLimited:!1,activeOversized:!1};let n=0;for(let e of this.sessionEntries)e.type===`message`&&n++;let r=this._estimatedContentBytes,i=0;for(let t of this.sessionEntries){if(r<=e||i>=n-1)break;t.type===`message`&&(r-=N(t.message),i++)}if(i===0)return{capped:!1,removedCount:0,boundaryLimited:!1,activeOversized:!1};let{removed:a,boundaryLimited:o}=this.removeOldestMessages(i,t);return this.meta.messageCount=n-a,{capped:a>0,removedCount:a,boundaryLimited:o,activeOversized:this._estimatedContentBytes>e}}removeOldestMessages(e,t){let n=this.findActiveCompaction()?.id,r=!1,i=0,a=0;for(;a<this.sessionEntries.length&&i<e;){let e=this.sessionEntries[a];if(n!==void 0&&e.id===n){r=!0;break}e.type===`message`?(this._estimatedContentBytes-=N(e.message),this.entryMap.delete(e.id),this.sessionEntries.splice(a,1),i++):a++}if(t)for(;a<this.sessionEntries.length;){let e=this.sessionEntries[a];if(n!==void 0&&e.id===n){r=!0;break}if(e.type!==`message`){a++;continue}if(t(e.message))break;this._estimatedContentBytes-=N(e.message),this.entryMap.delete(e.id),this.sessionEntries.splice(a,1),i++}return this._estimatedContentBytes<0&&(this._estimatedContentBytes=0),{removed:i,boundaryLimited:r}}setTags(e){this.meta.tags=[...e]}addTag(e){this.meta.tags.includes(e)||this.meta.tags.push(e)}restoreEntries(e,t,n){this.sessionEntries.length=0,this.entryMap.clear();let r=0;for(let t of e)if(this.sessionEntries.push(t),this.entryMap.set(t.id,t),t.type===`message`)r+=N(t.message);else if(t.type===`compaction`&&t.replacement)for(let e of t.replacement)r+=N(e);this._estimatedContentBytes=r,Object.assign(this.meta,t),this._leafId=n&&this.entryMap.has(n)?n:e.length>0?e[e.length-1]?.id:void 0}toSnapshot(){return{entries:[...this.sessionEntries],metadata:this.metadata(),leafId:this._leafId}}walkBranch(){if(!this._leafId)return[];let e=[],t=new Set,n=this.entryMap.get(this._leafId);for(;n&&!t.has(n.id);)t.add(n.id),e.push(n),n=n.parentId?this.entryMap.get(n.parentId):void 0;return e.reverse(),e}getBranchMessageEntries(){let e=this.walkBranch(),t=this.lastBoundaryIndex(e);return e.slice(t+1).filter(e=>e.type===`message`)}lastBoundaryIndex(e){for(let t=e.length-1;t>=0;t--){let n=e[t]?.type;if(n===`compaction`||n===`clear`)return t}return-1}},F=class{sessions=new Map;async createSession(e=crypto.randomUUID()){let t=new P(e);return this.sessions.set(e,t),t}getSession(e){return this.sessions.get(e)}listSessions(){return Array.from(this.sessions.values())}listSessionsPaginated(e){let{page:t,sortBy:n=`lastActiveAt`,order:r=`desc`}=e,i=e.pageSize??50,a=Array.from(this.sessions.values());return a.sort((e,t)=>{let i=e.metadata(),a=t.metadata(),o=n===`createdAt`?i.createdAt:i.lastActiveAt,s=n===`createdAt`?a.createdAt:a.lastActiveAt;return r===`asc`?o-s:s-o}),o(a,{page:t,pageSize:i})}async deleteSession(e){return this.sessions.delete(e)}async forkSession(e,t=crypto.randomUUID()){let n=this.sessions.get(e);if(!n)return;let r=n.toSnapshot(),i=new P(t,e,r.entries.length);return i.restoreEntries([...r.entries],{...r.metadata,createdAt:Date.now(),lastActiveAt:Date.now(),parentSessionId:e,forkPoint:r.entries.length,tags:[...r.metadata.tags,`fork`]},r.leafId),this.sessions.set(t,i),i}};function re(){return new F}const ie=f(process.env.OTTO_SESSION_IDLE_TIMEOUT_MS,1800*1e3),ae=f(process.env.OTTO_SESSION_MAX,50),I=f(process.env.OTTO_SESSION_PAGE_SIZE,20),oe=f(process.env.OTTO_SESSION_SNAPSHOT_VERSION,1);var se=class extends t{constructor(){super({defaultPageSize:I,defaultSortBy:`lastActiveAt`})}extractId(e){return e.id}getSortValue(e,t){return t===`createdAt`?e.metadata.createdAt:e.metadata.lastActiveAt}async listRecentMeta(e){return this.entries().filter(([,e])=>!e.metadata.archived).sort(([,e],[,t])=>t.metadata.lastActiveAt-e.metadata.lastActiveAt).slice(0,e).map(([e])=>e)}},ce=class extends e{turnFlush=`snapshot`;sessionBaseDir;sessionExtension=`.session.json`;constructor(e){super({baseDir:e.baseDir,extension:`.session.json`,defaultPageSize:I}),this.sessionBaseDir=e.baseDir}extractId(e){return e.id}async listRecentMeta(e){let t;try{t=await m(this.sessionBaseDir)}catch{return[]}let n=t.filter(e=>e.endsWith(this.sessionExtension)),r=await Promise.all(n.map(async e=>{let t=await h(_(this.sessionBaseDir,e)).catch(()=>null);return{id:decodeURIComponent(e.slice(0,-this.sessionExtension.length)),mtime:t?.mtimeMs??0}}));r.sort((e,t)=>t.mtime-e.mtime);let i=[];for(let{id:t}of r){if(i.length>=e)break;let n=await this.load(t).catch(()=>null);n&&(n.metadata.archived||i.push(t))}return i}};function L(e){return`sha256:${y(`sha256`).update(e,`utf-8`).digest(`hex`)}`}async function R(e,t,n){if(e!==`compaction`)return t;let r=t.replacement;if(!Array.isArray(r))return t;let i=r.map(e=>JSON.stringify(e)),a=i.map(L);await n.putBlobs(i.map((e,t)=>({hash:a[t],content:e})));let{replacement:o,...s}=t;return{...s,replacementHashes:a}}async function z(e,t,n){if(e!==`compaction`)return t;let r=t.replacementHashes;if(!Array.isArray(r)||r.length===0){if(Array.isArray(r)){let{replacementHashes:e,...n}=t;return{...n,replacement:[]}}return t}let i=await n.getBlobs(r),a=r.map(e=>{let t=i.get(e);if(t==null)throw Error(`decodeReplacementFromBlobs: blob ${e} missing from message_blobs (corrupted import/partial backup?); refusing to assemble a lossy replacement (RFC-160 D7)`);return JSON.parse(t)}),{replacementHashes:o,...s}=t;return{...s,replacement:a}}function B(e,t){let n=e.metadata;return{id:e.id,workspaceKey:t,...n.title==null?{}:{title:n.title},...n.titleSource==null?{}:{titleSource:n.titleSource},...n.parentSessionId==null?{}:{parentSessionId:n.parentSessionId},...n.forkPoint==null?{}:{forkPoint:n.forkPoint},...e.leafId==null?{}:{leafId:e.leafId},tags:n.tags??[],...n.config==null?{}:{config:n.config},createdAt:n.createdAt,lastActiveAt:n.lastActiveAt,...n.archived==null?{}:{archived:n.archived},...n.pinned==null?{}:{pinned:n.pinned},...n.pinGroup==null?{}:{pinGroup:n.pinGroup}}}function V(e){let{type:t,id:n,parentId:r,timestamp:i,...a}=e;return{entryId:n,...r==null?{}:{parentId:r},type:t,data:a,createdAt:i}}function H(e){return{type:e.type,id:e.entryId,...e.parentId==null?{}:{parentId:e.parentId},timestamp:e.createdAt,...e.data}}async function U(e,t,n){await n.createSession(B(e,t));for(let t of e.entries)await n.appendEntry(e.id,V(t));await n.touchSession(e.id,e.leafId,e.metadata.lastActiveAt,e.metadata.title,e.metadata.titleSource,e.metadata.config,e.metadata.archived,e.metadata.pinned,e.metadata.pinGroup)}async function W(e,t,n){let r=await t.getSession(e);if(!r)return null;let i,a=!1;n?.maxEntries==null?i=(await t.loadEntries(e)).map(e=>H(e)):await t.getEntryCount(e)>n.maxEntries?(i=(await t.loadTailEntries(e,n.maxEntries)).map(e=>H(e)),a=!0,n.canStartHistory&&(i=ue(i,n.canStartHistory))):i=(await t.loadEntries(e)).map(e=>H(e)),n?.stripInactiveReplacements?(i=le(i,r.leafId??void 0),i=await G(i,t,{onlyUnstripped:!0})):i=await G(i,t,{onlyUnstripped:!1});let o=a?await t.countEntriesByType(e,`message`):i.filter(e=>e.type===`message`).length,s=a?await t.countEntriesByType(e,`compaction`):i.filter(e=>e.type===`compaction`).length,c={createdAt:r.createdAt,lastActiveAt:r.lastActiveAt,messageCount:o,compactionCount:s,tags:r.tags,...r.title==null?{}:{title:r.title},...r.titleSource==null?{}:{titleSource:r.titleSource},...r.parentSessionId==null?{}:{parentSessionId:r.parentSessionId},...r.forkPoint==null?{}:{forkPoint:r.forkPoint},...r.config==null?{}:{config:r.config},...r.archived==null?{}:{archived:r.archived},...r.pinned==null?{}:{pinned:r.pinned},...r.pinGroup==null?{}:{pinGroup:r.pinGroup}};return{version:1,id:e,entries:i,metadata:c,...r.leafId==null?{}:{leafId:r.leafId}}}async function G(e,t,n){let r=[];for(let i of e){let e=i;if(e.type!==`compaction`||e.replacementHashes==null){r.push(i);continue}if(n.onlyUnstripped&&e.replacementStripped){let{replacementHashes:t,...n}=e;r.push(n);continue}let{replacementStripped:a,...o}=await z(`compaction`,e,t);r.push(o)}return r}function le(e,t){let n=new Map;for(let t of e)n.set(t.id,t);let r,i=new Set,a=t?n.get(t):void 0;for(;a&&!i.has(a.id);){if(i.add(a.id),a.type===`compaction`){r=a.id;break}if(a.type===`clear`)break;a=a.parentId?n.get(a.parentId):void 0}let o=-1;for(let t=e.length-1;t>=0;t--)if(e[t].type===`compaction`){o=t;break}return e.map((e,t)=>{if(e.type!==`compaction`||e.id===r||t===o)return e;let n=e;if(n.replacement!=null){let{replacement:e,...t}=n;return{...t,replacementStripped:!0}}return n.replacementHashes==null?e:{...n,replacementStripped:!0}})}function ue(e,t){let n=0;for(;n<e.length;){let r=e[n];if(r.type!==`message`||t(r.message))break;n++}return n>0?e.slice(n):e}function de(e){return typeof e?.hydrateReplacements==`function`}function fe(e){return e.some(e=>e.type===`compaction`&&e.replacementStripped)}async function K(e,t,n){let r=t.filter(e=>e.type===`compaction`&&e.replacementStripped).map(e=>e.id);if(r.length===0)return[...t];let i=await n.loadEntriesByIds(e,r),a=new Map;for(let e of i)a.set(e.entryId,e.data);let o=[];for(let r of t){if(r.type!==`compaction`||!r.replacementStripped){o.push(r);continue}let t=a.get(r.id);if(t&&t.replacementHashes!=null&&(t=await z(`compaction`,t,n)),!t||t.replacement==null)throw Error(`hydrateStrippedReplacements: authoritative row for compaction "${r.id}" in session "${e}" is missing or has no replacement (corrupted import?); refusing to continue with stripped state (RFC-160 rule 3)`);let{replacementStripped:i,...s}=r;o.push({...s,replacement:t.replacement})}return o}var q=class extends Error{constructor(e){super(`Session write lease denied for ${e}: another live process owns the write lease (this process is read-only for the session; refusing to save — RFC-159 D3)`),this.sessionId=e,this.name=`SessionWriteLeaseDeniedError`}};function pe(e){let t=e.staleMs??6e4,n=e.renewEveryMs??1e4,r=new Map,i=!1,a=c(),o=t=>_(e.lockDir,`${t}.lock`),s=e=>{try{return l(T(o(e),`utf-8`).trim())}catch{return null}},f=e=>s(e)?.token??null,p=(t,n)=>{try{C(e.lockDir,{recursive:!0});let r=w(o(t),`wx`);try{k(r,u(n,process.pid,a))}finally{ee(r)}return!0}catch(e){if(e.code!==`EEXIST`)throw e;return!1}},m=e=>e.pid===void 0||e.host===void 0||e.host!==a?!1:!d(e.pid),h=e=>e.pid===void 0||e.host===void 0||e.host!==a?!1:d(e.pid),g=(e,t)=>{let i=setInterval(()=>{if(f(e)!==t){v(e);return}try{let t=new Date;O(o(e),t,t)}catch{v(e)}},n);i.unref(),r.set(e,{token:t,timer:i})},v=e=>{let t=r.get(e);t&&(clearInterval(t.timer),r.delete(e))},y={acquire(e){if(i)return!1;let n=r.get(e);if(n){if(f(e)===n.token)return!0;v(e)}let a=b();if(p(e,a))return g(e,a),!0;let c=s(e),l;try{l=E(o(e)).mtimeMs}catch{return p(e,a)?(g(e,a),!0):!1}if(c!==null&&h(c)||!(c!==null&&m(c))&&Date.now()-l<=t)return!1;let u=`${o(e)}.stale-${b()}`;try{te(o(e),u),ne(u,{force:!0})}catch{return!1}return p(e,a)?(g(e,a),!0):!1},release(e){let t=r.get(e);if(t){if(f(e)===t.token)try{D(o(e))}catch{}v(e)}},releaseAll(){for(let e of[...r.keys()])y.release(e)},isOwner(e){if(i)return!1;let t=r.get(e);return t!=null&&f(e)===t.token},peekLockedByOther(e){if(i)return!1;let n=r.get(e);if(n!=null&&f(e)===n.token)return!1;let a;try{a=E(o(e)).mtimeMs}catch{return!1}return Date.now()-a<=t},inspect(e){let t=s(e);if(t===null)return{locked:!1};let n;try{n=Date.now()-E(o(e)).mtimeMs}catch{return{locked:!1}}let r=t.pid!==void 0&&t.host!==void 0&&t.host===a?d(t.pid):void 0;return{locked:!0,pid:t.pid,hostname:t.host,alive:r,mtimeAgoMs:n}},forceRelease(e){try{D(o(e))}catch{}v(e)},close(){i=!0,y.releaseAll()}};return e.installExitHook!==!1&&process.on(`exit`,()=>y.releaseAll()),y}function me(){return{acquire:()=>!0,release:()=>{},releaseAll:()=>{},isOwner:()=>!0,peekLockedByOther:()=>!1,inspect:()=>({locked:!1}),forceRelease:()=>{},close:()=>{}}}const he={warn:()=>{}};var ge=class{repo;resolveWorkspaceKey;defaultPageSize;logger;persisted=new Map;maxLoadEntries;canStartHistory;writeLease;stripInactiveReplacements;constructor(e){this.repo=e.repo;let t=e.workspaceKey;this.resolveWorkspaceKey=typeof t==`function`?()=>t()||`default`:()=>t||`default`,this.defaultPageSize=e.defaultPageSize??20,this.logger=e.logger??he,this.maxLoadEntries=e.maxLoadEntries,this.canStartHistory=e.canStartHistory,this.writeLease=e.writeLease,this.stripInactiveReplacements=e.stripInactiveReplacements??!1}assertWritable(e){if(this.writeLease&&!this.writeLease.acquire(e))throw this.logger.warn({sessionId:e},`archive/restore rejected: session write lease held by another live process (read-only; RFC-159 D3)`),new q(e)}async archiveSession(e){let t=this.repo;if(typeof t.archiveSession!=`function`)throw Error(`archiveSession is not supported by this repository`);return this.assertWritable(e),t.archiveSession(e)}async restoreArchivedSession(e){let t=this.repo;return typeof t.restoreArchivedSession==`function`?(this.assertWritable(e),t.restoreArchivedSession(e)):0}async save(e){if(this.writeLease&&!this.writeLease.acquire(e.id))throw this.logger.warn({sessionId:e.id},`save rejected: session write lease held by another live process (read-only; RFC-159 D3)`),new q(e.id);await this.repo.createSession(B(e,this.resolveWorkspaceKey()));let t=this.persisted.get(e.id),n=0;if(t!=null){let r=e.entries.findIndex(e=>e.id===t);n=r>=0?r+1:0}if(n===0){let n=await this.repo.getEntryCount(e.id);n>0&&t==null&&this.logger.warn({sessionId:e.id,dbCount:n},`Session has persisted entries but no local cursor (restart or concurrent writer); reconciling via full idempotent append (append-forever, no loss)`)}for(let t=n;t<e.entries.length;t++){let n=V(e.entries[t]),r=await R(n.type,n.data,this.repo);await this.repo.appendEntry(e.id,{...n,data:r})}let{leafPersisted:r}=await this.repo.touchSession(e.id,e.leafId,e.metadata.lastActiveAt,e.metadata.title,e.metadata.titleSource,e.metadata.config,e.metadata.archived,e.metadata.pinned,e.metadata.pinGroup);!r&&e.leafId!=null&&this.logger.warn({sessionId:e.id,rejectedLeafId:e.leafId},`touchSession: leafId not found among session entries (rejected to avoid dangling leaf; likely concurrent writer race); existing leaf_id preserved`);let i=e.entries[e.entries.length-1];i?this.persisted.set(e.id,i.id):this.persisted.delete(e.id)}async load(e){let t=await this.repo.getSession(e);if(!t)return null;let n=this.resolveWorkspaceKey(),r=t.workspaceKey||`default`;if(r!==n)return this.logger.warn({sessionId:e,sessionWorkspaceKey:r,expectedWorkspaceKey:n},`RelationalSessionPersistence.load: session belongs to a different workspace, refusing cross-workspace restore`),null;let i=await W(e,this.repo,{...this.maxLoadEntries==null?{}:{maxEntries:this.maxLoadEntries},...this.canStartHistory?{canStartHistory:this.canStartHistory}:{},...this.stripInactiveReplacements?{stripInactiveReplacements:!0}:{}}),a=i?.entries[i.entries.length-1];return a&&this.persisted.set(e,a.id),i}getPersistedCursor(e){return this.persisted.get(e)}async hydrateReplacements(e,t){return K(e,t,this.repo)}async delete(e){let t=await this.repo.deleteSession(e);return this.persisted.delete(e),this.writeLease?.release(e),t}async list(){return(await this.repo.listSessions(this.resolveWorkspaceKey())).map(e=>e.id)}async listRecentMeta(e){return this.repo.listRecentSessionIds(this.resolveWorkspaceKey(),e)}async listPaginated(e){let t=await this.repo.listSessions(this.resolveWorkspaceKey()),n=e.sortBy===`createdAt`?[...t].sort((e,t)=>t.createdAt-e.createdAt):t,r=e.order===`asc`?[...n].reverse():n,i=e.pageSize??this.defaultPageSize;return o(r.map(e=>e.id),{page:e.page,pageSize:i})}};const J=[{version:1,up:e=>{e.exec(`
1
+ import{currentHostname as e,decodeLeaseToken as t,encodeLeaseToken as n,isProcessAlive as r,normalizeEnv as i}from"@x-otto/env";import{MemoryPersistenceBase as a,RemotePersistence as o,RemotePersistenceError as s,RemoteSnapshotConflictError as c,acquireDb as l,paginate as u,releaseDb as d}from"@x-otto/persistence";import{createHash as f,randomUUID as p}from"node:crypto";import{closeSync as m,createWriteStream as h,existsSync as g,mkdirSync as _,openSync as ee,readFileSync as v,renameSync as y,rmSync as te,statSync as b,unlinkSync as x,utimesSync as S,writeSync as ne}from"node:fs";import{dirname as C,join as re,resolve as w}from"node:path";import{createGzip as T,gunzipSync as E}from"node:zlib";import{readFile as ie}from"node:fs/promises";const D={derived:0,ai:1,custom:2};function O(e){if(typeof e!=`object`||!e)return 0;let t=e,n=0,r=t.tool_calls;if(Array.isArray(r))for(let e of r){if(typeof e!=`object`||!e)continue;let t=e.function;t&&typeof t==`object`&&typeof t.arguments==`string`&&(n+=t.arguments.length)}let i=t.content;if(typeof i==`string`)return n+i.length;if(!Array.isArray(i))return n;for(let e of i){if(typeof e!=`object`||!e)continue;let t=e;typeof t.text==`string`&&(n+=t.text.length);let r=t.source;r&&typeof r==`object`&&typeof r.data==`string`&&(n+=r.data.length),typeof t.data==`string`&&(n+=t.data.length);let i=t.image_url;i&&typeof i==`object`&&typeof i.url==`string`&&(n+=i.url.length),t.type===`tool_call`&&typeof t.arguments==`object`&&t.arguments!=null&&(n+=JSON.stringify(t.arguments).length),t.type===`tool_use`&&t.input!=null&&(n+=JSON.stringify(t.input).length)}return n}const ae=i(process.env.OTTO_SESSION_IDLE_TIMEOUT_MS,1800*1e3),oe=i(process.env.OTTO_SESSION_MAX,50),k=i(process.env.OTTO_SESSION_PAGE_SIZE,20),A=i(process.env.OTTO_SESSION_SNAPSHOT_VERSION,1),j=[`message`,`compaction`,`clear`,`compaction-lock`];function M(e){return j.includes(e)}const N={editedFiles:50,subagents:100,turnSummaries:200,drafts:50,inputHistory:100};var P=class{constructor(e){this.host=e}capStoredHistory(e,t){let n=this.host.getEntries(),r=0;for(let e of n)e.type===`message`&&r++;if(r<=e)return{capped:!1,removedCount:0,boundaryLimited:!1,activeOversized:!1};let i=r-e,{removed:a,boundaryLimited:o}=this.removeOldestMessages(i,t);return this.host.setMessageCount(r-a),{capped:a>0,removedCount:a,boundaryLimited:o,activeOversized:this.host.getMessageCount()>e}}wouldTrimTouchActiveContext(e){let t=this.host.getMessageCount();if(t<=e)return!1;let n=t-e,r=this.host.getActiveCompactionId();if(r===void 0)return!0;let i=0;for(let e of this.host.getEntries()){if(e.id===r)break;e.type===`message`&&i++}return i<n}wouldByteTrimTouchActiveContext(e){if(e<=0||this.host.getEstimatedBytes()<=e)return!1;let t=this.host.getActiveCompactionId();if(t===void 0)return!0;let n=0;for(let e of this.host.getEntries()){if(e.id===t)break;e.type===`message`&&(n+=O(e.message))}return this.host.getEstimatedBytes()-n>e}capStoredHistoryByBytes(e,t){let n=this.host.getEntries();if(e<=0||this.host.getEstimatedBytes()<=e)return{capped:!1,removedCount:0,boundaryLimited:!1,activeOversized:!1};let r=0;for(let e of n)e.type===`message`&&r++;let i=this.host.getEstimatedBytes(),a=0;for(let t of n){if(i<=e||a>=r-1)break;t.type===`message`&&(i-=O(t.message),a++)}if(a===0)return{capped:!1,removedCount:0,boundaryLimited:!1,activeOversized:!1};let{removed:o,boundaryLimited:s}=this.removeOldestMessages(a,t);return this.host.setMessageCount(r-o),{capped:o>0,removedCount:o,boundaryLimited:s,activeOversized:this.host.getEstimatedBytes()>e}}verifyEstimatedContentBytes(){let e=0;for(let t of this.host.getEntries())if(t.type===`message`)e+=O(t.message);else if(t.type===`compaction`&&t.replacement)for(let n of t.replacement)e+=O(n);return{counter:this.host.getEstimatedBytes(),recomputed:e,drift:e-this.host.getEstimatedBytes()}}removeOldestMessages(e,t){let n=this.host.getEntries(),r=this.host.getEntryMap(),i=this.host.getActiveCompactionId(),a=!1,o=0,s=0;for(;s<n.length&&o<e;){let e=n[s];if(i!==void 0&&e.id===i){a=!0;break}e.type===`message`?(this.host.setEstimatedBytes(this.host.getEstimatedBytes()-O(e.message)),r.delete(e.id),n.splice(s,1),o++):s++}if(t)for(;s<n.length;){let e=n[s];if(i!==void 0&&e.id===i){a=!0;break}if(e.type!==`message`){s++;continue}if(t(e.message))break;this.host.setEstimatedBytes(this.host.getEstimatedBytes()-O(e.message)),r.delete(e.id),n.splice(s,1),o++}return this.host.getEstimatedBytes()<0&&this.host.setEstimatedBytes(0),{removed:o,boundaryLimited:a}}};const se={now:()=>Date.now()},ce={uuid:()=>crypto.randomUUID()};var F=class{sessionEntries=[];entryMap=new Map;clock;idGen;_estimatedContentBytes=0;get estimatedContentBytes(){return this._estimatedContentBytes}get messageCount(){return this.meta.messageCount}verifyEstimatedContentBytes(){return this.residencyPolicy.verifyEstimatedContentBytes()}meta;panelState={};residencyPolicy;constructor(e,t,n,r){this.id=e,this.clock=r?.clock??se,this.idGen=r?.idGen??ce;let i=this.clock.now();this.meta={createdAt:i,lastActiveAt:i,messageCount:0,compactionCount:0,parentSessionId:t,forkPoint:n,tags:[]},this.residencyPolicy=new P(this.createResidencyHost())}createResidencyHost(){return{getEntries:()=>this.sessionEntries,getEntryMap:()=>this.entryMap,getEstimatedBytes:()=>this._estimatedContentBytes,setEstimatedBytes:e=>{this._estimatedContentBytes=e},getMessageCount:()=>this.meta.messageCount,setMessageCount:e=>{this.meta.messageCount=e},getActiveCompactionId:()=>this.findActiveCompaction()?.id}}_leafId=void 0;get leafId(){return this._leafId}markActivity(){this.meta.lastActiveAt=this.clock.now()}append(e){let t={type:`message`,id:this.idGen.uuid(),parentId:this._leafId,message:e,timestamp:this.clock.now()};this._leafId=t.id,this.sessionEntries.push(t),this.entryMap.set(t.id,t),this.meta.messageCount++,this.markActivity(),this._estimatedContentBytes+=O(e)}removeLast(){if(!this._leafId)return;let e=this.entryMap.get(this._leafId);if(!e||e.type!==`message`)return;let t=this.sessionEntries.lastIndexOf(e);t!==-1&&(this.sessionEntries.splice(t,1),this.entryMap.delete(e.id),this._leafId=e.parentId,this.meta.messageCount=Math.max(0,this.meta.messageCount-1),this._estimatedContentBytes-=O(e.message))}compact(e,t){let n=this.getBranchMessageEntries();if(t<=0||t>n.length)return;let r={type:`compaction`,id:this.idGen.uuid(),parentId:this._leafId,summary:e,compactedCount:t,timestamp:this.clock.now()};this.sessionEntries.push(r),this.entryMap.set(r.id,r),this.meta.compactionCount++,this.markActivity(),this._leafId=r.id}recordCompaction(e,t){let n=this.findActiveCompaction(),r={type:`compaction`,id:this.idGen.uuid(),parentId:this._leafId,summary:e,compactedCount:t.length,replacement:[...t],timestamp:this.clock.now()};for(let e of t)this._estimatedContentBytes+=O(e);this.sessionEntries.push(r),this.entryMap.set(r.id,r),this.meta.compactionCount++,this.markActivity(),this._leafId=r.id,n&&n.replacement!=null&&this.replacementStripEligibility?.(n.id)===!0&&this.stripReplacementInPlace(n.id)}replacementStripEligibility;setReplacementStripEligibility(e){this.replacementStripEligibility=e}findActiveCompaction(){return this._leafId?this.findActiveCompactionFrom(this._leafId):void 0}stripReplacementInPlace(e){let t=this.entryMap.get(e);if(!t||t.type!==`compaction`)return;let n=t;if(n.replacement==null)return;for(let e of n.replacement)this._estimatedContentBytes-=O(e);this._estimatedContentBytes<0&&(this._estimatedContentBytes=0);let{replacement:r,...i}=n,a={...i,replacementStripped:!0};this.entryMap.set(e,a);let o=this.sessionEntries.findIndex(t=>t.id===e);o>=0&&(this.sessionEntries[o]=a)}clearContext(e){let t={type:`clear`,id:this.idGen.uuid(),parentId:this._leafId,timestamp:this.clock.now()};this.sessionEntries.push(t),this.entryMap.set(t.id,t),this.markActivity(),this._leafId=t.id,e?.purge===!0&&this.purgeBeforeBoundary(t.id)}appendCompactionLock(e,t){let n={type:`compaction-lock`,id:this.idGen.uuid(),parentId:this._leafId,phase:e,token:t,timestamp:this.clock.now()};this.sessionEntries.push(n),this.entryMap.set(n.id,n),this._leafId=n.id}compactionLockState(){let e=this.walkBranch();for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.type===`compaction-lock`)return{phase:n.phase,token:n.token,timestamp:n.timestamp}}}purgeClearedHistory(){let e;for(let t=this.sessionEntries.length-1;t>=0;t--)if(this.sessionEntries[t].type===`clear`){e=this.sessionEntries[t].id;break}return e?this.purgeBeforeBoundary(e):{removedCount:0,strippedReplacements:0}}purgeBeforeBoundary(e){let t=this.sessionEntries.findIndex(t=>t.id===e);if(t<0)return{removedCount:0,strippedReplacements:0};let n=0,r=0,i=0,a=t;for(;r<a;){let e=this.sessionEntries[r];e.type===`message`?(this._estimatedContentBytes-=O(e.message),this.entryMap.delete(e.id),this.sessionEntries.splice(r,1),a--,i++):(e.type===`compaction`&&e.replacement!=null&&(this.stripReplacementInPlace(e.id),n++),r++)}return this._estimatedContentBytes<0&&(this._estimatedContentBytes=0),this.meta.messageCount-=i,{removedCount:i,strippedReplacements:n}}branch(e){if(!this.entryMap.has(e))throw Error(`Entry "${e}" not found in session "${this.id}"`);let t=this.findActiveCompactionFrom(e);if(t&&t.replacementStripped)throw Error(`branch: target chain's active compaction boundary "${t.id}" has a stripped replacement (RFC-160); hydrate it via loadEntriesByIds before branching`);this._leafId=e,this.markActivity()}findActiveCompactionFrom(e){let t=new Set,n=this.entryMap.get(e);for(;n&&!t.has(n.id);){if(t.add(n.id),n.type===`compaction`)return n;if(n.type===`clear`)return;n=n.parentId?this.entryMap.get(n.parentId):void 0}}entries(){return this.sessionEntries}branchEntries(){return this.walkBranch()}buildContext(){let e=this.walkBranch(),t=this.lastBoundaryIndex(e),n=e.slice(t+1).filter(e=>e.type===`message`).map(e=>e.message);if(t===-1)return{messages:n};let r=e[t];if(r.type===`clear`)return{messages:n};let i=r;return{summary:i.summary,messages:i.replacement?[...i.replacement,...n]:n}}messages(){return this.walkBranch().filter(e=>e.type===`message`).map(e=>e.message)}visibleMessages(){let e=this.walkBranch(),t=-1;for(let n=e.length-1;n>=0;n--)if(e[n]?.type===`clear`){t=n;break}return e.slice(t+1).filter(e=>e.type===`message`).map(e=>e.message)}metadata(){return{...this.meta,tags:[...this.meta.tags],...this.meta.config?{config:structuredClone(this.meta.config)}:{}}}setTitle(e,t){let n=this.meta.titleSource==null?-1:D[this.meta.titleSource];return D[t]<n?!1:(this.meta.title=e,this.meta.titleSource=t,!0)}setSdkVersion(e){this.meta.sdkVersion=e}setArchived(e){this.meta.archived=e}setPinned(e,t){this.meta.pinned=e,this.meta.pinGroup=e?t:void 0}touchIfActivity(e){e?.touch!==!1&&this.markActivity()}getTodoList(){return this.panelState.todoList}setTodoList(e,t){this.panelState.todoList=[...e],this.touchIfActivity(t)}getEditedFiles(){return this.panelState.editedFiles}setEditedFiles(e,t){this.panelState.editedFiles=e.slice(0,N.editedFiles),this.touchIfActivity(t)}getInputHistory(){return this.meta.config?.inputHistory}setInputHistory(e){if(e.length===0){this.meta.config?.inputHistory!==void 0&&delete this.meta.config.inputHistory;return}this.meta.config||(this.meta.config={}),this.meta.config.inputHistory=e.slice(-N.inputHistory)}getSubagents(){return this.panelState.subagents}setSubagents(e,t){this.panelState.subagents=e.slice(0,N.subagents),this.touchIfActivity(t)}getTurnSummaries(){return this.panelState.turnSummaries}setTurnSummaries(e,t){this.panelState.turnSummaries=e.slice(-N.turnSummaries),this.touchIfActivity(t)}getTurnCount(){return this.meta.config?.turnCount}setTurnCount(e){this.meta.config||(this.meta.config={}),this.meta.config.turnCount=e}getDrafts(){return this.panelState.drafts}setDrafts(e,t){this.panelState.drafts=e.slice(0,N.drafts),this.touchIfActivity(t)}capStoredHistory(e,t){return this.residencyPolicy.capStoredHistory(e,t)}wouldTrimTouchActiveContext(e){return this.residencyPolicy.wouldTrimTouchActiveContext(e)}wouldByteTrimTouchActiveContext(e){return this.residencyPolicy.wouldByteTrimTouchActiveContext(e)}capStoredHistoryByBytes(e,t){return this.residencyPolicy.capStoredHistoryByBytes(e,t)}setTags(e){this.meta.tags=[...e]}addTag(e){this.meta.tags.includes(e)||this.meta.tags.push(e)}restoreEntries(e,t,n){this.sessionEntries.length=0,this.entryMap.clear();let r=0;for(let t of e)if(this.sessionEntries.push(t),this.entryMap.set(t.id,t),t.type===`message`)r+=O(t.message);else if(t.type===`compaction`&&t.replacement)for(let e of t.replacement)r+=O(e);this._estimatedContentBytes=r,Object.assign(this.meta,t),this._leafId=n&&this.entryMap.has(n)?n:e.length>0?e[e.length-1]?.id:void 0}toSnapshot(){return{entries:[...this.sessionEntries],metadata:this.metadata(),leafId:this._leafId}}walkBranch(){if(!this._leafId)return[];let e=[],t=new Set,n=this.entryMap.get(this._leafId);for(;n&&!t.has(n.id);)t.add(n.id),e.push(n),n=n.parentId?this.entryMap.get(n.parentId):void 0;return e.reverse(),e}getBranchMessageEntries(){let e=this.walkBranch(),t=this.lastBoundaryIndex(e);return e.slice(t+1).filter(e=>e.type===`message`)}lastBoundaryIndex(e){for(let t=e.length-1;t>=0;t--){let n=e[t]?.type;if(n===`compaction`||n===`clear`)return t}return-1}},I=class{sessions=new Map;ports;constructor(e){this.ports=e}newId(){return this.ports?.idGen?.uuid()??crypto.randomUUID()}async createSession(e=this.newId()){let t=new F(e,void 0,void 0,this.ports);return this.sessions.set(e,t),t}getSession(e){return this.sessions.get(e)}listSessions(){return Array.from(this.sessions.values())}listSessionsPaginated(e){let{page:t,sortBy:n=`lastActiveAt`,order:r=`desc`}=e,i=e.pageSize??50,a=Array.from(this.sessions.values());return a.sort((e,t)=>{let i=e.metadata(),a=t.metadata(),o=n===`createdAt`?i.createdAt:i.lastActiveAt,s=n===`createdAt`?a.createdAt:a.lastActiveAt;return r===`asc`?o-s:s-o}),u(a,{page:t,pageSize:i})}async deleteSession(e){return this.sessions.delete(e)}async forkSession(e,t=this.newId()){let n=this.sessions.get(e);if(!n)return;let r=n.toSnapshot(),i=this.ports?.clock?.now()??Date.now(),a=new F(t,e,r.entries.length,this.ports);return a.restoreEntries([...r.entries],{...r.metadata,createdAt:i,lastActiveAt:i,parentSessionId:e,forkPoint:r.entries.length,tags:[...r.metadata.tags,`fork`]},r.leafId),this.sessions.set(t,a),a}};function le(e){return new I(e)}var ue=class extends a{constructor(){super({defaultPageSize:k,defaultSortBy:`lastActiveAt`})}extractId(e){return e.id}getSortValue(e,t){return t===`createdAt`?e.metadata.createdAt:e.metadata.lastActiveAt}async listRecentMeta(e){return this.entries().filter(([,e])=>!e.metadata.archived).sort(([,e],[,t])=>t.metadata.lastActiveAt-e.metadata.lastActiveAt).slice(0,e).map(([e])=>e)}};function L(e){return`sha256:${f(`sha256`).update(e,`utf-8`).digest(`hex`)}`}async function R(e,t,n){if(e!==`compaction`)return t;let r=t.replacement;if(!Array.isArray(r))return t;let i=r.map(e=>JSON.stringify(e)),a=i.map(L);await n.putBlobs(i.map((e,t)=>({hash:a[t],content:e})));let{replacement:o,...s}=t;return{...s,replacementHashes:a}}async function z(e,t,n){if(e!==`compaction`)return t;let r=t.replacementHashes;if(!Array.isArray(r)||r.length===0){if(Array.isArray(r)){let{replacementHashes:e,...n}=t;return{...n,replacement:[]}}return t}let i=await n.getBlobs(r),a=r.map(e=>{let t=i.get(e);if(t==null)throw Error(`decodeReplacementFromBlobs: blob ${e} missing from message_blobs (corrupted import/partial backup?); refusing to assemble a lossy replacement (RFC-160 D7)`);return JSON.parse(t)}),{replacementHashes:o,...s}=t;return{...s,replacement:a}}function B(e,t){let n=e.metadata;return{id:e.id,workspaceKey:t,...n.title==null?{}:{title:n.title},...n.titleSource==null?{}:{titleSource:n.titleSource},...n.parentSessionId==null?{}:{parentSessionId:n.parentSessionId},...n.forkPoint==null?{}:{forkPoint:n.forkPoint},...e.leafId==null?{}:{leafId:e.leafId},tags:n.tags??[],...n.config==null?{}:{config:n.config},createdAt:n.createdAt,lastActiveAt:n.lastActiveAt,...n.archived==null?{}:{archived:n.archived},...n.pinned==null?{}:{pinned:n.pinned},...n.pinGroup==null?{}:{pinGroup:n.pinGroup}}}function V(e){let{type:t,id:n,parentId:r,timestamp:i,...a}=e;return{entryId:n,...r==null?{}:{parentId:r},type:t,data:a,createdAt:i}}function H(e){return{type:e.type,id:e.entryId,...e.parentId==null?{}:{parentId:e.parentId},timestamp:e.createdAt,...e.data}}async function de(e,t,n){await n.createSession(B(e,t));for(let t of e.entries)await n.appendEntry(e.id,V(t));await n.touchSession({id:e.id,leafId:e.leafId,lastActiveAt:e.metadata.lastActiveAt,title:e.metadata.title,titleSource:e.metadata.titleSource,config:e.metadata.config,archived:e.metadata.archived,pinned:e.metadata.pinned,pinGroup:e.metadata.pinGroup})}async function U(e,t,n){let r=await t.getSession(e);if(!r)return null;let i,a=!1;n?.maxEntries==null?i=(await t.loadEntries(e)).map(e=>H(e)):await t.getEntryCount(e)>n.maxEntries?(i=(await t.loadTailEntries(e,n.maxEntries)).map(e=>H(e)),a=!0,n.canStartHistory&&(i=pe(i,n.canStartHistory))):i=(await t.loadEntries(e)).map(e=>H(e)),n?.stripInactiveReplacements?(i=fe(i,r.leafId??void 0),i=await W(i,t,{onlyUnstripped:!0})):i=await W(i,t,{onlyUnstripped:!1});let o=a?await t.countEntriesByType(e,`message`):i.filter(e=>e.type===`message`).length,s=a?await t.countEntriesByType(e,`compaction`):i.filter(e=>e.type===`compaction`).length,c={createdAt:r.createdAt,lastActiveAt:r.lastActiveAt,messageCount:o,compactionCount:s,tags:r.tags,...r.title==null?{}:{title:r.title},...r.titleSource==null?{}:{titleSource:r.titleSource},...r.parentSessionId==null?{}:{parentSessionId:r.parentSessionId},...r.forkPoint==null?{}:{forkPoint:r.forkPoint},...r.config==null?{}:{config:r.config},...r.archived==null?{}:{archived:r.archived},...r.pinned==null?{}:{pinned:r.pinned},...r.pinGroup==null?{}:{pinGroup:r.pinGroup}};return{version:A,id:e,entries:i,metadata:c,...r.leafId==null?{}:{leafId:r.leafId}}}async function W(e,t,n){let r=[];for(let i of e){let e=i;if(e.type!==`compaction`||e.replacementHashes==null){r.push(i);continue}if(n.onlyUnstripped&&e.replacementStripped){let{replacementHashes:t,...n}=e;r.push(n);continue}let{replacementStripped:a,...o}=await z(`compaction`,e,t);r.push(o)}return r}function fe(e,t){let n=new Map;for(let t of e)n.set(t.id,t);let r,i=new Set,a=t?n.get(t):void 0;for(;a&&!i.has(a.id);){if(i.add(a.id),a.type===`compaction`){r=a.id;break}if(a.type===`clear`)break;a=a.parentId?n.get(a.parentId):void 0}let o=-1;for(let t=e.length-1;t>=0;t--)if(e[t].type===`compaction`){o=t;break}return e.map((e,t)=>{if(e.type!==`compaction`||e.id===r||t===o)return e;let n=e;if(n.replacement!=null){let{replacement:e,...t}=n;return{...t,replacementStripped:!0}}return n.replacementHashes==null?e:{...n,replacementStripped:!0}})}function pe(e,t){let n=0;for(;n<e.length;){let r=e[n];if(r.type!==`message`||t(r.message))break;n++}return n>0?e.slice(n):e}function me(e){return typeof e?.hydrateReplacements==`function`}function he(e){return e.some(e=>e.type===`compaction`&&e.replacementStripped)}async function G(e,t,n){let r=t.filter(e=>e.type===`compaction`&&e.replacementStripped).map(e=>e.id);if(r.length===0)return[...t];let i=await n.loadEntriesByIds(e,r),a=new Map;for(let e of i)a.set(e.entryId,e.data);let o=[];for(let r of t){if(r.type!==`compaction`||!r.replacementStripped){o.push(r);continue}let t=a.get(r.id);if(t&&t.replacementHashes!=null&&(t=await z(`compaction`,t,n)),!t||t.replacement==null)throw Error(`hydrateStrippedReplacements: authoritative row for compaction "${r.id}" in session "${e}" is missing or has no replacement (corrupted import?); refusing to continue with stripped state (RFC-160 rule 3)`);let{replacementStripped:i,...s}=r;o.push({...s,replacement:t.replacement})}return o}var K=class extends Error{constructor(e){super(`Session write lease denied for ${e}: another live process owns the write lease (this process is read-only for the session; refusing to save — RFC-159 D3)`),this.sessionId=e,this.name=`SessionWriteLeaseDeniedError`}};const ge={uuid:()=>p()};function _e(i){let a=i.staleMs??6e4,o=i.renewEveryMs??1e4,s=new Map,c=!1,l=e(),u=e=>re(i.lockDir,`${e}.lock`),d=e=>{try{return t(v(u(e),`utf-8`).trim())}catch{return null}},f=e=>d(e)?.token??null,h=(e,t)=>{try{_(i.lockDir,{recursive:!0});let r=ee(u(e),`wx`);try{ne(r,n(t,process.pid,l))}finally{m(r)}return!0}catch(e){if(e.code!==`EEXIST`)throw e;return!1}},g=e=>e.pid===void 0||e.host===void 0||e.host!==l?!1:!r(e.pid),C=e=>e.pid===void 0||e.host===void 0||e.host!==l?!1:r(e.pid),w=(e,t)=>{let n=setInterval(()=>{if(f(e)!==t){T(e);return}try{let t=new Date;S(u(e),t,t)}catch{T(e)}},o);n.unref(),s.set(e,{token:t,timer:n})},T=e=>{let t=s.get(e);t&&(clearInterval(t.timer),s.delete(e))},E={acquire(e){if(c)return!1;let t=s.get(e);if(t){if(f(e)===t.token)return!0;T(e)}let n=(i.idGen??ge).uuid();if(h(e,n))return w(e,n),!0;let r=d(e),o;try{o=b(u(e)).mtimeMs}catch{return h(e,n)?(w(e,n),!0):!1}if(r!==null&&C(r)||!(r!==null&&g(r))&&Date.now()-o<=a)return!1;let l=`${u(e)}.stale-${p()}`;try{y(u(e),l),te(l,{force:!0})}catch{return!1}return h(e,n)?(w(e,n),!0):!1},release(e){let t=s.get(e);if(t){if(f(e)===t.token)try{x(u(e))}catch{}T(e)}},releaseAll(){for(let e of[...s.keys()])E.release(e)},isOwner(e){if(c)return!1;let t=s.get(e);return t!=null&&f(e)===t.token},peekLockedByOther(e){if(c)return!1;let t=s.get(e);if(t!=null&&f(e)===t.token)return!1;let n;try{n=b(u(e)).mtimeMs}catch{return!1}return Date.now()-n<=a},inspect(e){let t=d(e);if(t===null)return{locked:!1};let n;try{n=Date.now()-b(u(e)).mtimeMs}catch{return{locked:!1}}let i=t.pid!==void 0&&t.host!==void 0&&t.host===l?r(t.pid):void 0;return{locked:!0,pid:t.pid,hostname:t.host,alive:i,mtimeAgoMs:n}},forceRelease(e){try{x(u(e))}catch{}T(e)},close(){c=!0,E.releaseAll()}};return i.installExitHook!==!1&&process.on(`exit`,()=>E.releaseAll()),E}function q(){return{acquire:()=>!0,release:()=>{},releaseAll:()=>{},isOwner:()=>!0,peekLockedByOther:()=>!1,inspect:()=>({locked:!1}),forceRelease:()=>{},close:()=>{}}}function J(e){return typeof e?.archiveSession==`function`&&typeof e?.restoreArchivedSession==`function`}const ve={warn:()=>{}};var ye=class{repo;resolveWorkspaceKey;defaultPageSize;logger;persisted=new Map;maxLoadEntries;canStartHistory;writeLease;stripInactiveReplacements;constructor(e){this.repo=e.repo;let t=e.workspaceKey;this.resolveWorkspaceKey=typeof t==`function`?()=>t()||`default`:()=>t||`default`,this.defaultPageSize=e.defaultPageSize??20,this.logger=e.logger??ve,this.maxLoadEntries=e.maxLoadEntries,this.canStartHistory=e.canStartHistory,this.writeLease=e.writeLease,this.stripInactiveReplacements=e.stripInactiveReplacements??!1}assertWritable(e){if(this.writeLease&&!this.writeLease.acquire(e))throw this.logger.warn({sessionId:e},`archive/restore rejected: session write lease held by another live process (read-only; RFC-159 D3)`),new K(e)}async archiveSession(e){if(!J(this.repo))throw Error(`archiveSession is not supported by this repository`);return this.assertWritable(e),this.repo.archiveSession(e)}async restoreArchivedSession(e){return J(this.repo)?(this.assertWritable(e),this.repo.restoreArchivedSession(e)):0}async save(e){if(this.writeLease&&!this.writeLease.acquire(e.id))throw this.logger.warn({sessionId:e.id},`save rejected: session write lease held by another live process (read-only; RFC-159 D3)`),new K(e.id);await this.repo.createSession(B(e,this.resolveWorkspaceKey()));let t=this.persisted.get(e.id),n=0;if(t!=null){let r=e.entries.findIndex(e=>e.id===t);n=r>=0?r+1:0}if(n===0){let n=await this.repo.getEntryCount(e.id);n>0&&t==null&&this.logger.warn({sessionId:e.id,dbCount:n},`Session has persisted entries but no local cursor (restart or concurrent writer); reconciling via full idempotent append (append-forever, no loss)`)}for(let t=n;t<e.entries.length;t++){let n=V(e.entries[t]),r=await R(n.type,n.data,this.repo);await this.repo.appendEntry(e.id,{...n,data:r})}let{leafPersisted:r}=await this.repo.touchSession({id:e.id,leafId:e.leafId,lastActiveAt:e.metadata.lastActiveAt,title:e.metadata.title,titleSource:e.metadata.titleSource,config:e.metadata.config,archived:e.metadata.archived,pinned:e.metadata.pinned,pinGroup:e.metadata.pinGroup});!r&&e.leafId!=null&&this.logger.warn({sessionId:e.id,rejectedLeafId:e.leafId},`touchSession: leafId not found among session entries (rejected to avoid dangling leaf; likely concurrent writer race); existing leaf_id preserved`);let i=e.entries[e.entries.length-1];i?this.persisted.set(e.id,i.id):this.persisted.delete(e.id)}async load(e){let t=await this.repo.getSession(e);if(!t)return null;let n=this.resolveWorkspaceKey(),r=t.workspaceKey||`default`;if(r!==n)return this.logger.warn({sessionId:e,sessionWorkspaceKey:r,expectedWorkspaceKey:n},`RelationalSessionPersistence.load: session belongs to a different workspace, refusing cross-workspace restore`),null;let i=await U(e,this.repo,{...this.maxLoadEntries==null?{}:{maxEntries:this.maxLoadEntries},...this.canStartHistory?{canStartHistory:this.canStartHistory}:{},...this.stripInactiveReplacements?{stripInactiveReplacements:!0}:{}}),a=i?.entries[i.entries.length-1];return a&&this.persisted.set(e,a.id),i}getPersistedCursor(e){return this.persisted.get(e)}async hydrateReplacements(e,t){return G(e,t,this.repo)}async delete(e){let t=await this.repo.deleteSession(e);return this.persisted.delete(e),this.writeLease?.release(e),t}async list(){return(await this.repo.listSessions(this.resolveWorkspaceKey())).map(e=>e.id)}async listRecentMeta(e){return this.repo.listRecentSessionIds(this.resolveWorkspaceKey(),e)}async listPaginated(e){let t=await this.repo.listSessions(this.resolveWorkspaceKey()),n=e.sortBy===`createdAt`?[...t].sort((e,t)=>t.createdAt-e.createdAt):t,r=e.order===`asc`?[...n].reverse():n,i=e.pageSize??this.defaultPageSize;return u(r.map(e=>e.id),{page:e.page,pageSize:i})}},Y=class{archiveDir;ephemeral;deps;constructor(e){this.archiveDir=e.archiveDir,this.ephemeral=e.ephemeral??!1,this.deps=e}archivePath(e){return w(this.archiveDir,`${e}.jsonl.gz`)}async archiveSession(e){if(this.ephemeral)return this.deps.setArchived(e,!0),`:memory:/${e}.jsonl.gz`;let t=this.archivePath(e);g(this.archiveDir)||_(this.archiveDir,{recursive:!0});let n=await this.deps.loadEntries(e),r=T(),i=h(t);r.pipe(i);let a=new TextEncoder;for(let e of n)r.write(a.encode(JSON.stringify(e)+`
2
+ `));return r.end(),await new Promise((e,t)=>{i.on(`finish`,e),i.on(`error`,t)}),this.deps.setArchived(e,!0),t}async restoreArchivedSession(e){let t=this.archivePath(e);if(!g(t))return 0;let n=E(await ie(t)).toString(`utf-8`).trim().split(`
3
+ `).filter(Boolean),r=await this.deps.loadEntries(e),i=0;for(let t of n){let n=JSON.parse(t);r.some(e=>e.entryId===n.entryId)||(await this.deps.appendEntry(e,n),i++)}return this.deps.setArchived(e,!1),i}};const X=[{version:1,up:e=>{e.exec(`
2
4
  CREATE TABLE IF NOT EXISTS workspaces (
3
5
  id TEXT PRIMARY KEY,
4
6
  name TEXT NOT NULL,
@@ -45,15 +47,10 @@ import{DiskPersistence as e,MemoryPersistenceBase as t,RemotePersistence as n,Re
45
47
  content TEXT NOT NULL,
46
48
  created_at INTEGER NOT NULL
47
49
  );
48
- `)}}],Y=`default`;var X=class{db;archiveDir;ephemeral;constructor(e){this.db=a(e.dbPath,e.wal!==!1,J),this.ephemeral=e.dbPath===`:memory:`,this.archiveDir=v(g(e.dbPath),`archives`)}close(){s(this.db)}async archiveSession(e){if(this.ephemeral)return this.db.prepare(`UPDATE sessions SET archived = 1 WHERE id = ?`).run(e),`:memory:/${e}.jsonl.gz`;let t=v(this.archiveDir,`${e}.jsonl.gz`);S(this.archiveDir)||C(this.archiveDir,{recursive:!0});let n=await this.loadEntries(e),r=A(),i=x(t);r.pipe(i);let a=new TextEncoder;for(let e of n)r.write(a.encode(JSON.stringify(e)+`
49
- `));return r.end(),await new Promise((e,t)=>{i.on(`finish`,e),i.on(`error`,t)}),this.db.prepare(`UPDATE sessions SET archived = 1 WHERE id = ?`).run(e),t}async restoreArchivedSession(e){let t=v(this.archiveDir,`${e}.jsonl.gz`);if(!S(t))return 0;let n=j(await p(t)).toString(`utf-8`).trim().split(`
50
- `).filter(Boolean),r=await this.loadEntries(e),i=0;for(let t of n){let n=JSON.parse(t);r.some(e=>e.entryId===n.entryId)||(await this.appendEntry(e,n),i++)}return this.db.prepare(`UPDATE sessions SET archived = 0 WHERE id = ?`).run(e),i}async upsertWorkspace(e){this.db.prepare(`INSERT INTO workspaces (id, name, owner_id, org_id, created_at)
51
- VALUES (?, ?, ?, ?, ?)
52
- ON CONFLICT (id) DO UPDATE SET
53
- name = excluded.name, owner_id = excluded.owner_id, org_id = excluded.org_id`).run(e.id,e.name,e.ownerId??null,e.orgId??null,e.createdAt)}async getWorkspace(e){let t=this.db.prepare(`SELECT id, name, owner_id, org_id, created_at FROM workspaces WHERE id = ?`).get(e);return t?Z(t):null}async listWorkspaces(){return this.db.prepare(`SELECT id, name, owner_id, org_id, created_at FROM workspaces ORDER BY created_at DESC`).all().map(Z)}async createSession(e){this.db.prepare(`INSERT INTO sessions
50
+ `)}}],Z=`default`;var be=class{db;archiveStore;ephemeral;constructor(e){this.db=l(e.dbPath,e.wal!==!1,X),this.ephemeral=e.dbPath===`:memory:`,this.archiveStore=new Y({archiveDir:w(C(e.dbPath),`archives`),ephemeral:this.ephemeral,loadEntries:e=>this.loadEntries(e),appendEntry:(e,t)=>this.appendEntry(e,t),setArchived:(e,t)=>{this.db.prepare(`UPDATE sessions SET archived = ? WHERE id = ?`).run(t?1:0,e)}})}close(){d(this.db)}async archiveSession(e){return this.archiveStore.archiveSession(e)}async restoreArchivedSession(e){return this.archiveStore.restoreArchivedSession(e)}async createSession(e){this.db.prepare(`INSERT INTO sessions
54
51
  (id, workspace_key, title, title_source, parent_session_id, fork_point, leaf_id, owner_id, tags, config, next_seq, created_at, last_active_at, archived, pinned, pin_group)
55
52
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?, ?)
56
- ON CONFLICT (id) DO NOTHING`).run(e.id,e.workspaceKey||Y,e.title??null,e.titleSource??null,e.parentSessionId??null,e.forkPoint??null,e.leafId??null,e.ownerId??null,JSON.stringify(e.tags??[]),e.config==null?null:JSON.stringify(e.config),e.createdAt,e.lastActiveAt,e.archived==null?null:e.archived?1:0,e.pinned==null?null:e.pinned?1:0,e.pinGroup??null)}async touchSession(e,t,n,r,i,a,o,s,c){return{leafPersisted:this.db.transaction(()=>{let l=null,u=!0;return t!=null&&(this.db.prepare(`SELECT 1 FROM session_entries WHERE session_id = ? AND entry_id = ?`).get(e,t)?l=t:u=!1),this.db.prepare(u?`UPDATE sessions SET
53
+ ON CONFLICT (id) DO NOTHING`).run(e.id,e.workspaceKey||Z,e.title??null,e.titleSource??null,e.parentSessionId??null,e.forkPoint??null,e.leafId??null,e.ownerId??null,JSON.stringify(e.tags??[]),e.config==null?null:JSON.stringify(e.config),e.createdAt,e.lastActiveAt,e.archived==null?null:e.archived?1:0,e.pinned==null?null:e.pinned?1:0,e.pinGroup??null)}async touchSession(e){let{id:t,leafId:n,lastActiveAt:r,title:i,titleSource:a,config:o,archived:s,pinned:c,pinGroup:l}=e;return{leafPersisted:this.db.transaction(()=>{let e=null,u=!0;return n!=null&&(this.db.prepare(`SELECT 1 FROM session_entries WHERE session_id = ? AND entry_id = ?`).get(t,n)?e=n:u=!1),this.db.prepare(u?`UPDATE sessions SET
57
54
  leaf_id = ?,
58
55
  last_active_at = ?,
59
56
  title = COALESCE(?, title),
@@ -70,19 +67,19 @@ import{DiskPersistence as e,MemoryPersistenceBase as t,RemotePersistence as n,Re
70
67
  archived = COALESCE(?, archived),
71
68
  pinned = COALESCE(?, pinned),
72
69
  pin_group = COALESCE(?, pin_group)
73
- WHERE id = ?`).run(...u?[l]:[],n,r??null,i??null,a==null?null:JSON.stringify(a),o==null?null:o?1:0,s==null?null:s?1:0,c??null,e),u}).immediate()}}async getSession(e){let t=this.db.prepare(`SELECT * FROM sessions WHERE id = ?`).get(e);return t?Q(t):null}async listSessions(e){return this.db.prepare(`SELECT * FROM sessions
74
- WHERE COALESCE(workspace_key, '${Y}') = ?
75
- ORDER BY last_active_at DESC`).all(e||Y).map(Q)}async listAllSessionIds(){return this.db.prepare(`SELECT id FROM sessions`).all().map(e=>e.id)}async listRecentSessionIds(e,t){return this.db.prepare(`SELECT id FROM sessions
76
- WHERE COALESCE(workspace_key, '${Y}') = ?
70
+ WHERE id = ?`).run(...u?[e]:[],r,i??null,a??null,o==null?null:JSON.stringify(o),s==null?null:s?1:0,c==null?null:c?1:0,l??null,t),u}).immediate()}}async getSession(e){let t=this.db.prepare(`SELECT * FROM sessions WHERE id = ?`).get(e);return t?Q(t):null}async listSessions(e){return this.db.prepare(`SELECT * FROM sessions
71
+ WHERE COALESCE(workspace_key, '${Z}') = ?
72
+ ORDER BY last_active_at DESC`).all(e||Z).map(Q)}async listAllSessionIds(){return this.db.prepare(`SELECT id FROM sessions`).all().map(e=>e.id)}async listRecentSessionIds(e,t){return this.db.prepare(`SELECT id FROM sessions
73
+ WHERE COALESCE(workspace_key, '${Z}') = ?
77
74
  AND COALESCE(archived, 0) = 0
78
75
  AND next_seq > 0
79
76
  ORDER BY last_active_at DESC
80
- LIMIT ?`).all(e||Y,t).map(e=>e.id)}async deleteSession(e){return this.db.transaction(e=>(this.db.prepare(`DELETE FROM session_entries WHERE session_id = ?`).run(e),this.db.prepare(`DELETE FROM sessions WHERE id = ?`).run(e).changes>0)).immediate(e)}async appendEntry(e,t){return this.db.transaction((e,t)=>{let n=this.db.prepare(`SELECT seq FROM session_entries WHERE session_id = ? AND entry_id = ?`).get(e,t.entryId);if(n)return n.seq;let r=this.db.prepare(`SELECT next_seq FROM sessions WHERE id = ?`).get(e);if(!r)throw Error(`appendEntry: unknown session ${e}`);let i=r.next_seq;if(t.data.replacementStripped)throw Error(`appendEntry: refusing to persist stripped compaction entry ${t.entryId} as a new authoritative row for session ${e} (RFC-160 D1; hydrate before persisting)`);let a=this.db.prepare(`SELECT MAX(seq) AS max_seq FROM session_entries WHERE session_id = ?`).get(e);if(a.max_seq!=null&&i<=a.max_seq)throw Error(`appendEntry: next_seq invariant violated for session ${e} (next_seq=${i} <= MAX(seq)=${a.max_seq}); refusing to write (RFC-159 D5)`);return this.db.prepare(`INSERT INTO session_entries (session_id, seq, entry_id, parent_id, type, data, created_at)
77
+ LIMIT ?`).all(e||Z,t).map(e=>e.id)}async deleteSession(e){return this.db.transaction(e=>(this.db.prepare(`DELETE FROM session_entries WHERE session_id = ?`).run(e),this.db.prepare(`DELETE FROM sessions WHERE id = ?`).run(e).changes>0)).immediate(e)}async appendEntry(e,t){if(!M(t.type))throw Error(`appendEntry: unknown entry type "${t.type}" for session ${e} (known: ${j.join(`, `)}; RFC-393 P2 whitelist)`);return this.db.transaction((e,t)=>{let n=this.db.prepare(`SELECT seq FROM session_entries WHERE session_id = ? AND entry_id = ?`).get(e,t.entryId);if(n)return n.seq;let r=this.db.prepare(`SELECT next_seq FROM sessions WHERE id = ?`).get(e);if(!r)throw Error(`appendEntry: unknown session ${e}`);let i=r.next_seq;if(t.data.replacementStripped)throw Error(`appendEntry: refusing to persist stripped compaction entry ${t.entryId} as a new authoritative row for session ${e} (RFC-160 D1; hydrate before persisting)`);let a=this.db.prepare(`SELECT MAX(seq) AS max_seq FROM session_entries WHERE session_id = ?`).get(e);if(a.max_seq!=null&&i<=a.max_seq)throw Error(`appendEntry: next_seq invariant violated for session ${e} (next_seq=${i} <= MAX(seq)=${a.max_seq}); refusing to write (RFC-159 D5)`);return this.db.prepare(`INSERT INTO session_entries (session_id, seq, entry_id, parent_id, type, data, created_at)
81
78
  VALUES (?, ?, ?, ?, ?, ?, ?)`).run(e,i,t.entryId,t.parentId??null,t.type,JSON.stringify(t.data),t.createdAt),this.db.prepare(`UPDATE sessions SET next_seq = ?, last_active_at = ? WHERE id = ?`).run(i+1,t.createdAt,e),i}).immediate(e,t)}async loadEntries(e,t){return(t==null?this.db.prepare(`SELECT * FROM session_entries WHERE session_id = ? ORDER BY seq ASC`).all(e):this.db.prepare(`SELECT * FROM session_entries WHERE session_id = ? AND seq > ? ORDER BY seq ASC`).all(e,t)).map($)}async getEntryCount(e){return this.db.prepare(`SELECT next_seq FROM sessions WHERE id = ?`).get(e)?.next_seq??0}async loadTailEntries(e,t){return t<=0?[]:this.db.prepare(`SELECT * FROM (
82
79
  SELECT * FROM session_entries WHERE session_id = ? ORDER BY seq DESC LIMIT ?
83
80
  ) ORDER BY seq ASC`).all(e,t).map($)}async loadEntriesBefore(e,t,n){return t<=0||n<=0?[]:this.db.prepare(`SELECT * FROM (
84
81
  SELECT * FROM session_entries
85
82
  WHERE session_id = ? AND seq < ?
86
83
  ORDER BY seq DESC LIMIT ?
87
- ) ORDER BY seq ASC`).all(e,t,n).map($)}async countEntriesByType(e,t){return this.db.prepare(`SELECT COUNT(*) AS n FROM session_entries WHERE session_id = ? AND type = ?`).get(e,t).n}async putBlobs(e){if(e.length===0)return;let t=this.db.prepare(`INSERT OR IGNORE INTO message_blobs (hash, content, created_at) VALUES (?, ?, ?)`);this.db.transaction(e=>{let n=Date.now();for(let r of e)t.run(r.hash,r.content,n)}).immediate(e)}async getBlobs(e){let t=new Map;for(let n of this.batchInQuery(e,e=>`SELECT hash, content FROM message_blobs WHERE hash IN (${e})`))for(let e of n)t.set(e.hash,e.content);return t}async loadEntriesByIds(e,t){let n=[];for(let r of this.batchInQuery(t,e=>`SELECT * FROM session_entries WHERE session_id = ? AND entry_id IN (${e})`,[e]))n.push(...r);return n.sort((e,t)=>e.seq-t.seq),n.map($)}*batchInQuery(e,t,n=[]){if(e.length!==0)for(let r=0;r<e.length;r+=500){let i=e.slice(r,r+500),a=i.map(()=>`?`).join(`,`);yield this.db.prepare(t(a)).all(...n,...i)}}};function Z(e){return{id:e.id,name:e.name,...e.owner_id==null?{}:{ownerId:e.owner_id},...e.org_id==null?{}:{orgId:e.org_id},createdAt:e.created_at}}function Q(e){return{id:e.id,workspaceKey:e.workspace_key??Y,...e.title==null?{}:{title:e.title},...e.title_source==null?{}:{titleSource:e.title_source},...e.parent_session_id==null?{}:{parentSessionId:e.parent_session_id},...e.fork_point==null?{}:{forkPoint:e.fork_point},...e.leaf_id==null?{}:{leafId:e.leaf_id},...e.owner_id==null?{}:{ownerId:e.owner_id},tags:JSON.parse(e.tags),...e.config==null?{}:{config:JSON.parse(e.config)},entryCount:e.next_seq,createdAt:e.created_at,lastActiveAt:e.last_active_at,...e.archived==null?{}:{archived:e.archived===1},...e.pinned==null?{}:{pinned:e.pinned===1},...e.pin_group==null?{}:{pinGroup:e.pin_group}}}function $(e){return{sessionId:e.session_id,seq:e.seq,entryId:e.entry_id,...e.parent_id==null?{}:{parentId:e.parent_id},type:e.type,data:JSON.parse(e.data),createdAt:e.created_at}}var _e=class extends n{turnFlush=`snapshot`;constructor(e){let{userId:t,wsKey:n,...r}=e,i=e.getHeaders;super({...r,wsKey:n,getHeaders:t?async()=>({...await i?.().catch(()=>({}))??{},"X-Otto-User-Id":t}):i,defaultSortBy:`lastActiveAt`,defaultPageSize:I})}get serviceLabel(){return`会话服务`}get endpointFlag(){return`--session-url`}extractId(e){return e.id}async listRecentMeta(e){let t=`/${encodeURIComponent(this.wsKey)}/recent`;return(await(await this.request(`${t}?limit=${encodeURIComponent(String(e))}`,{method:`GET`})).json()).ids}};export{ce as FileSessionPersistence,P as InMemorySession,se as InMemorySessionPersistence,F as InMemorySessionStore,ge as RelationalSessionPersistence,r as RemotePersistenceError,_e as RemoteSessionPersistence,i as RemoteSnapshotConflictError,ie as SESSION_IDLE_TIMEOUT_MS,ae as SESSION_MAX,J as SESSION_MIGRATIONS,I as SESSION_PAGE_SIZE,oe as SESSION_SNAPSHOT_VERSION,q as SessionWriteLeaseDeniedError,X as SqliteSessionRepository,re as createInMemorySessionStore,me as createNoopSessionWriteLeaseManager,pe as createSessionWriteLeaseManager,z as decodeReplacementFromBlobs,R as encodeReplacementToBlobs,V as entryToInput,N as estimateMessageContentBytes,U as explodeSnapshot,fe as hasStrippedReplacements,L as hashMessageContent,K as hydrateStrippedReplacements,W as reassembleSnapshot,B as sessionRowFromSnapshot,de as supportsReplacementHydration};
84
+ ) ORDER BY seq ASC`).all(e,t,n).map($)}async countEntriesByType(e,t){return this.db.prepare(`SELECT COUNT(*) AS n FROM session_entries WHERE session_id = ? AND type = ?`).get(e,t).n}async putBlobs(e){if(e.length===0)return;let t=this.db.prepare(`INSERT OR IGNORE INTO message_blobs (hash, content, created_at) VALUES (?, ?, ?)`);this.db.transaction(e=>{let n=Date.now();for(let r of e)t.run(r.hash,r.content,n)}).immediate(e)}async getBlobs(e){let t=new Map;for(let n of this.batchInQuery(e,e=>`SELECT hash, content FROM message_blobs WHERE hash IN (${e})`))for(let e of n)t.set(e.hash,e.content);return t}async loadEntriesByIds(e,t){let n=[];for(let r of this.batchInQuery(t,e=>`SELECT * FROM session_entries WHERE session_id = ? AND entry_id IN (${e})`,[e]))n.push(...r);return n.sort((e,t)=>e.seq-t.seq),n.map($)}*batchInQuery(e,t,n=[]){if(e.length!==0)for(let r=0;r<e.length;r+=500){let i=e.slice(r,r+500),a=i.map(()=>`?`).join(`,`);yield this.db.prepare(t(a)).all(...n,...i)}}};function Q(e){return{id:e.id,workspaceKey:e.workspace_key??Z,...e.title==null?{}:{title:e.title},...e.title_source==null?{}:{titleSource:e.title_source},...e.parent_session_id==null?{}:{parentSessionId:e.parent_session_id},...e.fork_point==null?{}:{forkPoint:e.fork_point},...e.leaf_id==null?{}:{leafId:e.leaf_id},...e.owner_id==null?{}:{ownerId:e.owner_id},tags:JSON.parse(e.tags),...e.config==null?{}:{config:JSON.parse(e.config)},entryCount:e.next_seq,createdAt:e.created_at,lastActiveAt:e.last_active_at,...e.archived==null?{}:{archived:e.archived===1},...e.pinned==null?{}:{pinned:e.pinned===1},...e.pin_group==null?{}:{pinGroup:e.pin_group}}}function $(e){return{sessionId:e.session_id,seq:e.seq,entryId:e.entry_id,...e.parent_id==null?{}:{parentId:e.parent_id},type:e.type,data:JSON.parse(e.data),createdAt:e.created_at}}var xe=class extends o{turnFlush=`snapshot`;constructor(e){let{userId:t,wsKey:n,...r}=e,i=e.getHeaders;super({...r,wsKey:n,getHeaders:t?async()=>({...await i?.().catch(()=>({}))??{},"X-Otto-User-Id":t}):i,defaultSortBy:`lastActiveAt`,defaultPageSize:k})}get serviceLabel(){return`会话服务`}get endpointFlag(){return`--session-url`}extractId(e){return e.id}async listRecentMeta(e){let t=`/${encodeURIComponent(this.wsKey)}/recent`;return(await(await this.request(`${t}?limit=${encodeURIComponent(String(e))}`,{method:`GET`})).json()).ids}};export{F as InMemorySession,ue as InMemorySessionPersistence,I as InMemorySessionStore,N as PANEL_STATE_LIMITS,ye as RelationalSessionPersistence,s as RemotePersistenceError,xe as RemoteSessionPersistence,c as RemoteSnapshotConflictError,P as ResidencyPolicy,j as SESSION_ENTRY_TYPES,ae as SESSION_IDLE_TIMEOUT_MS,oe as SESSION_MAX,X as SESSION_MIGRATIONS,k as SESSION_PAGE_SIZE,A as SESSION_SNAPSHOT_VERSION,Y as SessionArchiveStore,K as SessionWriteLeaseDeniedError,be as SqliteSessionRepository,le as createInMemorySessionStore,q as createNoopSessionWriteLeaseManager,_e as createSessionWriteLeaseManager,z as decodeReplacementFromBlobs,R as encodeReplacementToBlobs,V as entryToInput,O as estimateMessageContentBytes,de as explodeSnapshot,he as hasStrippedReplacements,L as hashMessageContent,G as hydrateStrippedReplacements,M as isKnownSessionEntryType,U as reassembleSnapshot,H as rowToEntry,B as sessionRowFromSnapshot,J as supportsArchive,me as supportsReplacementHydration};
88
85
  //# sourceMappingURL=index.js.map