Preface¶
DeepSeek Harness (DSH) adopts a pluggable architecture designed to give agents internet access and tool-calling capabilities. When developing agents involving calendar management, automating Apple iCloud calendars across platforms faces technical limitations: Apple has not exposed a REST API for iCloud Calendar, and EventKit is only available natively on macOS. The only viable cross-platform automation entry point is CalDAV (RFC 4791).
dsh-icloud-calendar is a DeepSeek Harness (DSH) plugin that reads and writes Apple iCloud calendars via the CalDAV protocol, with built-in cross-platform credential storage, request timeout retry mechanisms, and confirmed deletion protection.
Plugin Introduction¶
Plugin Name: dsh-icloud-calendar
Maintainer: CaiMingshen
License: MIT
Core Value: Provides a standardized CalDAV client that solves the problem of automated read/write operations when iCloud Calendar lacks an official API, and strictly designs a safety gate for delete operations.
Core Features¶
This plugin provides the following core capabilities:
1. CalDAV Read/Write: Connects to https://caldav.icloud.com/ via the standard protocol, supporting calendar creation and event management.
2. Calendar & Event Operations: Lists calendars and events (automatically expands recurring schedules), supports creating events.
3. Safe Deletion Mechanism: Implements a four-gate deletion protection (master switch, time window, exact match, secondary confirmation); deletion is off by default and defaults to dry run.
4. Cross-platform Credential Storage: Automatically adapts credential storage for Windows (DPAPI), macOS (Keychain), and Linux (libsecret).
5. Network Robustness: Supports request timeouts, automatic retries, and HTTP proxy configuration (requires undici dependency).
Installation & Configuration¶
Before installation, ensure the environment meets the following requirements:
* DSH version >=0.2.0-rc.2
* Node.js version ^22.19 || >=24
Installation Command:
dsh plugin --profile web add github:<your-username>/dsh-icloud-calendar
After installing the plugin, configuration must be inserted into cordis.patch.yml to enable the service and tools. This plugin is distributed as a bundle, with configuration in two lines:
1. dsh-icloud-calendar/host: Registers the service, handles connection reuse, caching, and policies.
2. dsh-icloud-calendar/tools: Exposes the service as 5 model-visible tools.
Configuration example:
- insert:
- id: icloud-calendar-host
name: 'dsh-icloud-calendar/host'
config:
account: 'you@example.com' # iCloud account
secretEnv: ICLOUD_APP_PASSWORD # environment variable containing the password
secretSource: auto # auto | env | store
allowWrites: true
allowDeletes: false # deletion off by default
maxDeletesPerCall: 1
timeoutMs: 30000
retries: 2
proxyUrl: '' # HTTP proxy address
- id: icloud-calendar-tools
name: 'dsh-icloud-calendar/tools'
Note: The plugin configuration file will not contain password fields to prevent plaintext leakage. Passwords are read from system credential stores or environment variables.
Credential Management¶
The plugin requires Apple App-Specific Passwords; using Apple ID login passwords is strictly prohibited.
Generating App-Specific Password:
1. Sign in to the Apple ID Account Management page.
2. Go to “Sign-In and Security” -> “App-Specific Passwords” -> “Generate”.
3. Obtain a string similar to abcd-efgh-ijkl-mnop.
Credential Sources:
* System credential store (recommended): Windows uses DPAPI, macOS uses Keychain, Linux uses libsecret.
* Environment variable: Specify the variable name via secretEnv (defaults to ICLOUD_APP_PASSWORD).
* Reading method: On Windows/Linux, the password is read from standard input (stdin); on macOS, it is passed via command-line arguments.
Tools & Usage¶
The plugin provides 5 model-visible tools and a companion command-line tool.
Model-visible tools:
* calendar_status: Check configuration, credential sources, and connectivity.
* calendar_list_calendars: List calendars and their properties.
* calendar_list_events: Read events by time window (recurring schedules expanded).
* calendar_create_event: Create events.
* calendar_delete_events: Delete events.
CLI command examples:
# 1. Probe connection status
dsh-icloud-calendar status --probe
# 2. Login (password read from stdin)
dsh-icloud-calendar login --account you@example.com
# 3. List events in a specified time window
dsh-icloud-calendar events --start 2026-01-05T00:00:00+08:00 --end 2026-01-12T00:00:00+08:00
# 4. Create an event
dsh-icloud-calendar add --summary 'Review' --start 2026-01-05T09:00:00+08:00 --end 2026-01-05T10:00:00+08:00 --time-zone Asia/Shanghai
# 5. Delete events (dry run by default, confirmation parameter required)
dsh-icloud-calendar delete --start 2026-01-01T00:00:00+08:00 --end 2026-02-01T00:00:00+08:00 --uid <uid>
Delete Safety Mechanism¶
To prevent accidental deletion, delete operations are designed with four gates:
1. Master switch: Defaults to allowDeletes: false, must be manually enabled.
2. Time window: Must specify start and end, and the deletion window upper limit (default 90 days) is usually smaller than the read window.
3. Exact match: Can only use uid (from list events) or summaryEquals (full title, case-sensitive), rejecting substrings or fuzzy matches.
4. Secondary confirmation: Defaults to dryRun=true. Real deletion requires setting dryRun=false and confirmCount equal to the number of matched objects, subject to the maxDeletesPerCall (default 1) limit.
Notes¶
- Proxy support: The HTTP proxy feature relies on the optional dependency
undici; a clear prompt will be given when it is not installed. - Default behavior: Delete operations default to dry run; real deletion requires meeting the multiple conditions above.
- Permissions & network: The plugin runs with DSH process permissions; please check the source code and license before installation. Direct connections to iCloud from within China may require proxy configuration.
- Credential security: Credentials will not appear in profile configuration files, preventing plaintext leakage.
Conclusion¶
dsh-icloud-calendar provides a standard access solution for iCloud Calendar in the DSH plugin ecosystem. Through the CalDAV protocol and strict deletion gate design, it can provide secure and reliable calendar automation capabilities while ensuring cross-platform compatibility.