UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 4.71 kB
import{n as e,t}from"./transcript-version-cakuJMg_.mjs";import{n}from"./transcript-openclaw-root-D71x7s4L.mjs";import{o as r}from"./transcript-openclaw-state-db-contract-DiFTYPe3.mjs";import{o as i}from"./transcript-kysely-sync-cache-state-9JTloBF9.mjs";import{t as a}from"./transcript-startup-maintenance-required-DocYc5R6.mjs";const o=/^(?<year>\d{4})\.(?<month>[1-9]\d?)\.(?<patch>[1-9]\d*)(?:-(?:(?<channel>alpha|beta)\.(?<prerelease>[1-9]\d*)|(?<correction>[1-9]\d*)))?$/;function parseReleaseVersion(e){let t=e.trim(),n=o.exec(t)?.groups;if(!n)return null;let r=Number(n.year),i=Number(n.month),a=Number(n.patch),s=n.prerelease===void 0?void 0:Number(n.prerelease),c=n.correction===void 0?void 0:Number(n.correction);if(!Number.isSafeInteger(r)||!Number.isSafeInteger(i)||!Number.isSafeInteger(a)||i<1||i>12||a<1||s!==void 0&&!Number.isSafeInteger(s)||c!==void 0&&!Number.isSafeInteger(c))return null;let l=n.channel===`alpha`?`alpha`:n.channel===`beta`?`beta`:`stable`;return{version:t,baseVersion:`${r}.${i}.${a}`,channel:l,year:r,month:i,patch:a,alphaNumber:l===`alpha`?s:void 0,betaNumber:l===`beta`?s:void 0,...c===void 0?{}:{correctionNumber:c}}}function compareReleaseVersions(e,t){let n=parseReleaseVersion(e),r=parseReleaseVersion(t);if(n===null||r===null)return null;if(n.year!==r.year)return Math.sign(n.year-r.year);if(n.month!==r.month)return Math.sign(n.month-r.month);if(n.patch!==r.patch)return Math.sign(n.patch-r.patch);if(n.channel!==r.channel){let e={alpha:0,beta:1,stable:2};return Math.sign(e[n.channel]-e[r.channel])}return n.channel===`alpha`&&r.channel===`alpha`?Math.sign((n.alphaNumber??0)-(r.alphaNumber??0)):n.channel===`beta`&&r.channel===`beta`?Math.sign((n.betaNumber??0)-(r.betaNumber??0)):Math.sign((n.correctionNumber??0)-(r.correctionNumber??0))}const s=`SqliteSchemaVersionError`;var SqliteSchemaVersionError=class extends a{constructor(e){super(`newer-schema`,e),this.name=s}};function isSqliteSchemaVersionError(e){return e instanceof SqliteSchemaVersionError||e instanceof Error&&e.name===s}function readSqliteUserVersion(e){let t=i(e,`PRAGMA user_version`,[],e=>e.get());return Number(t?.user_version??0)}function readSqliteWriterAppVersion(e){try{let t=i(e,`SELECT app_version FROM schema_meta WHERE meta_key = 'primary' LIMIT 1`,[],e=>e.get());return typeof t?.app_version==`string`&&t.app_version.length>0?t.app_version:void 0}catch{return}}function writeSqliteUserVersion(e,t){if(!Number.isInteger(t)||t<0||t>2147483647)throw RangeError(`SQLite user_version must be an integer from 0 through 2147483647.`);e.exec(`PRAGMA user_version = ${t}`)}function describeRunningOpenClawBuild(){let r=e(),i=n({moduleUrl:import.meta.url}),a=r?`OpenClaw ${t} (${r})`:`OpenClaw ${t}`;return i?`${a} installed at ${i}`:a}function isNewerSqliteWriterVersion(e){return(compareReleaseVersions(e??``,t)??0)>0}function createNewerSqliteSchemaVersionError(e,n,i,a,o,s=`runtime`){let c=isNewerSqliteWriterVersion(o),l=c?`; it is newer than this Gateway (${t}).`:s===`runtime`?`; run openclaw doctor --fix to inspect this database.`:`.`;return new SqliteSchemaVersionError(`This OpenClaw build cannot open your existing data. ${e} ${n} uses newer schema version ${i}; this build supports ${a}.\n`+(o&&(s===`runtime`||o!==t)?`It was written by OpenClaw ${o}${l}\n`:``)+`Refused by ${describeRunningOpenClawBuild()}.\n`+(c?`Use the newer install that supports schema ${i} or newer, or run openclaw update to update this Gateway service before restarting. To use an older build, restore your pre-update backup created with openclaw backup create.\n`:`Use a build that supports schema ${i} or newer with this state directory. To use an older build, restore your pre-update backup created with openclaw backup create.\n`)+`See ${r}.`)}var OpenClawAgentDatabaseMediaMigrationRequiredError=class extends a{constructor(e,t){super(`agent-media`,`OpenClaw agent database ${e} uses schema version ${t}; run openclaw doctor --fix to migrate persisted media before using it.`),this.pathname=e,this.schemaVersion=t,this.name=`OpenClawAgentDatabaseMediaMigrationRequiredError`}},SessionMetadataUnavailableError=class extends Error{constructor(e,t,n=[]){super(`Session metadata unavailable (${[e,...n].join(`: `)}); retry after the agent store is ready.`,t),this.reason=e,this.missingTables=n,this.name=`SessionMetadataUnavailableError`}};export{describeRunningOpenClawBuild as a,readSqliteUserVersion as c,createNewerSqliteSchemaVersionError as i,readSqliteWriterAppVersion as l,OpenClawAgentDatabaseMediaMigrationRequiredError as n,isNewerSqliteWriterVersion as o,SqliteSchemaVersionError as r,isSqliteSchemaVersionError as s,SessionMetadataUnavailableError as t,writeSqliteUserVersion as u};