openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 1.13 kB
JavaScript
import{i as e}from"./transcript-record-coerce-CPLgmAk9.mjs";import{r as t}from"./transcript-number-coercion-D2B2TTt-.mjs";import{randomUUID as n}from"node:crypto";function createSessionTranscriptHeader(e={}){return{type:`session`,version:e.version??4,id:e.sessionId??n(),timestamp:e.timestamp??(/* @__PURE__ */ new Date()).toISOString(),cwd:e.cwd??process.cwd(),...e.parentSession?{parentSession:e.parentSession}:{},...e.inheritedThrough?.length?{inheritedThrough:[...e.inheritedThrough]}:{}}}function readInheritedThrough(t){let n=e(t)?.inheritedThrough;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):[]}function readSessionTranscriptHeaderStartedAt(n,r){let i=e(n);if(i?.type!==`session`||typeof i.id==`string`&&i.id.trim()&&i.id!==r)return;let a=i.timestamp,o=typeof a==`number`?a:typeof a==`string`&&a.trim()?Date.parse(a):void 0,s=t(o);return s!==void 0&&s>=0?s:void 0}function resolveResetBoundaryHeaderCwd(e,t){return e.spawnedCwd??e.spawnedWorkspaceDir??t}export{resolveResetBoundaryHeaderCwd as i,readInheritedThrough as n,readSessionTranscriptHeaderStartedAt as r,createSessionTranscriptHeader as t};