UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

43 lines (42 loc) • 2.02 kB
import { C as isSubagentSessionKey, y as isAcpSessionKey } from "./session-key-CqAyZeVk.mjs"; import { n as DEFAULT_BOOTSTRAP_FILENAME } from "./workspace-bootstrap-policy-D7EJ00Ub.mjs"; import "./workspace-DLlXz3VE.mjs"; import { t as resolveBootstrapMode } from "./bootstrap-mode-CGmz_L_9.mjs"; //#region src/agents/bootstrap-routing.ts /** * Resolves workspace bootstrap routing for one agent run. Shared by the * embedded attempt runner and CLI-backend runs so both runtimes gate the * first reply on a pending BOOTSTRAP.md the same way. */ /** * Returns whether a session should receive primary bootstrap context. Subagents * and ACP worker sessions inherit/run their own context path instead of getting * the top-level bootstrap payload again. */ function isPrimaryBootstrapRun(e) { return !isSubagentSessionKey(e) && !isAcpSessionKey(e); } /** * Resolves workspace bootstrap routing after checking pending state and * loaded bootstrap files. Content can prove bootstrap is pending; callers * decide whether that content also proves the run can complete file changes. */ async function resolveWorkspaceBootstrapRouting(e) { const t = e.bootstrapFiles?.some((e) => e.name === "BOOTSTRAP.md" && !e.missing && typeof e.content === "string" && e.content.trim().length > 0) ?? false; const n = t || await e.isWorkspaceBootstrapPending(e.resolvedWorkspace); const r = resolveBootstrapMode({ bootstrapPending: n, runKind: e.bootstrapContextRunKind ?? "default", isInteractiveUserFacing: e.trigger === "user" || e.trigger === "manual", isPrimaryRun: e.isPrimaryRun, isCanonicalWorkspace: (e.isCanonicalWorkspace ?? true) && e.effectiveWorkspace === e.resolvedWorkspace, hasBootstrapFileAccess: e.hasBootstrapFileAccess || e.bootstrapFilesProvideAccess !== false && t }); return { bootstrapMode: r, deliversCompleteWorkspaceContext: r === "full" || !n, includeBootstrapInSystemContext: r === "full" }; } //#endregion export { resolveWorkspaceBootstrapRouting as n, isPrimaryBootstrapRun as t };