fn provision()
Create the bridge dirs and write the plugin's 0600 .auth_token copy of {v,secret,instance}
fn sync()
Rule-6 fan-out: ONE execution pulls tasks+projects+tags from the plugin and writes all three CEL-referenceable resources (instance 'main'). Avoids per-model lock contention.
fn get_tasks(includeArchived: boolean)
Fetch tasks from SP and persist the `tasks` snapshot (privacy-filtered).
| Argument | Type | Required | Description |
|---|
| includeArchived | boolean | yes | Include archived tasks. |
fn get_current_task()
Fetch the currently-selected SP task and persist `currentTask`.
fn get_worklog()
Fetch time-tracking / worklog data and persist the `worklog` snapshot.
fn create_task(title: string, projectId?: string, tagIds?: array, parentId?: string, notes?: string, timeEstimate?: number, addToToday: boolean, dueDay?: string)
Create a task in SP (addTask). Returns the new task id via a refreshed `tasks` snapshot.
| Argument | Type | Required | Description |
|---|
| title | string | yes | Task title (SP @/#/+ syntax supported by the plugin). |
| projectId? | string | no | Target project id. Ignored when parentId is set (subtasks inherit the parent's project). |
| tagIds? | array | no | Tag ids to attach (NOT 'TODAY' — use addToToday). Ignored when parentId is set (subtasks inherit the parent's tags). |
| parentId? | string | no | Create as a subtask of this EXISTING task id (SP routes it through addSubTask; the subtask |
| notes? | string | no | |
| timeEstimate? | number | no | Estimate in ms. |
| addToToday | boolean | yes | Also place the new task on SP's Today list (sets dueDay + TODAY tag order). Default false. |
| dueDay? | string | no | YYYY-MM-DD for Today placement; defaults to the plugin host's today. |
fn update_task(taskId: string, title?: string, notes?: string, projectId?: string, tagIds?: array, timeEstimate?: number, isDone?: boolean, dueDay?: string)
Update fields on an existing SP task (updateTask).
| Argument | Type | Required | Description |
|---|
| taskId | string | yes | |
| title? | string | no | |
| notes? | string | no | |
| projectId? | string | no | |
| tagIds? | array | no | Replaces the task's tags. 'TODAY' here is auto-routed to the Today mechanism (dueDay + tag order), |
| timeEstimate? | number | no | |
| isDone? | boolean | no | |
| dueDay? | string | no | YYYY-MM-DD; sets the planned day (Today = today's date). |
fn plan_for_today(taskIds: array, dueDay?: string)
Add task(s) to SP's Today list the way SP itself does: set dueDay=today AND prepend to the TODAY
| Argument | Type | Required | Description |
|---|
| taskIds | array | yes | Task ids to plan for today. |
| dueDay? | string | no | YYYY-MM-DD; defaults to the plugin host's today. |
fn remove_from_today(taskIds: array, clearDueDay: boolean)
Remove task(s) from SP's Today list (drop from the TODAY tag's taskIds; optionally clear dueDay).
| Argument | Type | Required | Description |
|---|
| taskIds | array | yes | |
| clearDueDay | boolean | yes | Also null out dueDay (fully unschedule). Default false. |
fn complete_task(taskId: string)
Mark an SP task done (updateTask isDone:true).
| Argument | Type | Required | Description |
|---|
| taskId | string | yes | |
fn log_time(taskId: string, durationMs: number, date?: string, mode: enum)
Log/adjust time spent on a task for a given day by writing SP's canonical
| Argument | Type | Required | Description |
|---|
| taskId | string | yes | |
| durationMs | number | yes | Milliseconds. mode:add → delta added to the day (may be negative to correct); |
| date? | string | no | YYYY-MM-DD. Omit ⇒ the plugin's local today (SP's _todayStr()). |
| mode | enum | yes | |
fn notify(title: string, body: string)
Fire a native OS notification via SP (PluginAPI.notify) — a workflow primitive.
| Argument | Type | Required | Description |
|---|
| title | string | yes | |
| body | string | yes | |
fn batch(projectId: string, operations: array)
Apply N structural operations to ONE project in a single plugin dispatch
| Argument | Type | Required | Description |
|---|
| projectId | string | yes | The project all operations apply within. |
| operations | array | yes | Ordered batch operations. |
fn delete_task(taskId: string)
Permanently delete an SP task (PluginAPI.deleteTask). Destructive — verify the
| Argument | Type | Required | Description |
|---|
| taskId | string | yes | |
fn create_tag(title: string, color?: string, icon?: string)
Create an SP tag (PluginAPI.addTag). Refreshes snapshots via sync so the new tag id is CEL-referenceable.
| Argument | Type | Required | Description |
|---|
| title | string | yes | |
| color? | string | no | Hex color, e.g. '#2196f3'. |
| icon? | string | no | Material icon name. |
fn update_tag(tagId: string, title?: string, color?: string, icon?: string)
Update fields on an existing SP tag (PluginAPI.updateTag). Refreshes snapshots via sync.
| Argument | Type | Required | Description |
|---|
| tagId | string | yes | |
| title? | string | no | |
| color? | string | no | |
| icon? | string | no | |
fn create_project(title: string)
Create an SP project (PluginAPI.addProject). Refreshes snapshots via sync so the new project id is CEL-referenceable.
| Argument | Type | Required | Description |
|---|
| title | string | yes | |
fn update_project(projectId: string, title?: string, isArchived?: boolean, isHiddenFromMenu?: boolean)
Update fields on an existing SP project (PluginAPI.updateProject). Refreshes snapshots via sync.
| Argument | Type | Required | Description |
|---|
| projectId | string | yes | |
| title? | string | no | |
| isArchived? | boolean | no | |
| isHiddenFromMenu? | boolean | no | |
fn plugin_status()
Query the running plugin loop's self-report (version, ownership, lock
fn build_plugin(pluginDir: string, outZip: string)
Stamp plugin/manifest.json's version into plugin.js's __PLUGIN_VERSION__
| Argument | Type | Required | Description |
|---|
| pluginDir | string | yes | Dir holding manifest.json + plugin.js + index.html. Relative paths resolve |
| outZip | string | yes | Output path for the canonical zip (the manifest.yaml `binaries` entry). |
Resources
tasks(5m)— Snapshot of SP tasks (privacy-filtered). Short-lived — treat >5m as stale.
projects(5m)— Snapshot of SP projects.
tags(5m)— Snapshot of SP tags.
currentTask(5m)— The currently-selected SP task (or null).
worklog(5m)— Time-tracking / worklog snapshot.
batchResult(5m)— Result of the last `batch` run: tempId→realId map + per-op errors. CEL-referenceable for chaining.
pluginStatus(5m)— The running plugin loop's self-report (version, ownership, lock freshness).