openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 1.45 kB
JavaScript
import"./transcript-path-guards-u0N7Z9_x.mjs";import"./transcript-state-dir-DEo0wD2Q.mjs";import{f as e,m as t}from"./transcript-store-entry-Ch3rW6qd.mjs";import"./transcript-agent-scope-config-l-KZcQvf.mjs";import"node:path";import"node:fs/promises";function isDreamingNarrativeSessionKeyLike(e){return typeof e==`string`&&t(e)}function classifySessionEntry(e,n,r){let i=t(e)||isDreamingNarrativeSessionKeyLike(n.spawnedBy),a=r.has(e);return{generatedByDreamingNarrative:i,generatedByCronRun:a,sessionKind:a?`cron`:typeof n.heartbeatIsolatedBaseSessionKey==`string`&&n.heartbeatIsolatedBaseSessionKey.trim()?`heartbeat`:i||n.spawnedBy||e.includes(`:subagent:`)?`subagent`:`interactive`}}function readParentSessionKeys(e){let t=/* @__PURE__ */ new Set;for(let n of[e?.parentSessionKey,e?.spawnedBy]){if(typeof n!=`string`)continue;let e=n.trim();e&&t.add(e)}return[...t]}function collectCronGeneratedSessionKeys(t){let n=new Map(t.map(e=>[e.sessionKey,e.entry])),r=/* @__PURE__ */ new Set,i=/* @__PURE__ */ new Set,a=/* @__PURE__ */ new Map,isCronGenerated=(t,o)=>{if(e(t))return r.add(t),!0;if(i.has(t))return r.has(t);i.add(t);let s=readParentSessionKeys(o).some(e=>{let r=a.get(e)??[];return r.push(t),a.set(e,r),isCronGenerated(e,n.get(e))});return s&&r.add(t),s};for(let e of t)isCronGenerated(e.sessionKey,e.entry);for(let e of r)for(let t of a.get(e)??[])r.add(t);return r}export{collectCronGeneratedSessionKeys as n,classifySessionEntry as t};