UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

19 lines (18 loc) • 1.21 kB
import { deliverEngineNotice } from "../engine-notice.js"; export async function resolveTaskRootCanonical(input) { const c = await input.env.canonicalPath(input.given); if (!c.ok) return { canonical: input.given, announced: false }; if (c.value === input.given) return { canonical: c.value, announced: false }; deliverEngineNotice(input.onNotice, { code: "config.task_root_not_canonical", message: `The task root handed to this run is "${input.given}", which is not its own canonical path ("${c.value}"). ` + `Containment is judged on the canonical spelling — the roots fence, the shell read boundary and every ` + `refusal message read it — so a target this deployment considers inside the root can be judged outside ` + `it whenever the two spellings differ (a symlinked directory; /var → /private/var on macOS). The run ` + `proceeds on the canonical spelling exactly as before: hand the canonical path in to make the two agree.`, detail: { given: input.given, canonical: c.value, sessionId: input.sessionId, runId: input.runId }, }); return { canonical: c.value, announced: true }; }