Theia API Documentation v1.73.0
    Preparing search index...
    interface PromptFragmentCustomizationService {
        onDidChangeCustomAgents: Event<void>;
        onDidChangePromptFragmentCustomization: Event<string[]>;
        createBuiltInPromptFragmentCustomization(
            fragmentId: string,
            defaultContent?: string,
        ): Promise<void>;
        createCustomAgentFile(
            parentDirectory: URI,
            agent: CustomAgentDescription,
        ): Promise<URI>;
        createPromptFragmentCustomization(
            fragmentId: string,
            defaultContent?: string,
        ): Promise<void>;
        editBuiltInPromptFragmentCustomization(
            fragmentId: string,
            defaultContent?: string,
        ): Promise<void>;
        editPromptFragmentCustomization(
            fragmentId: string,
            customizationId: string,
        ): Promise<void>;
        getActivePromptFragmentCustomization(
            fragmentId: string,
        ): undefined | CustomizedPromptFragment;
        getAllCustomizations(fragmentId: string): CustomizedPromptFragment[];
        getCustomAgents(): Promise<CustomAgentDescription[]>;
        getCustomAgentsLocations(): Promise<CustomAgentsLocation[]>;
        getCustomizedPromptFragmentIds(): string[];
        getPromptFragmentCustomizationDescription(
            fragmentId: string,
            customizationId: string,
        ): Promise<undefined | string>;
        getPromptFragmentCustomizationType(
            fragmentId: string,
            customizationId: string,
        ): Promise<undefined | string>;
        getPromptFragmentIDFromResource(resourceId: unknown): undefined | string;
        isPromptFragmentCustomized(fragmentId: string): boolean;
        migrateCustomAgentsYaml(): Promise<
            {
                alreadyPresent: number;
                failed: number;
                migrated: number;
                promptOverridesMigrated: number;
                scope: URI;
                yamlBackedUp: boolean;
                yamlURI: URI;
            }[],
        >;
        openCustomAgentYaml(uri: URI): Promise<void>;
        removeAllPromptFragmentCustomizations(fragmentId: string): Promise<void>;
        removePromptFragmentCustomization(
            fragmentId: string,
            customizationId: string,
        ): Promise<void>;
        resetToCustomization(
            fragmentId: string,
            customizationId: string,
        ): Promise<void>;
    }

    Implemented by

    Index

    Properties

    onDidChangeCustomAgents: Event<void>

    Event fired when custom agents are modified

    onDidChangePromptFragmentCustomization: Event<string[]>

    Event fired when a prompt fragment is changed

    Methods

    • Creates a customization based on a built-in fragment

      Parameters

      • fragmentId: string

        The ID of the built-in fragment to customize

      • OptionaldefaultContent: string

        Optional default content for the customization

      Returns Promise<void>

    • Creates a per-agent file at <parentDirectory>/agents/<agent.id>/agent.md from the given description, then opens it. Replaces a previously existing agent.md for the same id.

      Parameters

      • parentDirectory: URI

        The prompt-templates scope (e.g. workspace .prompts/ or the global templates dir)

      • agent: CustomAgentDescription

        The agent description to serialize

      Returns Promise<URI>

      The URI of the created file

    • Creates a new customization for a prompt fragment

      Parameters

      • fragmentId: string

        The fragment ID to customize

      • OptionaldefaultContent: string

        Optional default content for the customization

      Returns Promise<void>

    • Edits the built-in customization of a prompt fragment

      Parameters

      • fragmentId: string

        The prompt fragment ID to edit

      • OptionaldefaultContent: string

        Optional default content for the customization

      Returns Promise<void>

    • Edits a specific customization of a prompt fragment

      Parameters

      • fragmentId: string

        The prompt fragment ID

      • customizationId: string

        The customization ID to edit

      Returns Promise<void>

    • Gets information about the description of a customization

      Parameters

      • fragmentId: string

        The fragment ID

      • customizationId: string

        The customization ID

      Returns Promise<undefined | string>

      Description of the customization

    • Gets information about the source/type of a customization

      Parameters

      • fragmentId: string

        The fragment ID

      • customizationId: string

        The customization ID

      Returns Promise<undefined | string>

      Type of the customization source

    • Gets the fragment ID from a resource identifier

      Parameters

      • resourceId: unknown

        Resource identifier (implementation specific)

      Returns undefined | string

      Fragment ID or undefined if not found

    • Checks if a prompt fragment has customizations

      Parameters

      • fragmentId: string

        The prompt fragment ID

      Returns boolean

      Whether the fragment has any customizations

    • Migrates every reachable customAgents.yml to the per-agent agents/<id>/agent.md layout. The user's original content is never deleted: on success (or on partial failure when no backup exists yet) the YAML is renamed to customAgents.yml.bak; if a .bak already exists it is not overwritten and the YAML is left in place. Idempotent — rerunning never overwrites an already-migrated agent file.

      Returns Promise<
          {
              alreadyPresent: number;
              failed: number;
              migrated: number;
              promptOverridesMigrated: number;
              scope: URI;
              yamlBackedUp: boolean;
              yamlURI: URI;
          }[],
      >

    • Parameters

      • uri: URI

        The URI of the customAgents.yml file to open or create

      Returns Promise<void>

      Use createCustomAgentFile to author agents in the new <scope>/agents/<id>/agent.md layout. Kept so legacy callers continue to work until they are migrated.

      Opens an existing customAgents.yml file at the given URI, or creates a new one if it doesn't exist.

    • Resets a fragment to its built-in version by removing all customizations

      Parameters

      • fragmentId: string

        The fragment ID to reset

      Returns Promise<void>

    • Removes a specific customization of a prompt fragment

      Parameters

      • fragmentId: string

        The prompt fragment ID

      • customizationId: string

        The customization ID to remove

      Returns Promise<void>

    • Resets to a specific customization by removing higher-priority customizations

      Parameters

      • fragmentId: string

        The fragment ID

      • customizationId: string

        The customization ID to reset to

      Returns Promise<void>