@atomicmail/agent-skill-openclaw 0.3.24

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.
Files changed (154) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +182 -0
  3. package/SKILL.md +206 -0
  4. package/esm/_dnt.polyfills.d.ts +101 -0
  5. package/esm/_dnt.polyfills.d.ts.map +1 -0
  6. package/esm/_dnt.polyfills.js +127 -0
  7. package/esm/lib/agent/auth/agent-auth-http.d.ts +26 -0
  8. package/esm/lib/agent/auth/agent-auth-http.d.ts.map +1 -0
  9. package/esm/lib/agent/auth/agent-auth-http.js +85 -0
  10. package/esm/lib/agent/auth/agent-jwt.d.ts +12 -0
  11. package/esm/lib/agent/auth/agent-jwt.d.ts.map +1 -0
  12. package/esm/lib/agent/auth/agent-jwt.js +27 -0
  13. package/esm/lib/agent/auth/agent-pow.d.ts +5 -0
  14. package/esm/lib/agent/auth/agent-pow.d.ts.map +1 -0
  15. package/esm/lib/agent/auth/agent-pow.js +49 -0
  16. package/esm/lib/agent/jmap/agent-help-content.d.ts +2 -0
  17. package/esm/lib/agent/jmap/agent-help-content.d.ts.map +1 -0
  18. package/esm/lib/agent/jmap/agent-help-content.js +2 -0
  19. package/esm/lib/agent/jmap/agent-jmap-blob-limits.d.ts +27 -0
  20. package/esm/lib/agent/jmap/agent-jmap-blob-limits.d.ts.map +1 -0
  21. package/esm/lib/agent/jmap/agent-jmap-blob-limits.js +166 -0
  22. package/esm/lib/agent/jmap/agent-jmap-blob-upload.d.ts +24 -0
  23. package/esm/lib/agent/jmap/agent-jmap-blob-upload.d.ts.map +1 -0
  24. package/esm/lib/agent/jmap/agent-jmap-blob-upload.js +104 -0
  25. package/esm/lib/agent/jmap/agent-jmap-email-charset.d.ts +8 -0
  26. package/esm/lib/agent/jmap/agent-jmap-email-charset.d.ts.map +1 -0
  27. package/esm/lib/agent/jmap/agent-jmap-email-charset.js +61 -0
  28. package/esm/lib/agent/jmap/agent-jmap-run.d.ts +52 -0
  29. package/esm/lib/agent/jmap/agent-jmap-run.d.ts.map +1 -0
  30. package/esm/lib/agent/jmap/agent-jmap-run.js +260 -0
  31. package/esm/lib/agent/jmap/agent-jmap-verify.d.ts +9 -0
  32. package/esm/lib/agent/jmap/agent-jmap-verify.d.ts.map +1 -0
  33. package/esm/lib/agent/jmap/agent-jmap-verify.js +50 -0
  34. package/esm/lib/agent/jmap/agent-jmap.d.ts +89 -0
  35. package/esm/lib/agent/jmap/agent-jmap.d.ts.map +1 -0
  36. package/esm/lib/agent/jmap/agent-jmap.js +373 -0
  37. package/esm/lib/agent/jmap/agent-vars.d.ts +30 -0
  38. package/esm/lib/agent/jmap/agent-vars.d.ts.map +1 -0
  39. package/esm/lib/agent/jmap/agent-vars.js +96 -0
  40. package/esm/lib/agent/jmap/help-content/auth.d.ts +2 -0
  41. package/esm/lib/agent/jmap/help-content/auth.d.ts.map +1 -0
  42. package/esm/lib/agent/jmap/help-content/auth.js +33 -0
  43. package/esm/lib/agent/jmap/help-content/cron.d.ts +6 -0
  44. package/esm/lib/agent/jmap/help-content/cron.d.ts.map +1 -0
  45. package/esm/lib/agent/jmap/help-content/cron.js +159 -0
  46. package/esm/lib/agent/jmap/help-content/index.d.ts +6 -0
  47. package/esm/lib/agent/jmap/help-content/index.d.ts.map +1 -0
  48. package/esm/lib/agent/jmap/help-content/index.js +61 -0
  49. package/esm/lib/agent/jmap/help-content/installation.d.ts +2 -0
  50. package/esm/lib/agent/jmap/help-content/installation.d.ts.map +1 -0
  51. package/esm/lib/agent/jmap/help-content/installation.js +47 -0
  52. package/esm/lib/agent/jmap/help-content/jmap-cheatsheet.d.ts +2 -0
  53. package/esm/lib/agent/jmap/help-content/jmap-cheatsheet.d.ts.map +1 -0
  54. package/esm/lib/agent/jmap/help-content/jmap-cheatsheet.js +230 -0
  55. package/esm/lib/agent/jmap/help-content/multi-account.d.ts +2 -0
  56. package/esm/lib/agent/jmap/help-content/multi-account.d.ts.map +1 -0
  57. package/esm/lib/agent/jmap/help-content/multi-account.js +49 -0
  58. package/esm/lib/agent/jmap/help-content/overview.d.ts +2 -0
  59. package/esm/lib/agent/jmap/help-content/overview.d.ts.map +1 -0
  60. package/esm/lib/agent/jmap/help-content/overview.js +49 -0
  61. package/esm/lib/agent/jmap/help-content/presets.d.ts +2 -0
  62. package/esm/lib/agent/jmap/help-content/presets.d.ts.map +1 -0
  63. package/esm/lib/agent/jmap/help-content/presets.js +51 -0
  64. package/esm/lib/agent/jmap/help-content/tools.d.ts +2 -0
  65. package/esm/lib/agent/jmap/help-content/tools.d.ts.map +1 -0
  66. package/esm/lib/agent/jmap/help-content/tools.js +49 -0
  67. package/esm/lib/agent/jmap/help-content/troubleshooting.d.ts +2 -0
  68. package/esm/lib/agent/jmap/help-content/troubleshooting.d.ts.map +1 -0
  69. package/esm/lib/agent/jmap/help-content/troubleshooting.js +65 -0
  70. package/esm/lib/agent/session/agent-credentials-store.d.ts +45 -0
  71. package/esm/lib/agent/session/agent-credentials-store.d.ts.map +1 -0
  72. package/esm/lib/agent/session/agent-credentials-store.js +121 -0
  73. package/esm/lib/agent/session/agent-resolve-config.d.ts +29 -0
  74. package/esm/lib/agent/session/agent-resolve-config.d.ts.map +1 -0
  75. package/esm/lib/agent/session/agent-resolve-config.js +71 -0
  76. package/esm/lib/agent/session/agent-session-for-dir.d.ts +8 -0
  77. package/esm/lib/agent/session/agent-session-for-dir.d.ts.map +1 -0
  78. package/esm/lib/agent/session/agent-session-for-dir.js +33 -0
  79. package/esm/lib/agent/session/agent-session.d.ts +89 -0
  80. package/esm/lib/agent/session/agent-session.d.ts.map +1 -0
  81. package/esm/lib/agent/session/agent-session.js +320 -0
  82. package/esm/lib/agent/session/inbox-id-to-mailbox-email.d.ts +6 -0
  83. package/esm/lib/agent/session/inbox-id-to-mailbox-email.d.ts.map +1 -0
  84. package/esm/lib/agent/session/inbox-id-to-mailbox-email.js +21 -0
  85. package/esm/lib/core/consts.d.ts +17 -0
  86. package/esm/lib/core/consts.d.ts.map +1 -0
  87. package/esm/lib/core/consts.js +28 -0
  88. package/esm/lib/core/jmap-hints.d.ts +3 -0
  89. package/esm/lib/core/jmap-hints.d.ts.map +1 -0
  90. package/esm/lib/core/jmap-hints.js +6 -0
  91. package/esm/lib/core/messages.d.ts +6 -0
  92. package/esm/lib/core/messages.d.ts.map +1 -0
  93. package/esm/lib/core/messages.js +19 -0
  94. package/esm/lib/core/read-npm-package-readme.d.ts +6 -0
  95. package/esm/lib/core/read-npm-package-readme.d.ts.map +1 -0
  96. package/esm/lib/core/read-npm-package-readme.js +81 -0
  97. package/esm/lib/core/shared-assets.d.ts +6 -0
  98. package/esm/lib/core/shared-assets.d.ts.map +1 -0
  99. package/esm/lib/core/shared-assets.js +46 -0
  100. package/esm/lib/core/types.d.ts +2 -0
  101. package/esm/lib/core/types.d.ts.map +1 -0
  102. package/esm/lib/core/types.js +2 -0
  103. package/esm/lib/core/utils.d.ts +12 -0
  104. package/esm/lib/core/utils.d.ts.map +1 -0
  105. package/esm/lib/core/utils.js +29 -0
  106. package/esm/lib/integrations/create-agent-session.d.ts +25 -0
  107. package/esm/lib/integrations/create-agent-session.d.ts.map +1 -0
  108. package/esm/lib/integrations/create-agent-session.js +36 -0
  109. package/esm/lib/integrations/key-value-credential-store.d.ts +21 -0
  110. package/esm/lib/integrations/key-value-credential-store.d.ts.map +1 -0
  111. package/esm/lib/integrations/key-value-credential-store.js +71 -0
  112. package/esm/lib/integrations/n8n-credential-store.d.ts +18 -0
  113. package/esm/lib/integrations/n8n-credential-store.d.ts.map +1 -0
  114. package/esm/lib/integrations/n8n-credential-store.js +62 -0
  115. package/esm/lib/mod.d.ts +23 -0
  116. package/esm/lib/mod.d.ts.map +1 -0
  117. package/esm/lib/mod.js +22 -0
  118. package/esm/lib/network/auth-client.d.ts +57 -0
  119. package/esm/lib/network/auth-client.d.ts.map +1 -0
  120. package/esm/lib/network/auth-client.js +210 -0
  121. package/esm/package.json +3 -0
  122. package/esm/skill/cli.d.ts +3 -0
  123. package/esm/skill/cli.d.ts.map +1 -0
  124. package/esm/skill/cli.js +321 -0
  125. package/package.json +45 -0
  126. package/presets/list_inbox.json +46 -0
  127. package/presets/reply.json +97 -0
  128. package/presets/send_mail.json +70 -0
  129. package/presets/send_mail_attachment.json +92 -0
  130. package/presets/send_mail_blob_attachment.json +74 -0
  131. package/shared/consts.json +11 -0
  132. package/shared/fixtures/pow_vectors.json +32 -0
  133. package/shared/help/fragments/inbox_cron_agent_prompt.md +1 -0
  134. package/shared/help/fragments/post_register_cron_reminder.md +5 -0
  135. package/shared/help/readme_stub.md +3 -0
  136. package/shared/help/topics/auth.md +8 -0
  137. package/shared/help/topics/cron.md +217 -0
  138. package/shared/help/topics/installation.md +35 -0
  139. package/shared/help/topics/jmap_cheatsheet.md +19 -0
  140. package/shared/help/topics/multi_account.md +9 -0
  141. package/shared/help/topics/overview.md +27 -0
  142. package/shared/help/topics/presets.md +12 -0
  143. package/shared/help/topics/tools.md +16 -0
  144. package/shared/help/topics/troubleshooting.md +6 -0
  145. package/shared/manifest.json +31 -0
  146. package/shared/messages/errors.json +68 -0
  147. package/shared/messages/hints.json +8 -0
  148. package/shared/presets/list_inbox.json +46 -0
  149. package/shared/presets/reply.json +97 -0
  150. package/shared/presets/send_mail.json +70 -0
  151. package/shared/presets/send_mail_attachment.json +92 -0
  152. package/shared/presets/send_mail_blob_attachment.json +74 -0
  153. package/shared/skill/SKILL.template.md +202 -0
  154. package/shared/skill/manifest.json +89 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Atomic Mail
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ Install package for openclaw integration (same as @atomicmail/agent-skill).
2
+
3
+ ---
4
+ description: Install and run the @atomicmail/agent-skill-gh-pages CLI (register, jmap_request, help) for shell-capable agents and automation.
5
+ ---
6
+
7
+ # @atomicmail/agent-skill-gh-pages
8
+
9
+ Atomic Mail AgentSkill CLI for shell-capable AI agents. It exposes three
10
+ commands: `register`, `jmap_request`, and `help`. **`jmap_request`** uses the
11
+ same shared library as **`@atomicmail/mcp-gh-pages`**.
12
+
13
+ ## For AI agents — run `atomicmail help`
14
+
15
+ **Invoke `atomicmail help` before improvising JMAP or preset details.** The CLI
16
+ embeds the topic docs — written for agents,
17
+ version-matched to your install, and cheaper to fetch on demand than reconstructing
18
+ placeholder grammar or attachment flows from memory.
19
+
20
+ **When to call help:** at the start of a mail task (`atomicmail help` or
21
+ `help --topic overview`); before custom batches (`help --topic presets` and
22
+ `help --topic jmap_cheatsheet`); right after `register` (`help --topic cron`
23
+ for hourly inbox polling after `register`); when errors mention missing
24
+ placeholders, auth, or an old preset file on disk (`help --topic
25
+ troubleshooting`). Prefer the installed binary over static README copies in
26
+ other repos — **trust `help` from the package you are running**.
27
+
28
+ ## Install / run
29
+
30
+ ```bash
31
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail --help
32
+ ```
33
+
34
+ ## Quick start
35
+
36
+ ```bash
37
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail register \
38
+ --username "myagent"
39
+
40
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail jmap_request \
41
+ --ops '[["Mailbox/get", {"accountId": "$ACCOUNT_ID"}, "m0"]]'
42
+ ```
43
+
44
+ Usernames must be 5–21 characters (local-part of your `@atomicmail.ai`
45
+ address).
46
+
47
+ If credentials already exist for a different username, `register` fails by
48
+ default. Pass `--forced` only after backing up the credential directory.
49
+
50
+ ## After register: hourly inbox polling
51
+
52
+ After `register`, arrange hourly inbox polling per your runtime. **Native cron
53
+ hosts** (OpenClaw, Hermes, atomic-agent) schedule an **hourly AI agent** to
54
+ fetch and triage mail with preset `list_inbox.json`. **Hosts without native
55
+ cron** should ask the operator to set up polling on a capable host, or remind
56
+ manual fetch — do **not** work around with OS schedulers or cross-platform
57
+ scheduling. Do **not** cron `atomicmail jmap_request` alone.
58
+
59
+ **Hermes users:** follow [Hermes Agent](#hermes-agent) — accept the skill
60
+ blueprint via `/suggestions` after `register`.
61
+
62
+ Options and agent prompt:
63
+ [`SKILL.md`](./SKILL.md#hourly-inbox-polling-after-register) · `atomicmail help --topic cron`
64
+ · MCP `help` topic `cron`
65
+
66
+ ## Hermes Agent
67
+
68
+ Hermes ships a bundled Atomic Mail skill with a launcher CLI and an hourly inbox
69
+ blueprint. Requires [Hermes](https://hermes-agent.nousresearch.com) with the
70
+ skills toolset and Node.js 20+ (for the bundled launcher).
71
+
72
+ ### Install
73
+
74
+ Unified in-repo tap (updated on each GitHub release):
75
+
76
+ ```bash
77
+ hermes skills install Atomic-Mail/atomic-mail-agentic/integrations/skill/atomicmail
78
+ ```
79
+
80
+ ### Credentials
81
+
82
+ On Hermes the default credential directory is **`~/.hermes/atomicmail`**, not
83
+ `~/.atomicmail` (used by npm/npx AgentSkill and MCP defaults).
84
+
85
+ The skill launcher sets `ATOMIC_MAIL_CREDENTIALS_DIR` to `$HOME/.hermes/atomicmail`
86
+ when that variable is **not** already set. Override explicitly with
87
+ `ATOMIC_MAIL_CREDENTIALS_DIR` or `atomicmail.credentials_dir` in Hermes config.
88
+
89
+ | Runtime | Default credentials dir |
90
+ | ------- | ----------------------- |
91
+ | Hermes skill | `~/.hermes/atomicmail` |
92
+ | npm/npx AgentSkill, MCP | `~/.atomicmail` |
93
+
94
+ Files in each directory (mode `0600`): `credentials.json`, `session.jwt`,
95
+ `capability.jwt`.
96
+
97
+ ### Register
98
+
99
+ Use the skill's bundled CLI — no `npx`:
100
+
101
+ ```bash
102
+ atomicmail register --username "myagent"
103
+ ```
104
+
105
+ The launcher handles the credentials directory; omit `--credentials-dir` in the
106
+ default single-inbox flow. For **multiple inboxes**, pass `--credentials-dir`
107
+ with a separate directory per account on `register` and `jmap_request`.
108
+
109
+ ### After register (required)
110
+
111
+ 1. Run `/suggestions` in Hermes and **accept** the Atomic Mail hourly inbox
112
+ blueprint.
113
+ 2. The blueprint schedules a full **agent** turn (`no_agent: false`) with
114
+ `list_inbox.json` and `deliver: origin`. Do **not** skip this step.
115
+ 3. Do **not** cron raw `jmap_request` alone or use `--no-agent` (no LLM triage).
116
+
117
+ **Manual fallback** if you skip the blueprint:
118
+
119
+ ```bash
120
+ hermes cron create "0 * * * *" \
121
+ "Use atomicmail jmap_request --ops-file list_inbox.json to fetch my inbox. Summarize new messages, highlight what needs a reply, and stay available — I may ask you to reply, forward, search, or dig into something important." \
122
+ --name "atomicmail-inbox" \
123
+ --deliver origin
124
+ ```
125
+
126
+ See `atomicmail help --topic cron` for the full prompt and delivery options.
127
+
128
+ ### Links
129
+
130
+ - Hermes creating skills (blueprints):
131
+ https://hermes-agent.nousresearch.com/docs/developer-guide/creating-skills
132
+ - Hermes cron (manual fallback):
133
+ https://hermes-agent.nousresearch.com/docs/user-guide/features/cron
134
+ - Maintainer publish workflow:
135
+ [CONTRIBUTING.md](https://github.com/Atomic-Mail/atomic-mail-agentic/blob/develop/CONTRIBUTING.md)
136
+ (unified skill section)
137
+
138
+ ## `jmap_request`, presets, and placeholders
139
+
140
+ `jmap_request` accepts inline `--ops` JSON or `--ops-file` (same shapes as MCP:
141
+ methodCalls array or full `{ "using", "methodCalls" }`). Pass custom
142
+ `$PLACEHOLDERS` via `--vars '{"PLACEHOLDER":"value"}'` (keys without `$`).
143
+
144
+ ```bash
145
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail jmap_request \
146
+ --ops-file send_mail.json \
147
+ --vars '{"TO":"alice@example.com","SUBJECT":"Hello","BODY":"Hi there"}'
148
+ ```
149
+
150
+ **Resolution:** relative `--ops-file` resolves to `--credentials-dir` (default
151
+ `~/.atomicmail`), then bundled presets.
152
+
153
+ **Details** (placeholder grammar, built-ins, shadowing, bundled preset list,
154
+ attachments): see [@atomicmail/mcp-gh-pages](./mcp.md) and the embedded **`help`** topic
155
+ **`presets`** (`atomicmail help --topic presets`).
156
+
157
+ ## Shared state
158
+
159
+ Each credential **directory** is an isolated account (default `~/.atomicmail`,
160
+ mode `0600` files):
161
+
162
+ - `credentials.json`
163
+ - `session.jwt`
164
+ - `capability.jwt`
165
+
166
+ The CLI and MCP read and write the directory you select per command
167
+ (`--credentials-dir` / `credentials_dir`) or the default from
168
+ `ATOMIC_MAIL_CREDENTIALS_DIR`. Multiple accounts = multiple directories; see
169
+ MCP `help` topic `multi_account` or [mcp.md](./mcp.md#multiple-accounts--agents).
170
+
171
+ ## Defaults
172
+
173
+ - auth endpoint: `https://auth.atomicmail.ai`
174
+ - api endpoint: `https://api.atomicmail.ai`
175
+ - credentials directory: `~/.atomicmail`
176
+
177
+ ## Overriding defaults
178
+
179
+ - Endpoints: `--auth-url`, `--api-url` or `ATOMIC_MAIL_AUTH_URL`,
180
+ `ATOMIC_MAIL_API_URL`
181
+ - Credentials path: `--credentials-dir` or `ATOMIC_MAIL_CREDENTIALS_DIR`
182
+ - PoW salt: `--scrypt-salt` or `ATOMIC_MAIL_SCRYPT_SALT`
package/SKILL.md ADDED
@@ -0,0 +1,206 @@
1
+ ---
2
+ name: atomicmail
3
+ description: Read and write email through the Atomic Mail from an AI agent. Handles proof-of-work authentication and JMAP so the agent thinks in JMAP method calls. Use when the user asks to register an email inbox, list mailboxes, fetch or send email.
4
+ ---
5
+ # Atomic Mail
6
+
7
+ Atomic Mail exposes a programmable inbox over JMAP with PoW signup and JWT
8
+ rotation. This skill ships a single CLI entrypoint with three commands:
9
+ **`register`**, **`jmap_request`**, and **`help`** — matching the MCP server.
10
+
11
+ ## When to use this skill
12
+
13
+ - Register a new inbox or log in with an existing API key.
14
+ - Send JMAP batches (inline JSON or preset files).
15
+ - Read built-in documentation (JMAP cheatsheet, presets, troubleshooting) or the
16
+ package README (`atomicmail help --topic readme`).
17
+
18
+ **Call `atomicmail help` early and often** — before guessing
19
+ placeholders, `using` URNs, or cron setup. Start with `help --topic overview`,
20
+ then `presets` before custom `jmap_request` calls and `cron` after `register`.
21
+ If installed behavior disagrees with docs elsewhere, trust help from the running
22
+ package.
23
+
24
+ ## Commands
25
+
26
+ ```bash
27
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail register --username "myagent"
28
+
29
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail jmap_request --ops-file list_inbox.json
30
+ ```
31
+
32
+ Run **`atomicmail --help`** or **`atomicmail <command> --help`** for flags.
33
+
34
+ ## Defaults
35
+
36
+ - `authUrl`: `https://auth.atomicmail.ai`
37
+ - `apiUrl`: `https://api.atomicmail.ai`
38
+ - credentials directory: `~/.atomicmail`
39
+
40
+ ## Workflow
41
+
42
+ ### 1. Register (new account)
43
+
44
+ ```bash
45
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail register \
46
+ --username "alice"
47
+ ```
48
+
49
+ Writes `credentials.json`, `session.jwt`, `capability.jwt`. Prints JSON
50
+ including `inbox` and `accountId`.
51
+
52
+ **Required next step:** after register, arrange hourly inbox polling per your
53
+ runtime (see [Hourly inbox polling](#hourly-inbox-polling-after-register)).
54
+ Native cron hosts schedule an **agent** job with `list_inbox.json`; hosts
55
+ without native cron should ask the operator or remind manual fetch. Do not cron
56
+ `atomicmail jmap_request` alone.
57
+
58
+ Usernames must be 5–21 characters (local-part of your `@atomicmail.ai`
59
+ address).
60
+
61
+ If credentials already exist for a different username, register fails by
62
+ default to protect the old account. To add another inbox without replacing the
63
+ current one, pass a separate `--credentials-dir` (MCP: `credentials_dir` on
64
+ `register` / `jmap_request`). Use `--forced` only when you intend to replace
65
+ credentials in the **same** directory (after backing it up).
66
+
67
+ ### 2. Register (existing API key, in case losing the credentials file)
68
+
69
+ ```bash
70
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail register \
71
+ --api-key "..."
72
+ ```
73
+
74
+ ### 3. JMAP request
75
+
76
+ ```bash
77
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail jmap_request \
78
+ --ops '[["Mailbox/get", {"accountId": "$ACCOUNT_ID"}, "m0"]]'
79
+ ```
80
+
81
+ `$ACCOUNT_ID`, `$INBOX`, `$INBOX_MAILBOX_ID`, `$UPLOAD_URL`, and `$DOWNLOAD_URL`
82
+ resolve from the session/credentials. Other placeholders such as `$TO` or
83
+ `$SUBJECT` require `--vars` with a JSON object of strings (same substitution
84
+ applies to `--ops` and `--ops-file`).
85
+
86
+ Preset file:
87
+
88
+ ```bash
89
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail jmap_request \
90
+ --ops-file list_inbox.json
91
+ ```
92
+
93
+ With custom placeholders:
94
+
95
+ ```bash
96
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail jmap_request \
97
+ --ops-file send_mail.json \
98
+ --vars '{"TO":"alice@example.com","SUBJECT":"Hello","BODY":"Hi there"}'
99
+ ```
100
+
101
+ Bundled presets (no local file creation required):
102
+
103
+ - `send_mail.json` (`$TO`, `$SUBJECT`, `$BODY`)
104
+ - `send_mail_attachment.json` (`$TO`, `$SUBJECT`, `$BODY`, `$ATTACHMENT_BASE64`,
105
+ `$ATTACHMENT_TYPE`, `$ATTACHMENT_NAME`)
106
+ - `send_mail_blob_attachment.json` (`$TO`, `$SUBJECT`, `$BODY`; pair with
107
+ repeatable **`--attachment PATH`** for RFC 8620 upload →
108
+ `$ATTACHMENT_0_BLOB_ID`, …)
109
+ - `list_inbox.json` (latest 50; uses `$INBOX_MAILBOX_ID`) — **used for hourly inbox polling**
110
+ - `reply.json` (`$MAIL_ID`, `$BODY`)
111
+
112
+ ## Hourly inbox polling (after register)
113
+
114
+ Registration only creates credentials. Inbound mail should be fetched and
115
+ triaged about once per hour between interactive sessions.
116
+
117
+ **Choose the path that matches your runtime — do not mix platforms.**
118
+
119
+ ### If your host supports scheduled jobs
120
+
121
+ OpenClaw, Hermes, atomic-agent, and similar hosts with native cron: set up an
122
+ hourly **agent** job after the first successful `register`. Wire Atomic Mail MCP
123
+ or AgentSkill into that agent. The scheduled turn should call `list_inbox.json`
124
+ inside the agent prompt.
125
+
126
+ ### If your host does **not** support scheduled jobs
127
+
128
+ Claude, Pi, Cursor, and other chat agents without a cron API: **do not spend
129
+ tokens trying to work around this** — no wrapper scripts, OS crontab/LaunchAgent
130
+ setup, or scheduling on a different platform.
131
+
132
+ After register, either **ask your operator** to set up hourly polling on a
133
+ capable host (share the examples below), or **remind your operator** to fetch
134
+ mail manually when needed.
135
+
136
+ ### Forbidden: cross-platform scheduling
137
+
138
+ Do not register in one runtime and schedule the cron job on another (e.g. Pi
139
+ runs `register`, then creates an OpenClaw cron job).
140
+
141
+ **Do not** cron `atomicmail jmap_request` alone (no agent). **Do not** use
142
+ headless one-shot CLIs (`claude -p`, `pi -p`, `codex exec`) if you want to
143
+ continue the thread.
144
+
145
+ ### Scheduling examples (capable hosts or operators)
146
+
147
+ | Your setup | Approach |
148
+ | --- | --- |
149
+ | OpenClaw | `openclaw cron add` with `--announce` |
150
+ | Hermes | `hermes cron create` or `/cron` with `--deliver` |
151
+ | Atomic Bot | Same as OpenClaw or Hermes |
152
+ | atomic-agent | `atomic-agent task create --cron` |
153
+ | No native cron (Claude, Pi, Cursor, …) | Ask operator to schedule on a capable host, or remind manual fetch |
154
+
155
+ Full options, agent prompt, and operator OS-scheduling notes: `atomicmail help
156
+ --topic cron` or MCP `help` topic `cron`.
157
+
158
+ ### Agent prompt (all workflows)
159
+
160
+ ```text
161
+ Use Atomic Mail to fetch my inbox (MCP jmap_request with ops_file list_inbox.json, or atomicmail jmap_request --ops-file list_inbox.json). Summarize new messages, highlight what needs a reply, and stay available — I may ask you to reply, forward, search, or dig into something important.
162
+ ```
163
+
164
+ ### Built-in cron examples
165
+
166
+ **OpenClaw** — [cron docs](https://docs.openclaw.ai/automation/cron-jobs): isolated
167
+ session, `--announce` for delivery.
168
+
169
+ **Hermes** — [cron docs](https://hermes-agent.nousresearch.com/docs/user-guide/features/cron):
170
+ `--deliver origin` (or `telegram`, `discord`, `email`, …); not `--no-agent`.
171
+
172
+ **atomic-agent** — `atomic-agent task create --cron "0 * * * *" --message "<prompt>"`
173
+
174
+ For operator OS-scheduling patterns on terminal hosts, see `help --topic cron`.
175
+
176
+ ### 4. Help
177
+
178
+ ```bash
179
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail help
180
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail help --topic jmap_cheatsheet
181
+ ```
182
+
183
+ ## Security
184
+
185
+ - `credentials.json` holds the API key (mode `0600`). Do not commit it.
186
+ - JWT files are bearer secrets — do not log them.
187
+
188
+ ## Attachments and blobs
189
+
190
+ Use **`send_mail_attachment.json`** (in-band base64) or **`send_mail_blob_attachment.json`**
191
+ with repeatable **`--attachment PATH`** (RFC 8620 upload — same flow as MCP
192
+ **`attachments`**). Rules, limits, and `Blob/upload` JSON shape:
193
+ **`atomicmail help --topic jmap_cheatsheet`**.
194
+
195
+ ```bash
196
+ npx --package=@atomicmail/agent-skill-gh-pages atomicmail jmap_request \
197
+ --ops-file send_mail_attachment.json \
198
+ --vars '{"TO":"you@example.com","SUBJECT":"Hi","BODY":"See file","ATTACHMENT_BASE64":"SGVsbG8=","ATTACHMENT_TYPE":"text/plain","ATTACHMENT_NAME":"note.txt"}'
199
+ ```
200
+
201
+ ## Overriding defaults
202
+
203
+ - Endpoints: `--auth-url`, `--api-url` or `ATOMIC_MAIL_AUTH_URL`,
204
+ `ATOMIC_MAIL_API_URL`
205
+ - Credentials path: `--credentials-dir` or `ATOMIC_MAIL_CREDENTIALS_DIR`
206
+ - PoW salt: `--scrypt-salt` or `ATOMIC_MAIL_SCRYPT_SALT`
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
3
+ * but instead of using npm to install additional dependencies,
4
+ * this approach manually consolidates cjs/mjs/d.ts into a single file.
5
+ *
6
+ * Note that this code might be imported multiple times
7
+ * (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
8
+ * or Node.js might dynamically clear the cache and then force a require).
9
+ * Therefore, it's important to avoid redundant writes to global objects.
10
+ * Additionally, consider that commonjs is used alongside esm,
11
+ * so the two ponyfill functions are stored independently in two separate global objects.
12
+ */
13
+ import { createRequire } from "node:module";
14
+ import { type URL } from "node:url";
15
+ declare global {
16
+ interface ImportMeta {
17
+ /** A string representation of the fully qualified module URL. When the
18
+ * module is loaded locally, the value will be a file URL (e.g.
19
+ * `file:///path/module.ts`).
20
+ *
21
+ * You can also parse the string as a URL to determine more information about
22
+ * how the current module was loaded. For example to determine if a module was
23
+ * local or not:
24
+ *
25
+ * ```ts
26
+ * const url = new URL(import.meta.url);
27
+ * if (url.protocol === "file:") {
28
+ * console.log("this module was loaded locally");
29
+ * }
30
+ * ```
31
+ */
32
+ url: string;
33
+ /**
34
+ * A function that returns resolved specifier as if it would be imported
35
+ * using `import(specifier)`.
36
+ *
37
+ * ```ts
38
+ * console.log(import.meta.resolve("./foo.js"));
39
+ * // file:///dev/foo.js
40
+ * ```
41
+ *
42
+ * @param specifier The module specifier to resolve relative to `parent`.
43
+ * @param parent The absolute parent module URL to resolve from.
44
+ * @returns The absolute (`file:`) URL string for the resolved module.
45
+ */
46
+ resolve(specifier: string, parent?: string | URL | undefined): string;
47
+ /** A flag that indicates if the current module is the main module that was
48
+ * called when starting the program under Deno.
49
+ *
50
+ * ```ts
51
+ * if (import.meta.main) {
52
+ * // this was loaded as the main module, maybe do some bootstrapping
53
+ * }
54
+ * ```
55
+ */
56
+ main: boolean;
57
+ /** The absolute path of the current module.
58
+ *
59
+ * This property is only provided for local modules (ie. using `file://` URLs).
60
+ *
61
+ * Example:
62
+ * ```
63
+ * // Unix
64
+ * console.log(import.meta.filename); // /home/alice/my_module.ts
65
+ *
66
+ * // Windows
67
+ * console.log(import.meta.filename); // C:\alice\my_module.ts
68
+ * ```
69
+ */
70
+ filename: string;
71
+ /** The absolute path of the directory containing the current module.
72
+ *
73
+ * This property is only provided for local modules (ie. using `file://` URLs).
74
+ *
75
+ * * Example:
76
+ * ```
77
+ * // Unix
78
+ * console.log(import.meta.dirname); // /home/alice
79
+ *
80
+ * // Windows
81
+ * console.log(import.meta.dirname); // C:\alice
82
+ * ```
83
+ */
84
+ dirname: string;
85
+ }
86
+ }
87
+ type NodeRequest = ReturnType<typeof createRequire>;
88
+ type NodeModule = NonNullable<NodeRequest["main"]>;
89
+ interface ImportMetaPonyfillCommonjs {
90
+ (require: NodeRequest, module: NodeModule): ImportMeta;
91
+ }
92
+ interface ImportMetaPonyfillEsmodule {
93
+ (importMeta: ImportMeta): ImportMeta;
94
+ }
95
+ interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
96
+ }
97
+ export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
98
+ export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
99
+ export declare let import_meta_ponyfill: ImportMetaPonyfill;
100
+ export {};
101
+ //# sourceMappingURL=_dnt.polyfills.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
3
+ * but instead of using npm to install additional dependencies,
4
+ * this approach manually consolidates cjs/mjs/d.ts into a single file.
5
+ *
6
+ * Note that this code might be imported multiple times
7
+ * (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
8
+ * or Node.js might dynamically clear the cache and then force a require).
9
+ * Therefore, it's important to avoid redundant writes to global objects.
10
+ * Additionally, consider that commonjs is used alongside esm,
11
+ * so the two ponyfill functions are stored independently in two separate global objects.
12
+ */
13
+ //@ts-ignore
14
+ import { createRequire } from "node:module";
15
+ //@ts-ignore
16
+ import { fileURLToPath, pathToFileURL } from "node:url";
17
+ //@ts-ignore
18
+ import { dirname } from "node:path";
19
+ const defineGlobalPonyfill = (symbolFor, fn) => {
20
+ if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
21
+ Object.defineProperty(globalThis, Symbol.for(symbolFor), {
22
+ configurable: true,
23
+ get() {
24
+ return fn;
25
+ },
26
+ });
27
+ }
28
+ };
29
+ export let import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
30
+ (() => {
31
+ const moduleImportMetaWM = new WeakMap();
32
+ return (require, module) => {
33
+ let importMetaCache = moduleImportMetaWM.get(module);
34
+ if (importMetaCache == null) {
35
+ const importMeta = Object.assign(Object.create(null), {
36
+ url: pathToFileURL(module.filename).href,
37
+ main: require.main == module,
38
+ resolve: (specifier, parentURL = importMeta.url) => {
39
+ return pathToFileURL((importMeta.url === parentURL
40
+ ? require
41
+ : createRequire(parentURL))
42
+ .resolve(specifier)).href;
43
+ },
44
+ filename: module.filename,
45
+ dirname: module.path,
46
+ });
47
+ moduleImportMetaWM.set(module, importMeta);
48
+ importMetaCache = importMeta;
49
+ }
50
+ return importMetaCache;
51
+ };
52
+ })());
53
+ defineGlobalPonyfill("import-meta-ponyfill-commonjs", import_meta_ponyfill_commonjs);
54
+ export let import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
55
+ ((importMeta) => {
56
+ const resolveFunStr = String(importMeta.resolve);
57
+ const shimWs = new WeakSet();
58
+ //@ts-ignore
59
+ const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
60
+ .replace(/\/{3,}/, "///");
61
+ const commonShim = (importMeta) => {
62
+ if (typeof importMeta.main !== "boolean") {
63
+ importMeta.main = importMeta.url === mainUrl;
64
+ }
65
+ if (typeof importMeta.filename !== "string") {
66
+ importMeta.filename = fileURLToPath(importMeta.url);
67
+ importMeta.dirname = dirname(importMeta.filename);
68
+ }
69
+ };
70
+ if (
71
+ // v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
72
+ resolveFunStr === "undefined" ||
73
+ // v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
74
+ resolveFunStr.startsWith("async")
75
+ // enable by --experimental-import-meta-resolve flag
76
+ ) {
77
+ import_meta_ponyfill_esmodule = (importMeta) => {
78
+ if (!shimWs.has(importMeta)) {
79
+ shimWs.add(importMeta);
80
+ const importMetaUrlRequire = {
81
+ url: importMeta.url,
82
+ require: createRequire(importMeta.url),
83
+ };
84
+ importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
85
+ return pathToFileURL((importMetaUrlRequire.url === parentURL
86
+ ? importMetaUrlRequire.require
87
+ : createRequire(parentURL)).resolve(specifier)).href;
88
+ };
89
+ commonShim(importMeta);
90
+ }
91
+ return importMeta;
92
+ };
93
+ }
94
+ else {
95
+ /// native support
96
+ import_meta_ponyfill_esmodule = (importMeta) => {
97
+ if (!shimWs.has(importMeta)) {
98
+ shimWs.add(importMeta);
99
+ commonShim(importMeta);
100
+ }
101
+ return importMeta;
102
+ };
103
+ }
104
+ return import_meta_ponyfill_esmodule(importMeta);
105
+ }));
106
+ defineGlobalPonyfill("import-meta-ponyfill-esmodule", import_meta_ponyfill_esmodule);
107
+ export let import_meta_ponyfill = ((...args) => {
108
+ const _MODULE = (() => {
109
+ if (typeof require === "function" && typeof module === "object") {
110
+ return "commonjs";
111
+ }
112
+ else {
113
+ // eval("typeof import.meta");
114
+ return "esmodule";
115
+ }
116
+ })();
117
+ if (_MODULE === "commonjs") {
118
+ //@ts-ignore
119
+ import_meta_ponyfill = (r, m) => import_meta_ponyfill_commonjs(r, m);
120
+ }
121
+ else {
122
+ //@ts-ignore
123
+ import_meta_ponyfill = (im) => import_meta_ponyfill_esmodule(im);
124
+ }
125
+ //@ts-ignore
126
+ return import_meta_ponyfill(...args);
127
+ });
@@ -0,0 +1,26 @@
1
+ export declare function fetchChallenge(authUrl: string): Promise<{
2
+ challengeJWT: string;
3
+ challenge: string;
4
+ difficulty: number;
5
+ }>;
6
+ export interface SessionResponse {
7
+ sessionJWT: string;
8
+ apiKey?: string;
9
+ }
10
+ export declare function exchangeSession(authUrl: string, body: {
11
+ challengeJWT: string;
12
+ powHex: string;
13
+ nonce: string;
14
+ apiKey?: string;
15
+ username?: string;
16
+ }): Promise<SessionResponse>;
17
+ export declare function fetchCapability(authUrl: string, sessionJWT: string): Promise<string>;
18
+ export interface PerformPoWInput {
19
+ authUrl: string;
20
+ scryptSalt: string;
21
+ apiKey?: string;
22
+ username?: string;
23
+ onPowProgress?: (nonce: bigint) => void;
24
+ }
25
+ export declare function performPoWAndSession(input: PerformPoWInput): Promise<SessionResponse>;
26
+ //# sourceMappingURL=agent-auth-http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-auth-http.d.ts","sourceRoot":"","sources":["../../../../src/lib/agent/auth/agent-auth-http.ts"],"names":[],"mappings":"AAKA,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7D,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CA8BD;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE;IACJ,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GACA,OAAO,CAAC,eAAe,CAAC,CA8B1B;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAejB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,eAAe,CAAC,CAgB1B"}