feat(hooks): add cleanup and cleanupDelayMinutes to HookMappingConfig
This commit is contained in:
parent
4583f88626
commit
bfde8e1213
45
src/config/types.hooks.test.ts
Normal file
45
src/config/types.hooks.test.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { describe, expect, it } from "vitest";
|
||||||
|
import type { HookMappingConfig } from "./types.hooks.js";
|
||||||
|
|
||||||
|
describe("HookMappingConfig", () => {
|
||||||
|
it("accepts cleanup option with delete value", () => {
|
||||||
|
const config: HookMappingConfig = {
|
||||||
|
id: "test",
|
||||||
|
match: { path: "test" },
|
||||||
|
action: "agent",
|
||||||
|
cleanup: "delete",
|
||||||
|
};
|
||||||
|
expect(config.cleanup).toBe("delete");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("accepts cleanup option with keep value", () => {
|
||||||
|
const config: HookMappingConfig = {
|
||||||
|
id: "test",
|
||||||
|
match: { path: "test" },
|
||||||
|
action: "agent",
|
||||||
|
cleanup: "keep",
|
||||||
|
};
|
||||||
|
expect(config.cleanup).toBe("keep");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("accepts cleanupDelayMinutes option", () => {
|
||||||
|
const config: HookMappingConfig = {
|
||||||
|
id: "test",
|
||||||
|
match: { path: "test" },
|
||||||
|
action: "agent",
|
||||||
|
cleanup: "delete",
|
||||||
|
cleanupDelayMinutes: 5,
|
||||||
|
};
|
||||||
|
expect(config.cleanupDelayMinutes).toBe(5);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("allows cleanup fields to be omitted", () => {
|
||||||
|
const config: HookMappingConfig = {
|
||||||
|
id: "test",
|
||||||
|
match: { path: "test" },
|
||||||
|
action: "agent",
|
||||||
|
};
|
||||||
|
expect(config.cleanup).toBeUndefined();
|
||||||
|
expect(config.cleanupDelayMinutes).toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -36,6 +36,10 @@ export type HookMappingConfig = {
|
|||||||
thinking?: string;
|
thinking?: string;
|
||||||
timeoutSeconds?: number;
|
timeoutSeconds?: number;
|
||||||
transform?: HookMappingTransform;
|
transform?: HookMappingTransform;
|
||||||
|
/** Session cleanup after hook completes. "delete" removes session + transcript. Default: "keep" */
|
||||||
|
cleanup?: "delete" | "keep";
|
||||||
|
/** Minutes to wait before cleanup when cleanup="delete". Default: 0 (immediate) */
|
||||||
|
cleanupDelayMinutes?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HooksGmailTailscaleMode = "off" | "serve" | "funnel";
|
export type HooksGmailTailscaleMode = "off" | "serve" | "funnel";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user