2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { URI } from '../../../../../base/common/uri.js';
7
>
import { isEqualOrParent } from '../../../../../base/common/resources.js';
8
>
import { Event } from '../../../../../base/common/event.js';
9
>
import { Disposable } from '../../../../../base/common/lifecycle.js';
10
>
import { IFileService } from '../../../../files/common/files.js';
11
>
import { ILogService } from '../../../../log/common/log.js';
12
>
import { makeMcpServerCustomization, parseAgentFile, toParsedAgent, type IParsedAgent, type IParsedRule, type IParsedSkill } from '../../../../agentPlugins/common/pluginParsers.js';
13
>
import { CustomizationType, type AgentSelection, type McpServerCustomization } from '../../../common/state/protocol/channels-session/state.js';
14
>
import { CustomizationLoadStatus, customizationId, type AgentCustomization, type ChildCustomization, type Customization, type DirectoryCustomization, type HookCustomization, type PluginCustomization, type RuleCustomization, type SkillCustomization } from '../../../common/state/sessionState.js';
15
>
import type { ISdkResolvedCustomizations } from '../claudeSdkPipeline.js';
16
>
import { deriveMcpState } from './scan/claudeMcpScan.js';
17
>
import { claudeMemoryFiles } from './scan/claudeRuleScan.js';
18
>
import type { IResolvedNativePlugin } from './scan/claudeNativePluginScan.js';
19
>
import { CLAUDE_BUILTIN_AGENTS, buildClaudeBuiltinSkillsContainer, buildSdkBuiltinSkillsContainer } from './claudeBuiltinCommands.js';
20
>
21
>
/**
22
>
* The Claude SDK's built-in default agent. Hidden from the picker:
23
>
* selecting it would be equivalent to "no selection" since the SDK
24
>
* uses it as the fallback when `Options.agent` is omitted.
25
>
*/
26
>
export const CLAUDE_SDK_DEFAULT_AGENT_NAME = 'general-purpose';
27
>
28
>
/**
29
>
* Scheme for synthetic, non-openable URIs that mark SDK-only customizations
30
>
* the disk scan couldn't locate (Decision D2). It has no file provider, so
31
>
* the workbench renders such entries read-only. The writer ({@link nonEditableUri})
32
>
* and reader ({@link resolveClaudeAgentName}) share this constant so the two
33
>
* never drift.
34
>
*/
35
>
const CLAUDE_INTERNAL_SCHEME = 'claude-internal';
36
>
37
function makeDirectory(base: URI, sub: string, contents: CustomizationType.Agent | CustomizationType.Skill | CustomizationType.Rule | CustomizationType.Hook, children: readonly (AgentCustomization | SkillCustomization | RuleCustomization | HookCustomization)[]): DirectoryCustomization {
38
const uri = URI.joinPath(base, '.claude', sub).toString();