Use canonical host chains for automation scripts

This commit is contained in:
2026-11-07 14:42:09 +00:00
parent c9d2dd0b7c
commit 66d5c7eea4
-11
View File
@@ -1,11 +0,0 @@
/** Script credentials follow the creator's ownership, fork, and branch ancestry, in T44 order. */
import { defineDoc } from '@earendil-works/pi-durable'
import { BACKGROUND_CONTEXT as context } from '@earendil-works/chord/context'
const Started = defineDoc<{by?:number}>({kind:'board.started',version:1,scope:'conversation',history:'latest',fork:'initial',checkpointWhen:()=>false,initial:()=>({})})
export async function executionChain(host: any, creator?: number): Promise<string[]> {
if (creator === undefined) return []
const record = await host.harness().commit((tx: any) => tx.conversation(creator), context)
const up = record?.owner?.conversationId ?? record?.parent?.conversationId ??
(await host.harness().snapshot(Started, creator, context))?.by
return [String(creator), ...await executionChain(host, up)]
}