Keep shared external cron cwd (e.g. D:\code\gpt) instead of silent clamp.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-10 11:23:41 +08:00
parent 7a2a673ac2
commit 43facd608a
5 changed files with 111 additions and 14 deletions

View file

@ -22,6 +22,12 @@ export const DEFAULT_SETTINGS = {
historyLimit: 200,
overlapPolicy: 'skip',
misfirePolicy: 'skip',
/**
* When true (default), an explicit job cwd that lies OUTSIDE the multi-tenant
* provision forest (workspaceRoot/<empNo>) is kept — e.g. D:\\code\\gpt.
* Paths under the forest but not the owner's tree are still clamped.
*/
allowExternalCwd: true,
}
export function emptyState() {
@ -37,6 +43,9 @@ export function emptyState() {
export function normalizeSettings(input = {}, fallback = DEFAULT_SETTINGS) {
const src = input && typeof input === 'object' ? input : {}
const historyLimit = Number(src.historyLimit)
const allowExternalCwd = src.allowExternalCwd !== undefined
? src.allowExternalCwd !== false
: fallback.allowExternalCwd !== false
return {
enabled: src.enabled !== false,
timezone: typeof src.timezone === 'string' && src.timezone.trim()
@ -47,6 +56,7 @@ export function normalizeSettings(input = {}, fallback = DEFAULT_SETTINGS) {
: fallback.historyLimit,
overlapPolicy: src.overlapPolicy === 'skip' ? 'skip' : fallback.overlapPolicy,
misfirePolicy: src.misfirePolicy === 'skip' ? 'skip' : fallback.misfirePolicy,
allowExternalCwd,
}
}