feat: notify on exec exit
This commit is contained in:
@@ -141,6 +141,18 @@ describe("legacy config detection", () => {
|
||||
});
|
||||
expect((res.config as { agent?: unknown }).agent).toBeUndefined();
|
||||
});
|
||||
it("migrates tools.bash to tools.exec", async () => {
|
||||
vi.resetModules();
|
||||
const { migrateLegacyConfig } = await import("./config.js");
|
||||
const res = migrateLegacyConfig({
|
||||
tools: {
|
||||
bash: { timeoutSec: 12 },
|
||||
},
|
||||
});
|
||||
expect(res.changes).toContain("Moved tools.bash → tools.exec.");
|
||||
expect(res.config?.tools?.exec).toEqual({ timeoutSec: 12 });
|
||||
expect((res.config?.tools as { bash?: unknown } | undefined)?.bash).toBeUndefined();
|
||||
});
|
||||
it("accepts per-agent tools.elevated overrides", async () => {
|
||||
vi.resetModules();
|
||||
const { validateConfigObject } = await import("./config.js");
|
||||
|
||||
@@ -24,6 +24,22 @@ export const LEGACY_CONFIG_MIGRATIONS_PART_3: LegacyConfigMigration[] = [
|
||||
changes.push('Updated auth.profiles["anthropic:claude-cli"].mode → "oauth".');
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "tools.bash->tools.exec",
|
||||
describe: "Move tools.bash to tools.exec",
|
||||
apply: (raw, changes) => {
|
||||
const tools = ensureRecord(raw, "tools");
|
||||
const bash = getRecord(tools.bash);
|
||||
if (!bash) return;
|
||||
if (tools.exec === undefined) {
|
||||
tools.exec = bash;
|
||||
changes.push("Moved tools.bash → tools.exec.");
|
||||
} else {
|
||||
changes.push("Removed tools.bash (tools.exec already set).");
|
||||
}
|
||||
delete tools.bash;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "agent.defaults-v2",
|
||||
describe: "Move agent config to agents.defaults and tools",
|
||||
@@ -59,13 +75,11 @@ export const LEGACY_CONFIG_MIGRATIONS_PART_3: LegacyConfigMigration[] = [
|
||||
|
||||
const bash = getRecord(agent.bash);
|
||||
if (bash) {
|
||||
if (tools.exec === undefined && tools.bash === undefined) {
|
||||
if (tools.exec === undefined) {
|
||||
tools.exec = bash;
|
||||
changes.push("Moved agent.bash → tools.exec.");
|
||||
} else if (tools.exec !== undefined) {
|
||||
changes.push("Removed agent.bash (tools.exec already set).");
|
||||
} else {
|
||||
changes.push("Removed agent.bash (tools.bash already set).");
|
||||
changes.push("Removed agent.bash (tools.exec already set).");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,10 @@ export const LEGACY_CONFIG_RULES: LegacyConfigRule[] = [
|
||||
message:
|
||||
"agent.* was moved; use agents.defaults (and tools.* for tool/elevated/exec settings) instead (auto-migrated on load).",
|
||||
},
|
||||
{
|
||||
path: ["tools", "bash"],
|
||||
message: "tools.bash was removed; use tools.exec instead (auto-migrated on load).",
|
||||
},
|
||||
{
|
||||
path: ["agent", "model"],
|
||||
message:
|
||||
|
||||
@@ -135,6 +135,7 @@ const FIELD_LABELS: Record<string, string> = {
|
||||
"agents.list[].tools.byProvider": "Agent Tool Policy by Provider",
|
||||
"tools.exec.applyPatch.enabled": "Enable apply_patch",
|
||||
"tools.exec.applyPatch.allowModels": "apply_patch Model Allowlist",
|
||||
"tools.exec.notifyOnExit": "Exec Notify On Exit",
|
||||
"tools.message.allowCrossContextSend": "Allow Cross-Context Messaging",
|
||||
"tools.message.crossContext.allowWithinProvider": "Allow Cross-Context (Same Provider)",
|
||||
"tools.message.crossContext.allowAcrossProviders": "Allow Cross-Context (Across Providers)",
|
||||
@@ -288,6 +289,8 @@ const FIELD_HELP: Record<string, string> = {
|
||||
"Experimental. Enables apply_patch for OpenAI models when allowed by tool policy.",
|
||||
"tools.exec.applyPatch.allowModels":
|
||||
'Optional allowlist of model ids (e.g. "gpt-5.2" or "openai/gpt-5.2").',
|
||||
"tools.exec.notifyOnExit":
|
||||
"When true (default), backgrounded exec sessions enqueue a system event and request a heartbeat on exit.",
|
||||
"tools.message.allowCrossContextSend":
|
||||
"Legacy override: allow cross-context sends across all providers.",
|
||||
"tools.message.crossContext.allowWithinProvider":
|
||||
|
||||
@@ -263,6 +263,8 @@ export type ToolsConfig = {
|
||||
timeoutSec?: number;
|
||||
/** How long to keep finished sessions in memory (ms). */
|
||||
cleanupMs?: number;
|
||||
/** Emit a system event and heartbeat when a backgrounded exec exits. */
|
||||
notifyOnExit?: boolean;
|
||||
/** apply_patch subtool configuration (experimental). */
|
||||
applyPatch?: {
|
||||
/** Enable apply_patch for OpenAI models (default: false). */
|
||||
@@ -274,15 +276,6 @@ export type ToolsConfig = {
|
||||
allowModels?: string[];
|
||||
};
|
||||
};
|
||||
/** @deprecated Use tools.exec. */
|
||||
bash?: {
|
||||
/** Default time (ms) before a bash command auto-backgrounds. */
|
||||
backgroundMs?: number;
|
||||
/** Default timeout (seconds) before auto-killing bash commands. */
|
||||
timeoutSec?: number;
|
||||
/** How long to keep finished sessions in memory (ms). */
|
||||
cleanupMs?: number;
|
||||
};
|
||||
/** Sub-agent tool policy defaults (deny wins). */
|
||||
subagents?: {
|
||||
/** Default model selection for spawned sub-agents (string or {primary,fallbacks}). */
|
||||
|
||||
@@ -324,6 +324,7 @@ export const ToolsSchema = z
|
||||
backgroundMs: z.number().int().positive().optional(),
|
||||
timeoutSec: z.number().int().positive().optional(),
|
||||
cleanupMs: z.number().int().positive().optional(),
|
||||
notifyOnExit: z.boolean().optional(),
|
||||
applyPatch: z
|
||||
.object({
|
||||
enabled: z.boolean().optional(),
|
||||
@@ -332,13 +333,6 @@ export const ToolsSchema = z
|
||||
.optional(),
|
||||
})
|
||||
.optional(),
|
||||
bash: z
|
||||
.object({
|
||||
backgroundMs: z.number().int().positive().optional(),
|
||||
timeoutSec: z.number().int().positive().optional(),
|
||||
cleanupMs: z.number().int().positive().optional(),
|
||||
})
|
||||
.optional(),
|
||||
subagents: z
|
||||
.object({
|
||||
tools: ToolPolicySchema,
|
||||
|
||||
Reference in New Issue
Block a user