323
let worktreeIncludeFilesProperty: ISchemaProperty<readonly string[]> | undefined;
324
if (gitInfo) {
326
>
branchDefault = isolationValue === 'worktree' ? gitInfo.defaultBranch.name : gitInfo.currentBranch;
327
>
branchValue = isolationValue === 'worktree' && typeof request.config?.[SessionConfigKey.Branch] === 'string'
328
? request.config[SessionConfigKey.Branch] as string
329
: branchDefault;
331
>
type: 'string',
332
>
title: localize('agentHost.sessionConfig.branch', "Branch"),
333
>
description: localize('agentHost.sessionConfig.branchDescription', "Base branch to work from"),
334
>
enum: [branchDefault],
335
>
enumLabels: [branchDefault],
336
>
default: branchDefault,
337
>
enumDynamic: !branchReadOnly,
338
>
readOnly: branchReadOnly,
339
>
sessionMutable: false,
340
>
});
341
>
342
>
// Carrier for the client's `git.branchPrefix`: the host prepends it
343
>
// to the branch it creates for an isolated worktree. Declared for
344
>
// both isolations (like `branch`), so the value rides
345
>
// `_config.values` and survives isolation toggles — a user who flips
346
>
// worktree → folder → worktree keeps the prefix. It has no
347
>
// `enum`/`enumDynamic`, so the config picker treats it as
348
>
// non-pickable and never surfaces it as a chip: the client seeds it
349
>
// (from `git.branchPrefix`), the user never edits it, and the host
350
>
// only *consumes* it for worktree isolation (see
351
>
// {@link resolveWorkingDirectory}).
352
>
worktreeBranchPrefixProperty = schemaProperty<string>({
353
>
type: 'string',
354
>
title: localize('agentHost.sessionConfig.worktreeBranchPrefix', "Worktree Branch Prefix"),
355
>
description: localize('agentHost.sessionConfig.worktreeBranchPrefixDescription', "Prefix applied to the branch created for an isolated worktree."),
356
>
readOnly: true,
357
>
sessionMutable: false,
358
>
});
359
>
360
>
worktreeIncludeFilesProperty = schemaProperty<readonly string[]>({
361
>
type: 'array',
362
>
title: localize('agentHost.sessionConfig.worktreeIncludeFiles', "Worktree Include Files"),
363
>
description: localize('agentHost.sessionConfig.worktreeIncludeFilesDescription', "Glob patterns for git-ignored files to copy into the isolated worktree."),
364
>
items: {
365
>
type: 'string',
366
>
title: localize('agentHost.sessionConfig.worktreeIncludeFilesItem', "Pattern"),
367
>
},
368
>
readOnly: true,
369
>
sessionMutable: false,
370
>
});
371
>
}
372
373
return { isolationProperty, branchProperty, worktreeBranchPrefixProperty, worktreeIncludeFilesProperty, isolationValue, branchDefault, branchValue };