@ghostpaw/email 0.5.7 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -77,6 +77,10 @@ The surface database defaults to `~/.ghostpaw/email.db`; point `--db` at an
77
77
  existing account cache to read it. Each network call opens and closes its IMAP
78
78
  session. Connection commands do not retain a session between calls.
79
79
 
80
+ On POSIX, new accounts files and SQLite caches (including WAL/SHM sidecars) use mode `0600`, and newly created storage directories use `0700`. Existing permissions are preserved, except rewriting `accounts.json` sets it to `0600`.
81
+
82
+ Use `ghostpaw-email skill --short` for a compact command cheat sheet, `ghostpaw-email skill` for the full reference, and `ghostpaw-email skill --list` to list guides.
83
+
80
84
  ## Noun-verb CLI
81
85
 
82
86
  Both `email` and `ghostpaw-email` accept this additive command tree. Existing
@@ -191,7 +195,7 @@ irm https://raw.githubusercontent.com/GhostPawJS/email/main/install.ps1 | iex
191
195
  Pinned to a release:
192
196
 
193
197
  ```sh
194
- curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh | sh -s -- --target linux-x64 --version 0.5.7 && export PATH="$HOME/.local/bin:$PATH"
198
+ curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh | sh -s -- --target linux-x64 --version 0.5.9 && export PATH="$HOME/.local/bin:$PATH"
195
199
  ```
196
200
 
197
201
  Also adding ~/.local/bin to ~/.profile (edits ~/.profile once; skipped if it already mentions ~/.local/bin; zsh login shells read ~/.zprofile instead, so use that file name there):
@@ -208,7 +212,7 @@ $env:GHOSTPAW_NO_MODIFY_PATH=1; irm https://raw.githubusercontent.com/GhostPawJS
208
212
 
209
213
  ```text
210
214
  $ ghostpaw-email --version
211
- email 0.5.7 (binary, linux-x64)
215
+ email 0.5.9 (binary, linux-x64)
212
216
  ```
213
217
 
214
218
  Scripts that compare versions should use `--version --short` or `--version --json`.
package/SKILL.md CHANGED
@@ -25,6 +25,8 @@ Run tools as `ghostpaw-email ...`; use `~/.local/bin/ghostpaw-email` if it is no
25
25
 
26
26
  Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.
27
27
 
28
+ For the compact cheat sheet, run `ghostpaw-email skill --short`.
29
+
28
30
  ## Calling tools
29
31
 
30
32
  MCP: connect to ghostpaw-email, then call a tool by name with its JSON arguments.
@@ -47,7 +49,7 @@ Nested requirements apply within the parent for the selected action.
47
49
 
48
50
  | Parameter | Type | Required | Values / description |
49
51
  | --- | --- | --- | --- |
50
- | view | string | yes | folders, queue, thread, message, attachment, eml. What to read. |
52
+ | view | string | yes | eml. What to read. |
51
53
  | folder | string | no | Folder path (required for queue/message/attachment/eml). |
52
54
  | uid | integer | no | Message UID (required for message/attachment/eml). |
53
55
  | threadId | string | no | Thread ID (required for thread view). |
@@ -105,12 +107,45 @@ Nested requirements apply within the parent for the selected action.
105
107
 
106
108
  | Parameter | Type | Required | Values / description |
107
109
  | --- | --- | --- | --- |
108
- | action | string | yes | send, reply, forward, save_draft, update_draft, send_draft. |
110
+ | action | string | yes | send_draft. string value. |
109
111
  | folder | string | no | Source folder (required for reply/forward). |
110
112
  | uid | integer | no | Source message UID (required for reply/forward/update_draft/send_draft). |
111
113
  | input | object | no | ComposeInput / ReplyInput / ForwardInput payload. |
114
+ | input.from | object | no | Object: address (required), name. |
115
+ | input.from.address | string | yes | Email address. |
116
+ | input.from.name | string | no | Display name. |
117
+ | input.sender | object | no | Object: address (required), name. |
118
+ | input.sender.address | string | yes | Email address. |
119
+ | input.sender.name | string | no | Display name. |
120
+ | input.envelopeFrom | object | no | Object: address (required), name. |
121
+ | input.envelopeFrom.address | string | yes | Email address. |
122
+ | input.envelopeFrom.name | string | no | Display name. |
123
+ | input.replyTo | object | no | Object: address (required), name. |
124
+ | input.replyTo.address | string | yes | Email address. |
125
+ | input.replyTo.name | string | no | Display name. |
112
126
  | input.to | array | yes | Recipient addresses. |
127
+ | input.to[].address | string | yes | Email address. |
128
+ | input.to[].name | string | no | Display name. |
129
+ | input.cc | array | no | Recipient addresses. |
130
+ | input.cc[].address | string | yes | Email address. |
131
+ | input.cc[].name | string | no | Display name. |
132
+ | input.bcc | array | no | Recipient addresses. |
133
+ | input.bcc[].address | string | yes | Email address. |
134
+ | input.bcc[].name | string | no | Display name. |
113
135
  | input.subject | string | yes | Message subject. |
136
+ | input.text | string | no | Plain text body. |
137
+ | input.html | string | no | HTML body. |
138
+ | input.replyAll | boolean | no | Reply to all original recipients. |
139
+ | input.mode | string | no | inline, attachment. string value. |
140
+ | input.attachments | array | no | Message attachments. |
141
+ | input.attachments[].filename | string | yes | string value. |
142
+ | input.attachments[].content | any | yes | Attachment bytes (Buffer in library calls). |
143
+ | input.attachments[].mimeType | string | no | string value. |
144
+ | input.attachments[].inline | boolean | no | boolean value. |
145
+ | input.attachments[].contentId | string | no | string value. |
146
+ | input.inReplyTo | string | no | string value. |
147
+ | input.references | array | no | Array of string. |
148
+ | input.headers | object | no | object value. |
114
149
 
115
150
  Examples:
116
151
 
@@ -134,7 +169,7 @@ Nested requirements apply within the parent for the selected action.
134
169
 
135
170
  | Parameter | Type | Required | Values / description |
136
171
  | --- | --- | --- | --- |
137
- | action | string | yes | mark_read, mark_unread, star, unstar, mark_answered, copy, move, archive, trash, junk, not_junk, set_labels, add_labels, remove_labels, create_folder, rename_folder, delete_folder, subscribe_folder, unsubscribe_folder. |
172
+ | action | string | yes | unsubscribe_folder. string value. |
138
173
  | folder | string | no | Source folder (required for message actions). |
139
174
  | uids | array | no | Message UIDs to act on. |
140
175
  | destination | string | no | Destination folder (required for copy/move). |
@@ -165,7 +200,7 @@ Nested requirements apply within the parent for the selected action.
165
200
 
166
201
  | Parameter | Type | Required | Values / description |
167
202
  | --- | --- | --- | --- |
168
- | action | string | yes | connect, disconnect, reconnect, sync, refresh_folders, watch. |
203
+ | action | string | yes | connect, disconnect, reconnect, sync, refresh_folders, watch. string value. |
169
204
  | folders | array | no | Folders to sync or watch (optional — defaults to all subscribed folders). |
170
205
  | bodies | string | no | none, missing, all. Body fetch strategy for sync (default: missing). |
171
206
 
@@ -179,15 +214,15 @@ ghostpaw-email call mail_sync '{"action":"reconnect"}'
179
214
 
180
215
  ## Workflow guides
181
216
 
182
- - `ghostpaw-email skill triage-inbox` ([triage-inbox](skills/email/references/triage-inbox.md)): Process a full inbox from scratch: sync to get latest state, read message queue, selectively fetch bodies for decisions, then bulk-organize by priority.
183
- - `ghostpaw-email skill read-and-reply` ([read-and-reply](skills/email/references/read-and-reply.md)): Read a message with full thread context, then compose and send a properly-threaded reply with quoted attribution.
184
- - `ghostpaw-email skill connect-and-sync` ([connect-and-sync](skills/email/references/connect-and-sync.md)): Establish or restore an IMAP connection, refresh the folder list, and pull new messages — handling first-run vs incremental scenarios.
185
- - `ghostpaw-email skill search-and-act` ([search-and-act](skills/email/references/search-and-act.md)): Find messages matching criteria (local FTS first, remote IMAP SEARCH as fallback), verify targets, then act — organize, reply, or present.
186
- - `ghostpaw-email skill compose-and-send` ([compose-and-send](skills/email/references/compose-and-send.md)): Full draft lifecycle — save, review, update, then send — plus direct send, reply, and forward with proper threading and forwarded-header blocks.
187
- - `ghostpaw-email skill organize-bulk` ([organize-bulk](skills/email/references/organize-bulk.md)): Bulk organize messages across folders — flagging, moving, archiving, labelling — and manage the folder hierarchy as part of the flow.
188
- - `ghostpaw-email skill attachment-workflow` ([attachment-workflow](skills/email/references/attachment-workflow.md)): Discover, inspect, and fetch email attachments on demand; embed attachments in outbound messages; and export or import full .eml files.
189
- - `ghostpaw-email skill recover-from-disruption` ([recover-from-disruption](skills/email/references/recover-from-disruption.md)): Detect and recover from connection loss or IMAP/SMTP failures — reconnect with back-off, re-sync to reconcile state, and handle auth vs transient errors distinctly.
190
- - `ghostpaw-email skill cli` ([cli](skills/email/references/cli.md)): Complete existing email CLI guide.
217
+ - `ghostpaw-email skill triage-inbox`: Process a full inbox from scratch: sync to get latest state, read message queue, selectively fetch bodies for decisions, then bulk-organize by priority.
218
+ - `ghostpaw-email skill read-and-reply`: Read a message with full thread context, then compose and send a properly-threaded reply with quoted attribution.
219
+ - `ghostpaw-email skill connect-and-sync`: Establish or restore an IMAP connection, refresh the folder list, and pull new messages — handling first-run vs incremental scenarios.
220
+ - `ghostpaw-email skill search-and-act`: Find messages matching criteria (local FTS first, remote IMAP SEARCH as fallback), verify targets, then act — organize, reply, or present.
221
+ - `ghostpaw-email skill compose-and-send`: Full draft lifecycle — save, review, update, then send — plus direct send, reply, and forward with proper threading and forwarded-header blocks.
222
+ - `ghostpaw-email skill organize-bulk`: Bulk organize messages across folders — flagging, moving, archiving, labelling — and manage the folder hierarchy as part of the flow.
223
+ - `ghostpaw-email skill attachment-workflow`: Discover, inspect, and fetch email attachments on demand; embed attachments in outbound messages; and export or import full .eml files.
224
+ - `ghostpaw-email skill recover-from-disruption`: Detect and recover from connection loss or IMAP/SMTP failures — reconnect with back-off, re-sync to reconcile state, and handle auth vs transient errors distinctly.
225
+ - `ghostpaw-email skill cli`: Complete existing email CLI guide.
191
226
 
192
227
  ## Principles
193
228
 
package/dist/cli.js CHANGED
@@ -4,9 +4,9 @@ import f from 'node:readline';
4
4
  import * as tty from 'node:tty';
5
5
  import { WriteStream } from 'node:tty';
6
6
  import { isSea } from 'node:sea';
7
- import { mkdirSync, readFileSync, writeFileSync, statSync } from 'node:fs';
7
+ import { readFileSync, mkdirSync, closeSync, openSync, chmodSync, fchmodSync, ftruncateSync, writeFileSync, statSync } from 'node:fs';
8
8
  import { homedir } from 'node:os';
9
- import { sep, dirname, join, basename, extname } from 'node:path';
9
+ import { sep, join, dirname, basename, extname } from 'node:path';
10
10
  import { EventEmitter } from 'node:events';
11
11
  import * as net from 'node:net';
12
12
  import * as tls from 'node:tls';
@@ -808,7 +808,7 @@ var init_cli_version = __esm({
808
808
  var emailVersion;
809
809
  var init_version = __esm({
810
810
  "src/version.ts"() {
811
- emailVersion = "0.5.7";
811
+ emailVersion = "0.5.9";
812
812
  }
813
813
  });
814
814
  function getConfigDir() {
@@ -830,10 +830,10 @@ function dbPathForAccount(slug) {
830
830
  return join(getDataDir(), `${slug}.db`);
831
831
  }
832
832
  function ensureConfigDir() {
833
- mkdirSync(getConfigDir(), { recursive: true });
833
+ mkdirSync(getConfigDir(), { recursive: true, mode: 448 });
834
834
  }
835
835
  function ensureDataDir() {
836
- mkdirSync(getDataDir(), { recursive: true });
836
+ mkdirSync(getDataDir(), { recursive: true, mode: 448 });
837
837
  }
838
838
  function loadAccounts() {
839
839
  let raw2;
@@ -853,7 +853,14 @@ function loadAccounts() {
853
853
  }
854
854
  function saveAccounts(data) {
855
855
  ensureConfigDir();
856
- writeFileSync(accountsFilePath(), JSON.stringify(data, null, " ") + "\n", "utf-8");
856
+ const fd = openSync(accountsFilePath(), "a", 384);
857
+ try {
858
+ if (process.platform !== "win32") fchmodSync(fd, 384);
859
+ ftruncateSync(fd, 0);
860
+ writeFileSync(fd, JSON.stringify(data, null, " ") + "\n", "utf-8");
861
+ } finally {
862
+ closeSync(fd);
863
+ }
857
864
  }
858
865
  function validateAccounts(data) {
859
866
  if (typeof data !== "object" || data === null || Array.isArray(data)) {
@@ -6094,6 +6101,42 @@ var init_read = __esm({
6094
6101
  init_store();
6095
6102
  }
6096
6103
  });
6104
+ function preparePrivateStorage(path) {
6105
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
6106
+ const created = [];
6107
+ for (const file of [path, `${path}-wal`, `${path}-shm`]) {
6108
+ try {
6109
+ closeSync(openSync(file, "wx", 384));
6110
+ created.push(file);
6111
+ } catch (error) {
6112
+ if (error.code !== "EEXIST") throw error;
6113
+ }
6114
+ }
6115
+ return () => {
6116
+ if (process.platform !== "win32")
6117
+ for (const file of created) {
6118
+ try {
6119
+ chmodSync(file, 384);
6120
+ } catch (error) {
6121
+ if (error.code !== "ENOENT") throw error;
6122
+ }
6123
+ }
6124
+ };
6125
+ }
6126
+ function withPrivateCreation(operation, secure) {
6127
+ if (process.platform === "win32") return operation();
6128
+ const previous = process.umask(63);
6129
+ try {
6130
+ return operation();
6131
+ } finally {
6132
+ process.umask(previous);
6133
+ secure?.();
6134
+ }
6135
+ }
6136
+ var init_private_storage = __esm({
6137
+ "src/private_storage.ts"() {
6138
+ }
6139
+ });
6097
6140
 
6098
6141
  // src/schema/create_fts.ts
6099
6142
  function createFts(db) {
@@ -7442,6 +7485,39 @@ var init_cli_commands = __esm({
7442
7485
  }
7443
7486
  });
7444
7487
 
7488
+ // src/surfaces/parameter_rows.ts
7489
+ function parameterRows(schema, prefix = "") {
7490
+ const rows = [];
7491
+ const properties = { ...schema.properties };
7492
+ for (const branch of schema.oneOf ?? []) Object.assign(properties, branch.properties);
7493
+ for (const [name, property] of Object.entries(properties)) {
7494
+ const alternatives = [property, ...property.oneOf ?? []];
7495
+ for (const branch of schema.oneOf ?? []) {
7496
+ const nested2 = branch.properties?.[name];
7497
+ if (nested2) alternatives.push(nested2, ...nested2.oneOf ?? []);
7498
+ }
7499
+ const nested = { properties: {}, required: [] };
7500
+ for (const alternative of alternatives) {
7501
+ Object.assign(nested.properties ?? {}, alternative.properties);
7502
+ nested.required = [.../* @__PURE__ */ new Set([...nested.required ?? [], ...alternative.required ?? []])];
7503
+ }
7504
+ const keys = Object.keys(nested.properties ?? {});
7505
+ const type = property.type ?? property.oneOf?.map((branch) => branch.type ?? "any").join(" / ") ?? "any";
7506
+ const fallback = keys.length ? `Object: ${keys.map((key) => key + (nested.required?.includes(key) ? " (required)" : "")).join(", ")}.` : property.items ? `Array of ${property.items.type ?? "values"}.` : `${type} value.`;
7507
+ const description = ((property.enum ? `${property.enum.join(", ")}. ` : "") + (property.description?.trim() || fallback)).replaceAll("|", "\\|").replaceAll("\n", " ");
7508
+ rows.push(
7509
+ `| ${prefix}${name} | ${type} | ${schema.required?.includes(name) ? "yes" : "no"} | ${description} |`
7510
+ );
7511
+ if (keys.length) rows.push(...parameterRows(nested, `${prefix}${name}.`));
7512
+ if (property.items) rows.push(...parameterRows(property.items, `${prefix}${name}[].`));
7513
+ }
7514
+ return rows;
7515
+ }
7516
+ var init_parameter_rows = __esm({
7517
+ "src/surfaces/parameter_rows.ts"() {
7518
+ }
7519
+ });
7520
+
7445
7521
  // src/surfaces/surface_types.ts
7446
7522
  function isErrorResult(result) {
7447
7523
  return typeof result === "object" && result !== null && "ok" in result && result.ok === false;
@@ -7542,11 +7618,7 @@ Not for: ${tool.whenNotToUse ?? ""}
7542
7618
  Read only: ${tool.readOnly ?? false}
7543
7619
 
7544
7620
  Parameter | Type | Required | Description
7545
- ${Object.entries(
7546
- tool.inputSchema.properties ?? {}
7547
- ).map(
7548
- ([key, schema]) => `${key} | ${schema.type ?? "oneOf"} | ${tool.inputSchema.required?.includes(key) ?? false} | ${schema.description ?? ""}`
7549
- ).join("\n")}
7621
+ ${parameterRows(tool.inputSchema).join("\n")}
7550
7622
 
7551
7623
  ${JSON.stringify(tool.inputSchema, null, 2)}
7552
7624
  `
@@ -7636,6 +7708,7 @@ var init_cli = __esm({
7636
7708
  "src/surfaces/cli.ts"() {
7637
7709
  init_cli_version();
7638
7710
  init_cli_commands();
7711
+ init_parameter_rows();
7639
7712
  init_surface_types();
7640
7713
  init_validate_input();
7641
7714
  }
@@ -8307,6 +8380,58 @@ var init_email_skills = __esm({
8307
8380
  }
8308
8381
  });
8309
8382
 
8383
+ // src/surface/email_skill_short.ts
8384
+ var emailSkillShort;
8385
+ var init_email_skill_short = __esm({
8386
+ "src/surface/email_skill_short.ts"() {
8387
+ init_version();
8388
+ emailSkillShort = `# ghostpaw-email cheat sheet
8389
+ Version: ${emailVersion}
8390
+
8391
+ Install the release binary (checks SHA256SUMS; Linux/macOS installs to ~/.local/bin):
8392
+ curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh | sh
8393
+ Windows: irm https://raw.githubusercontent.com/GhostPawJS/email/main/install.ps1 | iex
8394
+ Node 24+: npm install -g @ghostpaw/email
8395
+ Check version:
8396
+ ghostpaw-email --version
8397
+
8398
+ Configure an account:
8399
+ ghostpaw-email account add --name work --imap-host imap.example.com --imap-port 993 --smtp-host smtp.example.com --smtp-port 587 --user reader@example.com --pass PASSWORD
8400
+ Connect and synchronize:
8401
+ ghostpaw-email sync connect
8402
+ List folders:
8403
+ ghostpaw-email read folders
8404
+ Search cached mail:
8405
+ ghostpaw-email mail search "meeting"
8406
+ Save a draft:
8407
+ ghostpaw-email compose draft --save --to reader@example.com --subject Hello --body Hello
8408
+ Mark a message read:
8409
+ ghostpaw-email organize mark-read --folder INBOX --uids 1
8410
+ List tool names:
8411
+ ghostpaw-email tools
8412
+ Inspect a tool and its parameters:
8413
+ ghostpaw-email describe mail_search
8414
+ Call a tool with JSON:
8415
+ ghostpaw-email call mail_search '{"query":"meeting"}'
8416
+ Start the MCP server:
8417
+ ghostpaw-email mcp
8418
+ Select a cache:
8419
+ ghostpaw-email --db ./email.sqlite tools
8420
+
8421
+ List workflow guides:
8422
+ ghostpaw-email skill --list
8423
+ Read a guide:
8424
+ ghostpaw-email skill cli
8425
+ Read the full tool reference:
8426
+ ghostpaw-email skill
8427
+ Show this compact cheat sheet:
8428
+ ghostpaw-email skill --short
8429
+ Show skill command help:
8430
+ ghostpaw-email skill --help
8431
+ `;
8432
+ }
8433
+ });
8434
+
8310
8435
  // src/surface/email_surface_tools.ts
8311
8436
  var emailMcpTools, emailSurfaceTools;
8312
8437
  var init_email_surface_tools = __esm({
@@ -8414,20 +8539,23 @@ async function openEmailDb(path) {
8414
8539
  } finally {
8415
8540
  process.emitWarning = original;
8416
8541
  }
8417
- if (path !== ":memory:") mkdirSync(dirname(path), { recursive: true });
8418
- const db = new sqlite.DatabaseSync(path);
8419
- try {
8420
- db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;");
8421
- const context = db;
8422
- initSchema(context);
8423
- return context;
8424
- } catch (error) {
8425
- db.close();
8426
- throw error;
8427
- }
8542
+ const secure = path !== ":memory:" ? preparePrivateStorage(path) : void 0;
8543
+ return withPrivateCreation(() => {
8544
+ const db = new sqlite.DatabaseSync(path);
8545
+ try {
8546
+ db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;");
8547
+ const context = db;
8548
+ initSchema(context);
8549
+ return context;
8550
+ } catch (error) {
8551
+ db.close();
8552
+ throw error;
8553
+ }
8554
+ }, secure);
8428
8555
  }
8429
8556
  var init_open_email_db = __esm({
8430
8557
  "src/surface/open_email_db.ts"() {
8558
+ init_private_storage();
8431
8559
  init_schema();
8432
8560
  }
8433
8561
  });
@@ -8690,7 +8818,7 @@ var skill_markdown_exports = {};
8690
8818
  __export(skill_markdown_exports, {
8691
8819
  renderSkillMarkdown: () => renderSkillMarkdown
8692
8820
  });
8693
- function renderSkillMarkdown(spec, { referencesBase = "references" } = {}) {
8821
+ function renderSkillMarkdown(spec, { referencesBase: _referencesBase = "references" } = {}) {
8694
8822
  if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(spec.name) || spec.name.length > 64)
8695
8823
  throw new Error("Invalid skill name");
8696
8824
  if (!spec.description.trim() || spec.description.length > 1024 || !spec.description.includes("Use when"))
@@ -8728,6 +8856,8 @@ function renderSkillMarkdown(spec, { referencesBase = "references" } = {}) {
8728
8856
  "",
8729
8857
  spec.about,
8730
8858
  "",
8859
+ "For the compact cheat sheet, run `ghostpaw-email skill --short`.",
8860
+ "",
8731
8861
  "## Calling tools",
8732
8862
  "",
8733
8863
  `MCP: connect to ${spec.server}, then call a tool by name with its JSON arguments.`,
@@ -8754,27 +8884,7 @@ function renderSkillMarkdown(spec, { referencesBase = "references" } = {}) {
8754
8884
  "| Parameter | Type | Required | Values / description |",
8755
8885
  "| --- | --- | --- | --- |"
8756
8886
  );
8757
- const row = (name, property, required) => `| ${name} | ${property.type ?? property.oneOf?.map((branch) => branch.type).join(" / ") ?? "any"} | ${required ? "yes" : "no"} | ${(property.enum ? `${property.enum.join(", ")}. ` : "") + (property.description ?? "").replaceAll("|", "\\|").replaceAll("\n", " ")} |`;
8758
- const fields = (schema, prefix = "") => {
8759
- const properties = Object.entries(schema.properties ?? {});
8760
- for (const [name, property] of properties) {
8761
- if (prefix && properties.length > 8 && !schema.required?.includes(name)) continue;
8762
- lines.push(row(`${prefix}${name}`, property, schema.required?.includes(name) ?? false));
8763
- const objects = [property, ...property.oneOf ?? []].filter((s4) => s4.properties);
8764
- if (!objects.length)
8765
- for (const branch of tool.inputSchema.oneOf ?? []) {
8766
- const nested = branch.properties?.[name];
8767
- if (nested?.properties) objects.push(nested);
8768
- }
8769
- const merged = { properties: {}, required: [] };
8770
- for (const object of objects) {
8771
- Object.assign(merged.properties ?? {}, object.properties);
8772
- merged.required = [.../* @__PURE__ */ new Set([...merged.required ?? [], ...object.required ?? []])];
8773
- }
8774
- if (objects.length) fields(merged, `${prefix}${name}.`);
8775
- }
8776
- };
8777
- fields(tool.inputSchema);
8887
+ lines.push(...parameterRows(tool.inputSchema));
8778
8888
  lines.push("", "Examples:", "", "```sh");
8779
8889
  const actions = tool.inputSchema.properties?.action?.enum?.slice(0, 3) ?? [void 0];
8780
8890
  for (const action of actions) {
@@ -8788,7 +8898,7 @@ function renderSkillMarkdown(spec, { referencesBase = "references" } = {}) {
8788
8898
  "## Workflow guides",
8789
8899
  "",
8790
8900
  ...spec.workflows.map(
8791
- (workflow) => `- \`${spec.bin} skill ${workflow.name}\` ([${workflow.name}](${referencesBase}/${workflow.name}.md)): ${workflow.description}`
8901
+ (workflow) => `- \`${spec.bin} skill ${workflow.name}\`: ${workflow.description}`
8792
8902
  ),
8793
8903
  "",
8794
8904
  "## Principles",
@@ -8809,6 +8919,7 @@ function renderSkillMarkdown(spec, { referencesBase = "references" } = {}) {
8809
8919
  }
8810
8920
  var init_skill_markdown = __esm({
8811
8921
  "src/surfaces/skill_markdown.ts"() {
8922
+ init_parameter_rows();
8812
8923
  init_schema_example();
8813
8924
  }
8814
8925
  });
@@ -8854,6 +8965,7 @@ var init_email_cli_options = __esm({
8854
8965
  init_cli_guide();
8855
8966
  init_email_skills();
8856
8967
  init_version();
8968
+ init_email_skill_short();
8857
8969
  init_email_surface_tools();
8858
8970
  emailCliOptions = {
8859
8971
  bin: "ghostpaw-email",
@@ -8881,8 +8993,9 @@ var init_email_cli_options = __esm({
8881
8993
  },
8882
8994
  skill: async (args = []) => {
8883
8995
  const guides = [...emailSkills, cliGuide];
8996
+ if (args.length === 1 && args[0] === "--short") return emailSkillShort;
8884
8997
  if (args[0] === "--help" || args[0] === "-h")
8885
- return "Usage: ghostpaw-email skill\n ghostpaw-email skill --list\n ghostpaw-email skill <guide>\n";
8998
+ return "Usage: ghostpaw-email skill\n ghostpaw-email skill --short (compact cheat sheet)\n ghostpaw-email skill --list\n ghostpaw-email skill <guide>\n";
8886
8999
  if (args[0] === "--list")
8887
9000
  return `${guides.map((guide) => `${guide.name} ${guide.description.replace(/\s+/g, " ")}`).join("\n")}
8888
9001
  `;
@@ -10714,15 +10827,19 @@ init_network();
10714
10827
  init_read();
10715
10828
 
10716
10829
  // src/runtime.ts
10830
+ init_private_storage();
10717
10831
  init_schema();
10718
10832
  function init2(config) {
10719
10833
  const dbPath = config.storage ?? ":memory:";
10720
10834
  const { DatabaseSync } = process.getBuiltinModule("node:sqlite");
10721
- const db = new DatabaseSync(dbPath);
10722
- if (dbPath !== ":memory:") db.exec("PRAGMA journal_mode=WAL");
10723
- db.exec("PRAGMA busy_timeout=5000");
10724
- initSchema(db);
10725
- return { db };
10835
+ const secure = dbPath !== ":memory:" ? preparePrivateStorage(dbPath) : void 0;
10836
+ return withPrivateCreation(() => {
10837
+ const db = new DatabaseSync(dbPath);
10838
+ if (dbPath !== ":memory:") db.exec("PRAGMA journal_mode=WAL");
10839
+ db.exec("PRAGMA busy_timeout=5000");
10840
+ initSchema(db);
10841
+ return { db };
10842
+ }, secure);
10726
10843
  }
10727
10844
 
10728
10845
  // src/mailbox.ts
package/dist/index.cjs CHANGED
@@ -4,6 +4,8 @@ var node_events = require('node:events');
4
4
  var net = require('node:net');
5
5
  var tls = require('node:tls');
6
6
  var zlib = require('node:zlib');
7
+ var node_fs = require('node:fs');
8
+ var node_path = require('node:path');
7
9
  var node_crypto = require('node:crypto');
8
10
 
9
11
  function _interopNamespace(e) {
@@ -3720,6 +3722,38 @@ var runtime_exports = {};
3720
3722
  __export(runtime_exports, {
3721
3723
  init: () => init
3722
3724
  });
3725
+ function preparePrivateStorage(path) {
3726
+ node_fs.mkdirSync(node_path.dirname(path), { recursive: true, mode: 448 });
3727
+ const created = [];
3728
+ for (const file of [path, `${path}-wal`, `${path}-shm`]) {
3729
+ try {
3730
+ node_fs.closeSync(node_fs.openSync(file, "wx", 384));
3731
+ created.push(file);
3732
+ } catch (error) {
3733
+ if (error.code !== "EEXIST") throw error;
3734
+ }
3735
+ }
3736
+ return () => {
3737
+ if (process.platform !== "win32")
3738
+ for (const file of created) {
3739
+ try {
3740
+ node_fs.chmodSync(file, 384);
3741
+ } catch (error) {
3742
+ if (error.code !== "ENOENT") throw error;
3743
+ }
3744
+ }
3745
+ };
3746
+ }
3747
+ function withPrivateCreation(operation, secure) {
3748
+ if (process.platform === "win32") return operation();
3749
+ const previous = process.umask(63);
3750
+ try {
3751
+ return operation();
3752
+ } finally {
3753
+ process.umask(previous);
3754
+ secure?.();
3755
+ }
3756
+ }
3723
3757
 
3724
3758
  // src/schema/index.ts
3725
3759
  var schema_exports = {};
@@ -3870,11 +3904,14 @@ function initSchema(db) {
3870
3904
  function init(config) {
3871
3905
  const dbPath = config.storage ?? ":memory:";
3872
3906
  const { DatabaseSync } = process.getBuiltinModule("node:sqlite");
3873
- const db = new DatabaseSync(dbPath);
3874
- if (dbPath !== ":memory:") db.exec("PRAGMA journal_mode=WAL");
3875
- db.exec("PRAGMA busy_timeout=5000");
3876
- initSchema(db);
3877
- return { db };
3907
+ const secure = dbPath !== ":memory:" ? preparePrivateStorage(dbPath) : void 0;
3908
+ return withPrivateCreation(() => {
3909
+ const db = new DatabaseSync(dbPath);
3910
+ if (dbPath !== ":memory:") db.exec("PRAGMA journal_mode=WAL");
3911
+ db.exec("PRAGMA busy_timeout=5000");
3912
+ initSchema(db);
3913
+ return { db };
3914
+ }, secure);
3878
3915
  }
3879
3916
 
3880
3917
  // src/write.ts
package/dist/index.js CHANGED
@@ -2,6 +2,8 @@ import { EventEmitter } from 'node:events';
2
2
  import * as net from 'node:net';
3
3
  import * as tls from 'node:tls';
4
4
  import * as zlib from 'node:zlib';
5
+ import { mkdirSync, closeSync, openSync, chmodSync } from 'node:fs';
6
+ import { dirname } from 'node:path';
5
7
  import { randomUUID } from 'node:crypto';
6
8
 
7
9
  var __defProp = Object.defineProperty;
@@ -3696,6 +3698,38 @@ var runtime_exports = {};
3696
3698
  __export(runtime_exports, {
3697
3699
  init: () => init
3698
3700
  });
3701
+ function preparePrivateStorage(path) {
3702
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
3703
+ const created = [];
3704
+ for (const file of [path, `${path}-wal`, `${path}-shm`]) {
3705
+ try {
3706
+ closeSync(openSync(file, "wx", 384));
3707
+ created.push(file);
3708
+ } catch (error) {
3709
+ if (error.code !== "EEXIST") throw error;
3710
+ }
3711
+ }
3712
+ return () => {
3713
+ if (process.platform !== "win32")
3714
+ for (const file of created) {
3715
+ try {
3716
+ chmodSync(file, 384);
3717
+ } catch (error) {
3718
+ if (error.code !== "ENOENT") throw error;
3719
+ }
3720
+ }
3721
+ };
3722
+ }
3723
+ function withPrivateCreation(operation, secure) {
3724
+ if (process.platform === "win32") return operation();
3725
+ const previous = process.umask(63);
3726
+ try {
3727
+ return operation();
3728
+ } finally {
3729
+ process.umask(previous);
3730
+ secure?.();
3731
+ }
3732
+ }
3699
3733
 
3700
3734
  // src/schema/index.ts
3701
3735
  var schema_exports = {};
@@ -3846,11 +3880,14 @@ function initSchema(db) {
3846
3880
  function init(config) {
3847
3881
  const dbPath = config.storage ?? ":memory:";
3848
3882
  const { DatabaseSync } = process.getBuiltinModule("node:sqlite");
3849
- const db = new DatabaseSync(dbPath);
3850
- if (dbPath !== ":memory:") db.exec("PRAGMA journal_mode=WAL");
3851
- db.exec("PRAGMA busy_timeout=5000");
3852
- initSchema(db);
3853
- return { db };
3883
+ const secure = dbPath !== ":memory:" ? preparePrivateStorage(dbPath) : void 0;
3884
+ return withPrivateCreation(() => {
3885
+ const db = new DatabaseSync(dbPath);
3886
+ if (dbPath !== ":memory:") db.exec("PRAGMA journal_mode=WAL");
3887
+ db.exec("PRAGMA busy_timeout=5000");
3888
+ initSchema(db);
3889
+ return { db };
3890
+ }, secure);
3854
3891
  }
3855
3892
 
3856
3893
  // src/write.ts
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { readFileSync, mkdirSync } from 'node:fs';
2
+ import { readFileSync, mkdirSync, closeSync, openSync, chmodSync } from 'node:fs';
3
3
  import { homedir } from 'node:os';
4
4
  import { join, dirname } from 'node:path';
5
5
  import { EventEmitter } from 'node:events';
@@ -316,7 +316,7 @@ var init_mcp_stdio = __esm({
316
316
  var emailVersion;
317
317
  var init_version = __esm({
318
318
  "src/version.ts"() {
319
- emailVersion = "0.5.7";
319
+ emailVersion = "0.5.9";
320
320
  }
321
321
  });
322
322
 
@@ -6343,6 +6343,42 @@ var init_email_mcp_options = __esm({
6343
6343
  init_email_surface_tools();
6344
6344
  }
6345
6345
  });
6346
+ function preparePrivateStorage(path) {
6347
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
6348
+ const created = [];
6349
+ for (const file of [path, `${path}-wal`, `${path}-shm`]) {
6350
+ try {
6351
+ closeSync(openSync(file, "wx", 384));
6352
+ created.push(file);
6353
+ } catch (error) {
6354
+ if (error.code !== "EEXIST") throw error;
6355
+ }
6356
+ }
6357
+ return () => {
6358
+ if (process.platform !== "win32")
6359
+ for (const file of created) {
6360
+ try {
6361
+ chmodSync(file, 384);
6362
+ } catch (error) {
6363
+ if (error.code !== "ENOENT") throw error;
6364
+ }
6365
+ }
6366
+ };
6367
+ }
6368
+ function withPrivateCreation(operation, secure) {
6369
+ if (process.platform === "win32") return operation();
6370
+ const previous = process.umask(63);
6371
+ try {
6372
+ return operation();
6373
+ } finally {
6374
+ process.umask(previous);
6375
+ secure?.();
6376
+ }
6377
+ }
6378
+ var init_private_storage = __esm({
6379
+ "src/private_storage.ts"() {
6380
+ }
6381
+ });
6346
6382
 
6347
6383
  // src/schema/create_fts.ts
6348
6384
  function createFts(db) {
@@ -6505,6 +6541,8 @@ var init_schema = __esm({
6505
6541
  init_init_schema();
6506
6542
  }
6507
6543
  });
6544
+
6545
+ // src/surface/open_email_db.ts
6508
6546
  async function openEmailDb(path) {
6509
6547
  const original = process.emitWarning;
6510
6548
  process.emitWarning = ((warning, ...args2) => {
@@ -6520,20 +6558,23 @@ async function openEmailDb(path) {
6520
6558
  } finally {
6521
6559
  process.emitWarning = original;
6522
6560
  }
6523
- if (path !== ":memory:") mkdirSync(dirname(path), { recursive: true });
6524
- const db = new sqlite.DatabaseSync(path);
6525
- try {
6526
- db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;");
6527
- const context = db;
6528
- initSchema(context);
6529
- return context;
6530
- } catch (error) {
6531
- db.close();
6532
- throw error;
6533
- }
6561
+ const secure = path !== ":memory:" ? preparePrivateStorage(path) : void 0;
6562
+ return withPrivateCreation(() => {
6563
+ const db = new sqlite.DatabaseSync(path);
6564
+ try {
6565
+ db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;");
6566
+ const context = db;
6567
+ initSchema(context);
6568
+ return context;
6569
+ } catch (error) {
6570
+ db.close();
6571
+ throw error;
6572
+ }
6573
+ }, secure);
6534
6574
  }
6535
6575
  var init_open_email_db = __esm({
6536
6576
  "src/surface/open_email_db.ts"() {
6577
+ init_private_storage();
6537
6578
  init_schema();
6538
6579
  }
6539
6580
  });
package/dist/mcp.cjs CHANGED
@@ -5007,7 +5007,7 @@ var init_network = __esm({
5007
5007
  });
5008
5008
 
5009
5009
  // src/version.ts
5010
- var emailVersion = "0.5.7";
5010
+ var emailVersion = "0.5.9";
5011
5011
 
5012
5012
  // src/surface/email_mcp_instructions.ts
5013
5013
  var emailMcpInstructions = "Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.";
@@ -6129,6 +6129,38 @@ function emailMcpOptions(context) {
6129
6129
  })
6130
6130
  };
6131
6131
  }
6132
+ function preparePrivateStorage(path) {
6133
+ node_fs.mkdirSync(node_path.dirname(path), { recursive: true, mode: 448 });
6134
+ const created = [];
6135
+ for (const file of [path, `${path}-wal`, `${path}-shm`]) {
6136
+ try {
6137
+ node_fs.closeSync(node_fs.openSync(file, "wx", 384));
6138
+ created.push(file);
6139
+ } catch (error) {
6140
+ if (error.code !== "EEXIST") throw error;
6141
+ }
6142
+ }
6143
+ return () => {
6144
+ if (process.platform !== "win32")
6145
+ for (const file of created) {
6146
+ try {
6147
+ node_fs.chmodSync(file, 384);
6148
+ } catch (error) {
6149
+ if (error.code !== "ENOENT") throw error;
6150
+ }
6151
+ }
6152
+ };
6153
+ }
6154
+ function withPrivateCreation(operation, secure) {
6155
+ if (process.platform === "win32") return operation();
6156
+ const previous = process.umask(63);
6157
+ try {
6158
+ return operation();
6159
+ } finally {
6160
+ process.umask(previous);
6161
+ secure?.();
6162
+ }
6163
+ }
6132
6164
 
6133
6165
  // src/schema/create_fts.ts
6134
6166
  function createFts(db) {
@@ -6282,17 +6314,19 @@ async function openEmailDb(path) {
6282
6314
  } finally {
6283
6315
  process.emitWarning = original;
6284
6316
  }
6285
- if (path !== ":memory:") node_fs.mkdirSync(node_path.dirname(path), { recursive: true });
6286
- const db = new sqlite.DatabaseSync(path);
6287
- try {
6288
- db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;");
6289
- const context = db;
6290
- initSchema(context);
6291
- return context;
6292
- } catch (error) {
6293
- db.close();
6294
- throw error;
6295
- }
6317
+ const secure = path !== ":memory:" ? preparePrivateStorage(path) : void 0;
6318
+ return withPrivateCreation(() => {
6319
+ const db = new sqlite.DatabaseSync(path);
6320
+ try {
6321
+ db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;");
6322
+ const context = db;
6323
+ initSchema(context);
6324
+ return context;
6325
+ } catch (error) {
6326
+ db.close();
6327
+ throw error;
6328
+ }
6329
+ }, secure);
6296
6330
  }
6297
6331
  function resolveEmailDbPath(options = {}) {
6298
6332
  return options.flag ?? ((options.env ?? process.env).GHOSTPAW_EMAIL_DB || node_path.join(node_os.homedir(), ".ghostpaw", "email.db"));
package/dist/mcp.js CHANGED
@@ -1,4 +1,4 @@
1
- import { readFileSync, mkdirSync } from 'node:fs';
1
+ import { readFileSync, mkdirSync, closeSync, openSync, chmodSync } from 'node:fs';
2
2
  import { homedir } from 'node:os';
3
3
  import { join, dirname } from 'node:path';
4
4
  import { EventEmitter } from 'node:events';
@@ -4983,7 +4983,7 @@ var init_network = __esm({
4983
4983
  });
4984
4984
 
4985
4985
  // src/version.ts
4986
- var emailVersion = "0.5.7";
4986
+ var emailVersion = "0.5.9";
4987
4987
 
4988
4988
  // src/surface/email_mcp_instructions.ts
4989
4989
  var emailMcpInstructions = "Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.";
@@ -6105,6 +6105,38 @@ function emailMcpOptions(context) {
6105
6105
  })
6106
6106
  };
6107
6107
  }
6108
+ function preparePrivateStorage(path) {
6109
+ mkdirSync(dirname(path), { recursive: true, mode: 448 });
6110
+ const created = [];
6111
+ for (const file of [path, `${path}-wal`, `${path}-shm`]) {
6112
+ try {
6113
+ closeSync(openSync(file, "wx", 384));
6114
+ created.push(file);
6115
+ } catch (error) {
6116
+ if (error.code !== "EEXIST") throw error;
6117
+ }
6118
+ }
6119
+ return () => {
6120
+ if (process.platform !== "win32")
6121
+ for (const file of created) {
6122
+ try {
6123
+ chmodSync(file, 384);
6124
+ } catch (error) {
6125
+ if (error.code !== "ENOENT") throw error;
6126
+ }
6127
+ }
6128
+ };
6129
+ }
6130
+ function withPrivateCreation(operation, secure) {
6131
+ if (process.platform === "win32") return operation();
6132
+ const previous = process.umask(63);
6133
+ try {
6134
+ return operation();
6135
+ } finally {
6136
+ process.umask(previous);
6137
+ secure?.();
6138
+ }
6139
+ }
6108
6140
 
6109
6141
  // src/schema/create_fts.ts
6110
6142
  function createFts(db) {
@@ -6258,17 +6290,19 @@ async function openEmailDb(path) {
6258
6290
  } finally {
6259
6291
  process.emitWarning = original;
6260
6292
  }
6261
- if (path !== ":memory:") mkdirSync(dirname(path), { recursive: true });
6262
- const db = new sqlite.DatabaseSync(path);
6263
- try {
6264
- db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;");
6265
- const context = db;
6266
- initSchema(context);
6267
- return context;
6268
- } catch (error) {
6269
- db.close();
6270
- throw error;
6271
- }
6293
+ const secure = path !== ":memory:" ? preparePrivateStorage(path) : void 0;
6294
+ return withPrivateCreation(() => {
6295
+ const db = new sqlite.DatabaseSync(path);
6296
+ try {
6297
+ db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;");
6298
+ const context = db;
6299
+ initSchema(context);
6300
+ return context;
6301
+ } catch (error) {
6302
+ db.close();
6303
+ throw error;
6304
+ }
6305
+ }, secure);
6272
6306
  }
6273
6307
  function resolveEmailDbPath(options = {}) {
6274
6308
  return options.flag ?? ((options.env ?? process.env).GHOSTPAW_EMAIL_DB || join(homedir(), ".ghostpaw", "email.db"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostpaw/email",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "description": "Standalone IMAP/SMTP email engine for Node.js — SQLite local cache, threading, sync, zero dependencies, with a built-in LLM tool facade",
5
5
  "type": "module",
6
6
  "exports": {
@@ -25,6 +25,8 @@ Run tools as `ghostpaw-email ...`; use `~/.local/bin/ghostpaw-email` if it is no
25
25
 
26
26
  Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.
27
27
 
28
+ For the compact cheat sheet, run `ghostpaw-email skill --short`.
29
+
28
30
  ## Calling tools
29
31
 
30
32
  MCP: connect to ghostpaw-email, then call a tool by name with its JSON arguments.
@@ -47,7 +49,7 @@ Nested requirements apply within the parent for the selected action.
47
49
 
48
50
  | Parameter | Type | Required | Values / description |
49
51
  | --- | --- | --- | --- |
50
- | view | string | yes | folders, queue, thread, message, attachment, eml. What to read. |
52
+ | view | string | yes | eml. What to read. |
51
53
  | folder | string | no | Folder path (required for queue/message/attachment/eml). |
52
54
  | uid | integer | no | Message UID (required for message/attachment/eml). |
53
55
  | threadId | string | no | Thread ID (required for thread view). |
@@ -105,12 +107,45 @@ Nested requirements apply within the parent for the selected action.
105
107
 
106
108
  | Parameter | Type | Required | Values / description |
107
109
  | --- | --- | --- | --- |
108
- | action | string | yes | send, reply, forward, save_draft, update_draft, send_draft. |
110
+ | action | string | yes | send_draft. string value. |
109
111
  | folder | string | no | Source folder (required for reply/forward). |
110
112
  | uid | integer | no | Source message UID (required for reply/forward/update_draft/send_draft). |
111
113
  | input | object | no | ComposeInput / ReplyInput / ForwardInput payload. |
114
+ | input.from | object | no | Object: address (required), name. |
115
+ | input.from.address | string | yes | Email address. |
116
+ | input.from.name | string | no | Display name. |
117
+ | input.sender | object | no | Object: address (required), name. |
118
+ | input.sender.address | string | yes | Email address. |
119
+ | input.sender.name | string | no | Display name. |
120
+ | input.envelopeFrom | object | no | Object: address (required), name. |
121
+ | input.envelopeFrom.address | string | yes | Email address. |
122
+ | input.envelopeFrom.name | string | no | Display name. |
123
+ | input.replyTo | object | no | Object: address (required), name. |
124
+ | input.replyTo.address | string | yes | Email address. |
125
+ | input.replyTo.name | string | no | Display name. |
112
126
  | input.to | array | yes | Recipient addresses. |
127
+ | input.to[].address | string | yes | Email address. |
128
+ | input.to[].name | string | no | Display name. |
129
+ | input.cc | array | no | Recipient addresses. |
130
+ | input.cc[].address | string | yes | Email address. |
131
+ | input.cc[].name | string | no | Display name. |
132
+ | input.bcc | array | no | Recipient addresses. |
133
+ | input.bcc[].address | string | yes | Email address. |
134
+ | input.bcc[].name | string | no | Display name. |
113
135
  | input.subject | string | yes | Message subject. |
136
+ | input.text | string | no | Plain text body. |
137
+ | input.html | string | no | HTML body. |
138
+ | input.replyAll | boolean | no | Reply to all original recipients. |
139
+ | input.mode | string | no | inline, attachment. string value. |
140
+ | input.attachments | array | no | Message attachments. |
141
+ | input.attachments[].filename | string | yes | string value. |
142
+ | input.attachments[].content | any | yes | Attachment bytes (Buffer in library calls). |
143
+ | input.attachments[].mimeType | string | no | string value. |
144
+ | input.attachments[].inline | boolean | no | boolean value. |
145
+ | input.attachments[].contentId | string | no | string value. |
146
+ | input.inReplyTo | string | no | string value. |
147
+ | input.references | array | no | Array of string. |
148
+ | input.headers | object | no | object value. |
114
149
 
115
150
  Examples:
116
151
 
@@ -134,7 +169,7 @@ Nested requirements apply within the parent for the selected action.
134
169
 
135
170
  | Parameter | Type | Required | Values / description |
136
171
  | --- | --- | --- | --- |
137
- | action | string | yes | mark_read, mark_unread, star, unstar, mark_answered, copy, move, archive, trash, junk, not_junk, set_labels, add_labels, remove_labels, create_folder, rename_folder, delete_folder, subscribe_folder, unsubscribe_folder. |
172
+ | action | string | yes | unsubscribe_folder. string value. |
138
173
  | folder | string | no | Source folder (required for message actions). |
139
174
  | uids | array | no | Message UIDs to act on. |
140
175
  | destination | string | no | Destination folder (required for copy/move). |
@@ -165,7 +200,7 @@ Nested requirements apply within the parent for the selected action.
165
200
 
166
201
  | Parameter | Type | Required | Values / description |
167
202
  | --- | --- | --- | --- |
168
- | action | string | yes | connect, disconnect, reconnect, sync, refresh_folders, watch. |
203
+ | action | string | yes | connect, disconnect, reconnect, sync, refresh_folders, watch. string value. |
169
204
  | folders | array | no | Folders to sync or watch (optional — defaults to all subscribed folders). |
170
205
  | bodies | string | no | none, missing, all. Body fetch strategy for sync (default: missing). |
171
206
 
@@ -179,15 +214,15 @@ ghostpaw-email call mail_sync '{"action":"reconnect"}'
179
214
 
180
215
  ## Workflow guides
181
216
 
182
- - `ghostpaw-email skill triage-inbox` ([triage-inbox](references/triage-inbox.md)): Process a full inbox from scratch: sync to get latest state, read message queue, selectively fetch bodies for decisions, then bulk-organize by priority.
183
- - `ghostpaw-email skill read-and-reply` ([read-and-reply](references/read-and-reply.md)): Read a message with full thread context, then compose and send a properly-threaded reply with quoted attribution.
184
- - `ghostpaw-email skill connect-and-sync` ([connect-and-sync](references/connect-and-sync.md)): Establish or restore an IMAP connection, refresh the folder list, and pull new messages — handling first-run vs incremental scenarios.
185
- - `ghostpaw-email skill search-and-act` ([search-and-act](references/search-and-act.md)): Find messages matching criteria (local FTS first, remote IMAP SEARCH as fallback), verify targets, then act — organize, reply, or present.
186
- - `ghostpaw-email skill compose-and-send` ([compose-and-send](references/compose-and-send.md)): Full draft lifecycle — save, review, update, then send — plus direct send, reply, and forward with proper threading and forwarded-header blocks.
187
- - `ghostpaw-email skill organize-bulk` ([organize-bulk](references/organize-bulk.md)): Bulk organize messages across folders — flagging, moving, archiving, labelling — and manage the folder hierarchy as part of the flow.
188
- - `ghostpaw-email skill attachment-workflow` ([attachment-workflow](references/attachment-workflow.md)): Discover, inspect, and fetch email attachments on demand; embed attachments in outbound messages; and export or import full .eml files.
189
- - `ghostpaw-email skill recover-from-disruption` ([recover-from-disruption](references/recover-from-disruption.md)): Detect and recover from connection loss or IMAP/SMTP failures — reconnect with back-off, re-sync to reconcile state, and handle auth vs transient errors distinctly.
190
- - `ghostpaw-email skill cli` ([cli](references/cli.md)): Complete existing email CLI guide.
217
+ - `ghostpaw-email skill triage-inbox`: Process a full inbox from scratch: sync to get latest state, read message queue, selectively fetch bodies for decisions, then bulk-organize by priority.
218
+ - `ghostpaw-email skill read-and-reply`: Read a message with full thread context, then compose and send a properly-threaded reply with quoted attribution.
219
+ - `ghostpaw-email skill connect-and-sync`: Establish or restore an IMAP connection, refresh the folder list, and pull new messages — handling first-run vs incremental scenarios.
220
+ - `ghostpaw-email skill search-and-act`: Find messages matching criteria (local FTS first, remote IMAP SEARCH as fallback), verify targets, then act — organize, reply, or present.
221
+ - `ghostpaw-email skill compose-and-send`: Full draft lifecycle — save, review, update, then send — plus direct send, reply, and forward with proper threading and forwarded-header blocks.
222
+ - `ghostpaw-email skill organize-bulk`: Bulk organize messages across folders — flagging, moving, archiving, labelling — and manage the folder hierarchy as part of the flow.
223
+ - `ghostpaw-email skill attachment-workflow`: Discover, inspect, and fetch email attachments on demand; embed attachments in outbound messages; and export or import full .eml files.
224
+ - `ghostpaw-email skill recover-from-disruption`: Detect and recover from connection loss or IMAP/SMTP failures — reconnect with back-off, re-sync to reconcile state, and handle auth vs transient errors distinctly.
225
+ - `ghostpaw-email skill cli`: Complete existing email CLI guide.
191
226
 
192
227
  ## Principles
193
228