Introduction

DeepSeek Harness (DSH) adopts a plugin-based architecture that aims to build agents through composable components. When writing test code or processing structured data, string operations based on precise character indices are often required. The xby-char-index plugin, maintained by xby-skill, provides a protocol server for character-index-based string operations, suitable for test code generation and data processing scenarios that require precise character positioning.

Core Features

This plugin provides the following string operation capabilities:

  • API Key Management:

    • set_xby_apikey: Sets an API key during the conversation. Once set, it is automatically persisted and remains valid after restart.
  • Character Positioning:

    • find_nth_char: Finds the index of the nth occurrence of a specified character. Returns -1 if not found.
    • find_all_char_indices: Finds the indices of all occurrences of a specified character. Returns an empty list if not found.
    • find_nth_substring: Finds the starting index of the nth occurrence of a specified substring. Returns -1 if not found.
    • find_all_substring_indices: Finds the starting indices of all occurrences of a specified substring (including overlapping occurrences).
  • String Editing:

    • split_at_indices: Splits text at exact indices. Indices are automatically sorted and deduplicated.
    • insert_at_index: Inserts text at an index position (without replacing existing content). Negative indices are supported.
    • delete_range: Deletes characters within a specified range.
    • replace_range: Replaces characters within a specified range with new text.
  • Regular Expressions and Extraction:

    • find_regex_matches: Finds all regular expression matches and their location information.
    • extract_between_markers: Extracts the content between markers and their location information.
  • Statistics and Slicing:

    • count_chars: Counts characters and returns statistics for the total count, non-space characters, letters, numbers, spaces, and special characters.
    • extract_substrings: Extracts substrings by index ranges. Negative indices are supported, and the end index can be omitted.

Installation

Install from the GitHub repository:

dsh plugin --profile web add github:xby_skill/xby-char-index

Configuration

Before using this plugin, you must register on the official Xiaoben Yang website and obtain an API key. After setting the API key, the configuration is automatically persisted and remains valid after restarting DSH.

Typical Usage

  • Find all indices of a character or substring for subsequent split or replace operations.
  • Insert text at specific index positions to construct test data in specific formats.
  • Use regular expressions to extract target content and its location information.
  • Count the character distribution in a string.

Applicable Scenarios

This plugin is primarily intended for agent development scenarios that require high-precision string operations, such as controlling exact character positions when generating test code, or performing complex data cleaning and extraction. The code is open-sourced under the MIT License.