fix: describe sandboxed elevated in prompt
This commit is contained in:
@@ -479,6 +479,10 @@ type EmbeddedSandboxInfo = {
|
||||
agentWorkspaceMount?: string;
|
||||
browserControlUrl?: string;
|
||||
browserNoVncUrl?: string;
|
||||
elevated?: {
|
||||
allowed: boolean;
|
||||
defaultLevel: "on" | "off";
|
||||
};
|
||||
};
|
||||
|
||||
function resolveSessionLane(key: string) {
|
||||
@@ -552,8 +556,10 @@ function describeUnknownError(error: unknown): string {
|
||||
|
||||
export function buildEmbeddedSandboxInfo(
|
||||
sandbox?: Awaited<ReturnType<typeof resolveSandboxContext>>,
|
||||
bashElevated?: BashElevatedDefaults,
|
||||
): EmbeddedSandboxInfo | undefined {
|
||||
if (!sandbox?.enabled) return undefined;
|
||||
const elevatedAllowed = Boolean(bashElevated?.enabled && bashElevated.allowed);
|
||||
return {
|
||||
enabled: true,
|
||||
workspaceDir: sandbox.workspaceDir,
|
||||
@@ -562,6 +568,14 @@ export function buildEmbeddedSandboxInfo(
|
||||
sandbox.workspaceAccess === "ro" ? "/agent" : undefined,
|
||||
browserControlUrl: sandbox.browser?.controlUrl,
|
||||
browserNoVncUrl: sandbox.browser?.noVncUrl,
|
||||
...(elevatedAllowed
|
||||
? {
|
||||
elevated: {
|
||||
allowed: true,
|
||||
defaultLevel: bashElevated?.defaultLevel ?? "off",
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -887,7 +901,10 @@ export async function compactEmbeddedPiSession(params: {
|
||||
provider: runtimeProvider,
|
||||
capabilities: runtimeCapabilities,
|
||||
};
|
||||
const sandboxInfo = buildEmbeddedSandboxInfo(sandbox);
|
||||
const sandboxInfo = buildEmbeddedSandboxInfo(
|
||||
sandbox,
|
||||
params.bashElevated,
|
||||
);
|
||||
const reasoningTagHint = provider === "ollama";
|
||||
const userTimezone = resolveUserTimezone(
|
||||
params.config?.agents?.defaults?.userTimezone,
|
||||
@@ -1264,7 +1281,10 @@ export async function runEmbeddedPiAgent(params: {
|
||||
node: process.version,
|
||||
model: `${provider}/${modelId}`,
|
||||
};
|
||||
const sandboxInfo = buildEmbeddedSandboxInfo(sandbox);
|
||||
const sandboxInfo = buildEmbeddedSandboxInfo(
|
||||
sandbox,
|
||||
params.bashElevated,
|
||||
);
|
||||
const reasoningTagHint = provider === "ollama";
|
||||
const userTimezone = resolveUserTimezone(
|
||||
params.config?.agents?.defaults?.userTimezone,
|
||||
|
||||
Reference in New Issue
Block a user