@warlock.js/herald 4.0.174 → 4.1.2

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 (236) hide show
  1. package/README.md +36 -33
  2. package/cjs/index.cjs +1355 -0
  3. package/cjs/index.cjs.map +1 -0
  4. package/esm/communicators/broker-registry.d.mts +157 -0
  5. package/esm/communicators/broker-registry.d.mts.map +1 -0
  6. package/esm/communicators/broker-registry.mjs +204 -0
  7. package/esm/communicators/broker-registry.mjs.map +1 -0
  8. package/esm/communicators/broker.d.mts +104 -0
  9. package/esm/communicators/broker.d.mts.map +1 -0
  10. package/esm/communicators/broker.mjs +104 -0
  11. package/esm/communicators/broker.mjs.map +1 -0
  12. package/esm/communicators/index.d.mts +2 -0
  13. package/esm/communicators/index.mjs +4 -0
  14. package/esm/contracts/broker-driver.contract.d.mts +200 -0
  15. package/esm/contracts/broker-driver.contract.d.mts.map +1 -0
  16. package/esm/contracts/channel.contract.d.mts +197 -0
  17. package/esm/contracts/channel.contract.d.mts.map +1 -0
  18. package/esm/contracts/index.d.mts +2 -0
  19. package/esm/decorators/consumable.d.mts +17 -0
  20. package/esm/decorators/consumable.d.mts.map +1 -0
  21. package/esm/decorators/consumable.mjs +36 -0
  22. package/esm/decorators/consumable.mjs.map +1 -0
  23. package/esm/decorators/index.d.mts +1 -0
  24. package/esm/decorators/index.mjs +3 -0
  25. package/esm/drivers/index.d.mts +2 -0
  26. package/esm/drivers/index.mjs +5 -0
  27. package/esm/drivers/rabbitmq/index.d.mts +2 -0
  28. package/esm/drivers/rabbitmq/index.mjs +4 -0
  29. package/esm/drivers/rabbitmq/rabbitmq-channel.d.mts +85 -0
  30. package/esm/drivers/rabbitmq/rabbitmq-channel.d.mts.map +1 -0
  31. package/esm/drivers/rabbitmq/rabbitmq-channel.mjs +352 -0
  32. package/esm/drivers/rabbitmq/rabbitmq-channel.mjs.map +1 -0
  33. package/esm/drivers/rabbitmq/rabbitmq-driver.d.mts +130 -0
  34. package/esm/drivers/rabbitmq/rabbitmq-driver.d.mts.map +1 -0
  35. package/esm/drivers/rabbitmq/rabbitmq-driver.mjs +291 -0
  36. package/esm/drivers/rabbitmq/rabbitmq-driver.mjs.map +1 -0
  37. package/esm/index.d.mts +20 -0
  38. package/esm/index.mjs +16 -0
  39. package/esm/message-managers/event-consumer.d.mts +61 -0
  40. package/esm/message-managers/event-consumer.d.mts.map +1 -0
  41. package/esm/message-managers/event-consumer.mjs +63 -0
  42. package/esm/message-managers/event-consumer.mjs.map +1 -0
  43. package/esm/message-managers/event-message.d.mts +87 -0
  44. package/esm/message-managers/event-message.d.mts.map +1 -0
  45. package/esm/message-managers/event-message.mjs +68 -0
  46. package/esm/message-managers/event-message.mjs.map +1 -0
  47. package/esm/message-managers/index.d.mts +3 -0
  48. package/esm/message-managers/index.mjs +4 -0
  49. package/esm/message-managers/prepare-consumer-subscription.mjs +42 -0
  50. package/esm/message-managers/prepare-consumer-subscription.mjs.map +1 -0
  51. package/esm/message-managers/types.d.mts +23 -0
  52. package/esm/message-managers/types.d.mts.map +1 -0
  53. package/esm/types/channel.types.d.mts +23 -0
  54. package/esm/types/channel.types.d.mts.map +1 -0
  55. package/esm/types/connection.types.d.mts +67 -0
  56. package/esm/types/connection.types.d.mts.map +1 -0
  57. package/esm/types/driver.types.d.mts +13 -0
  58. package/esm/types/driver.types.d.mts.map +1 -0
  59. package/esm/types/index.d.mts +7 -0
  60. package/esm/types/message.types.d.mts +37 -0
  61. package/esm/types/message.types.d.mts.map +1 -0
  62. package/esm/types/publish.types.d.mts +16 -0
  63. package/esm/types/publish.types.d.mts.map +1 -0
  64. package/esm/types/registry.types.d.mts +8 -0
  65. package/esm/types/registry.types.d.mts.map +1 -0
  66. package/esm/types/subscribe.types.d.mts +21 -0
  67. package/esm/types/subscribe.types.d.mts.map +1 -0
  68. package/esm/use-case-broadcast.d.mts +41 -0
  69. package/esm/use-case-broadcast.d.mts.map +1 -0
  70. package/esm/use-case-broadcast.mjs +30 -0
  71. package/esm/use-case-broadcast.mjs.map +1 -0
  72. package/esm/utils/{connect-to-broker.d.ts → connect-to-broker.d.mts} +15 -10
  73. package/esm/utils/connect-to-broker.d.mts.map +1 -0
  74. package/esm/utils/connect-to-broker.mjs +168 -0
  75. package/esm/utils/connect-to-broker.mjs.map +1 -0
  76. package/esm/utils/index.d.mts +1 -0
  77. package/esm/utils/index.mjs +3 -0
  78. package/llms-full.txt +581 -0
  79. package/llms.txt +12 -0
  80. package/package.json +46 -46
  81. package/skills/README.md +21 -0
  82. package/skills/consume-message/SKILL.md +217 -0
  83. package/skills/herald-basics/SKILL.md +96 -0
  84. package/skills/publish-message/SKILL.md +172 -0
  85. package/skills/request-and-respond/SKILL.md +74 -0
  86. package/cjs/communicators/broker-registry.d.ts +0 -155
  87. package/cjs/communicators/broker-registry.d.ts.map +0 -1
  88. package/cjs/communicators/broker-registry.js +0 -206
  89. package/cjs/communicators/broker-registry.js.map +0 -1
  90. package/cjs/communicators/broker.d.ts +0 -100
  91. package/cjs/communicators/broker.d.ts.map +0 -1
  92. package/cjs/communicators/broker.js +0 -105
  93. package/cjs/communicators/broker.js.map +0 -1
  94. package/cjs/communicators/index.d.ts +0 -3
  95. package/cjs/communicators/index.d.ts.map +0 -1
  96. package/cjs/contracts/broker-driver.contract.d.ts +0 -196
  97. package/cjs/contracts/broker-driver.contract.d.ts.map +0 -1
  98. package/cjs/contracts/channel.contract.d.ts +0 -191
  99. package/cjs/contracts/channel.contract.d.ts.map +0 -1
  100. package/cjs/contracts/index.d.ts +0 -3
  101. package/cjs/contracts/index.d.ts.map +0 -1
  102. package/cjs/decorators/consumable.d.ts +0 -13
  103. package/cjs/decorators/consumable.d.ts.map +0 -1
  104. package/cjs/decorators/consumable.js +0 -33
  105. package/cjs/decorators/consumable.js.map +0 -1
  106. package/cjs/decorators/index.d.ts +0 -2
  107. package/cjs/decorators/index.d.ts.map +0 -1
  108. package/cjs/drivers/index.d.ts +0 -2
  109. package/cjs/drivers/index.d.ts.map +0 -1
  110. package/cjs/drivers/rabbitmq/index.d.ts +0 -3
  111. package/cjs/drivers/rabbitmq/index.d.ts.map +0 -1
  112. package/cjs/drivers/rabbitmq/rabbitmq-channel.d.ts +0 -79
  113. package/cjs/drivers/rabbitmq/rabbitmq-channel.d.ts.map +0 -1
  114. package/cjs/drivers/rabbitmq/rabbitmq-channel.js +0 -414
  115. package/cjs/drivers/rabbitmq/rabbitmq-channel.js.map +0 -1
  116. package/cjs/drivers/rabbitmq/rabbitmq-driver.d.ts +0 -124
  117. package/cjs/drivers/rabbitmq/rabbitmq-driver.d.ts.map +0 -1
  118. package/cjs/drivers/rabbitmq/rabbitmq-driver.js +0 -347
  119. package/cjs/drivers/rabbitmq/rabbitmq-driver.js.map +0 -1
  120. package/cjs/index.d.ts +0 -47
  121. package/cjs/index.d.ts.map +0 -1
  122. package/cjs/index.js +0 -1
  123. package/cjs/index.js.map +0 -1
  124. package/cjs/message-managers/event-consumer.d.ts +0 -64
  125. package/cjs/message-managers/event-consumer.d.ts.map +0 -1
  126. package/cjs/message-managers/event-consumer.js +0 -71
  127. package/cjs/message-managers/event-consumer.js.map +0 -1
  128. package/cjs/message-managers/event-message.d.ts +0 -90
  129. package/cjs/message-managers/event-message.d.ts.map +0 -1
  130. package/cjs/message-managers/event-message.js +0 -84
  131. package/cjs/message-managers/event-message.js.map +0 -1
  132. package/cjs/message-managers/index.d.ts +0 -4
  133. package/cjs/message-managers/index.d.ts.map +0 -1
  134. package/cjs/message-managers/prepare-consumer-subscription.d.ts +0 -4
  135. package/cjs/message-managers/prepare-consumer-subscription.d.ts.map +0 -1
  136. package/cjs/message-managers/prepare-consumer-subscription.js +0 -40
  137. package/cjs/message-managers/prepare-consumer-subscription.js.map +0 -1
  138. package/cjs/message-managers/types.d.ts +0 -20
  139. package/cjs/message-managers/types.d.ts.map +0 -1
  140. package/cjs/types/channel.types.d.ts +0 -19
  141. package/cjs/types/channel.types.d.ts.map +0 -1
  142. package/cjs/types/connection.types.d.ts +0 -65
  143. package/cjs/types/connection.types.d.ts.map +0 -1
  144. package/cjs/types/driver.types.d.ts +0 -10
  145. package/cjs/types/driver.types.d.ts.map +0 -1
  146. package/cjs/types/index.d.ts +0 -8
  147. package/cjs/types/index.d.ts.map +0 -1
  148. package/cjs/types/message.types.d.ts +0 -34
  149. package/cjs/types/message.types.d.ts.map +0 -1
  150. package/cjs/types/publish.types.d.ts +0 -13
  151. package/cjs/types/publish.types.d.ts.map +0 -1
  152. package/cjs/types/registry.types.d.ts +0 -4
  153. package/cjs/types/registry.types.d.ts.map +0 -1
  154. package/cjs/types/subscribe.types.d.ts +0 -18
  155. package/cjs/types/subscribe.types.d.ts.map +0 -1
  156. package/cjs/utils/connect-to-broker.d.ts +0 -131
  157. package/cjs/utils/connect-to-broker.d.ts.map +0 -1
  158. package/cjs/utils/connect-to-broker.js +0 -171
  159. package/cjs/utils/connect-to-broker.js.map +0 -1
  160. package/cjs/utils/index.d.ts +0 -2
  161. package/cjs/utils/index.d.ts.map +0 -1
  162. package/esm/communicators/broker-registry.d.ts +0 -155
  163. package/esm/communicators/broker-registry.d.ts.map +0 -1
  164. package/esm/communicators/broker-registry.js +0 -206
  165. package/esm/communicators/broker-registry.js.map +0 -1
  166. package/esm/communicators/broker.d.ts +0 -100
  167. package/esm/communicators/broker.d.ts.map +0 -1
  168. package/esm/communicators/broker.js +0 -105
  169. package/esm/communicators/broker.js.map +0 -1
  170. package/esm/communicators/index.d.ts +0 -3
  171. package/esm/communicators/index.d.ts.map +0 -1
  172. package/esm/contracts/broker-driver.contract.d.ts +0 -196
  173. package/esm/contracts/broker-driver.contract.d.ts.map +0 -1
  174. package/esm/contracts/channel.contract.d.ts +0 -191
  175. package/esm/contracts/channel.contract.d.ts.map +0 -1
  176. package/esm/contracts/index.d.ts +0 -3
  177. package/esm/contracts/index.d.ts.map +0 -1
  178. package/esm/decorators/consumable.d.ts +0 -13
  179. package/esm/decorators/consumable.d.ts.map +0 -1
  180. package/esm/decorators/consumable.js +0 -33
  181. package/esm/decorators/consumable.js.map +0 -1
  182. package/esm/decorators/index.d.ts +0 -2
  183. package/esm/decorators/index.d.ts.map +0 -1
  184. package/esm/drivers/index.d.ts +0 -2
  185. package/esm/drivers/index.d.ts.map +0 -1
  186. package/esm/drivers/rabbitmq/index.d.ts +0 -3
  187. package/esm/drivers/rabbitmq/index.d.ts.map +0 -1
  188. package/esm/drivers/rabbitmq/rabbitmq-channel.d.ts +0 -79
  189. package/esm/drivers/rabbitmq/rabbitmq-channel.d.ts.map +0 -1
  190. package/esm/drivers/rabbitmq/rabbitmq-channel.js +0 -414
  191. package/esm/drivers/rabbitmq/rabbitmq-channel.js.map +0 -1
  192. package/esm/drivers/rabbitmq/rabbitmq-driver.d.ts +0 -124
  193. package/esm/drivers/rabbitmq/rabbitmq-driver.d.ts.map +0 -1
  194. package/esm/drivers/rabbitmq/rabbitmq-driver.js +0 -347
  195. package/esm/drivers/rabbitmq/rabbitmq-driver.js.map +0 -1
  196. package/esm/index.d.ts +0 -47
  197. package/esm/index.d.ts.map +0 -1
  198. package/esm/index.js +0 -1
  199. package/esm/index.js.map +0 -1
  200. package/esm/message-managers/event-consumer.d.ts +0 -64
  201. package/esm/message-managers/event-consumer.d.ts.map +0 -1
  202. package/esm/message-managers/event-consumer.js +0 -71
  203. package/esm/message-managers/event-consumer.js.map +0 -1
  204. package/esm/message-managers/event-message.d.ts +0 -90
  205. package/esm/message-managers/event-message.d.ts.map +0 -1
  206. package/esm/message-managers/event-message.js +0 -84
  207. package/esm/message-managers/event-message.js.map +0 -1
  208. package/esm/message-managers/index.d.ts +0 -4
  209. package/esm/message-managers/index.d.ts.map +0 -1
  210. package/esm/message-managers/prepare-consumer-subscription.d.ts +0 -4
  211. package/esm/message-managers/prepare-consumer-subscription.d.ts.map +0 -1
  212. package/esm/message-managers/prepare-consumer-subscription.js +0 -40
  213. package/esm/message-managers/prepare-consumer-subscription.js.map +0 -1
  214. package/esm/message-managers/types.d.ts +0 -20
  215. package/esm/message-managers/types.d.ts.map +0 -1
  216. package/esm/types/channel.types.d.ts +0 -19
  217. package/esm/types/channel.types.d.ts.map +0 -1
  218. package/esm/types/connection.types.d.ts +0 -65
  219. package/esm/types/connection.types.d.ts.map +0 -1
  220. package/esm/types/driver.types.d.ts +0 -10
  221. package/esm/types/driver.types.d.ts.map +0 -1
  222. package/esm/types/index.d.ts +0 -8
  223. package/esm/types/index.d.ts.map +0 -1
  224. package/esm/types/message.types.d.ts +0 -34
  225. package/esm/types/message.types.d.ts.map +0 -1
  226. package/esm/types/publish.types.d.ts +0 -13
  227. package/esm/types/publish.types.d.ts.map +0 -1
  228. package/esm/types/registry.types.d.ts +0 -4
  229. package/esm/types/registry.types.d.ts.map +0 -1
  230. package/esm/types/subscribe.types.d.ts +0 -18
  231. package/esm/types/subscribe.types.d.ts.map +0 -1
  232. package/esm/utils/connect-to-broker.d.ts.map +0 -1
  233. package/esm/utils/connect-to-broker.js +0 -171
  234. package/esm/utils/connect-to-broker.js.map +0 -1
  235. package/esm/utils/index.d.ts +0 -2
  236. package/esm/utils/index.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
1
  {
2
- "name": "@warlock.js/herald",
3
- "version": "4.0.174",
4
- "description": "Message bus/communicators for RabbitMQ, Kafka, and more",
5
- "main": "./cjs/index.js",
6
- "dependencies": {
7
- "@mongez/copper": "^1.0.1",
8
- "@mongez/events": "^2.1.0",
9
- "@mongez/reinforcements": "^2.3.17",
10
- "@warlock.js/logger": "4.0.174",
11
- "@warlock.js/seal": "4.0.174"
12
- },
13
- "scripts": {
14
- "update": "npx ncu -u",
15
- "fix": "eslint --fix -c ./.eslintrc.json ./src",
16
- "format": "prettier --write ./src/**/*.{js,jsx,ts,tsx,css,md,json} --config ./.prettierrc.json",
17
- "test": "vitest",
18
- "test:coverage": "vitest --coverage",
19
- "test:watch": "vitest --watch"
20
- },
21
- "repository": {
22
- "type": "git",
23
- "url": "https://github.com/warlockjs/herald"
24
- },
25
- "peerDependencies": {
26
- "amqplib": "^0.10.0"
27
- },
28
- "peerDependenciesMeta": {
29
- "amqplib": {
30
- "optional": true
31
- }
32
- },
33
- "keywords": [
34
- "message-bus",
35
- "rabbitmq",
36
- "kafka",
37
- "queue",
38
- "pub-sub",
39
- "communicator",
40
- "amqp",
41
- "message-broker"
42
- ],
43
- "author": "hassanzohdy",
44
- "license": "MIT",
45
- "module": "./esm/index.js",
46
- "typings": "./cjs/index.d.ts"
47
- }
2
+ "name": "@warlock.js/herald",
3
+ "description": "Message bus/brokers for RabbitMQ, Kafka, and more",
4
+ "keywords": [
5
+ "message-bus",
6
+ "rabbitmq",
7
+ "kafka",
8
+ "queue",
9
+ "pub-sub",
10
+ "broker",
11
+ "herald",
12
+ "amqp",
13
+ "message-broker"
14
+ ],
15
+ "author": "hassanzohdy",
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/warlockjs/herald"
20
+ },
21
+ "dependencies": {
22
+ "@mongez/copper": "^2.1.2",
23
+ "@mongez/events": "^2.2.6",
24
+ "@mongez/reinforcements": "^3.2.0",
25
+ "@warlock.js/logger": "4.1.2",
26
+ "@warlock.js/seal": "4.1.2"
27
+ },
28
+ "peerDependencies": {
29
+ "amqplib": "^0.10.0"
30
+ },
31
+ "version": "4.1.2",
32
+ "main": "./cjs/index.cjs",
33
+ "module": "./esm/index.mjs",
34
+ "types": "./esm/index.d.mts",
35
+ "exports": {
36
+ ".": {
37
+ "import": {
38
+ "types": "./esm/index.d.mts",
39
+ "default": "./esm/index.mjs"
40
+ },
41
+ "require": {
42
+ "types": "./esm/index.d.mts",
43
+ "default": "./cjs/index.cjs"
44
+ }
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,21 @@
1
+ # `@warlock.js/herald` — skills index
2
+
3
+ Per-task skills. All cross-references use the form `@warlock.js/<pkg>/<skill>/SKILL.md`.
4
+
5
+ ## Skills
6
+
7
+ ### [`consume-message/`](./consume-message/SKILL.md)
8
+
9
+ Subscribe to a channel via .subscribe(handler, options?) — handler receives (message, ctx). Control flow via ctx.ack / ctx.nack(requeue?) / ctx.reject / ctx.retry(delayMs). Configure prefetch, retry policy, dead-letter, consumer groups. Load when implementing a worker processing events, a queue background processor, or consuming an event log.
10
+
11
+ ### [`herald-basics/`](./herald-basics/SKILL.md)
12
+
13
+ Start with @warlock.js/herald — connectToBroker config, herald() factory, channel concept, multi-broker support. Load when wiring connectToBroker at boot, choosing a herald skill, or wiring multiple brokers (notifications + analytics + events).
14
+
15
+ ### [`publish-message/`](./publish-message/SKILL.md)
16
+
17
+ Publish messages to a channel — .publish(payload, options?) for single, .publishBatch([...], options?) for batch, with priority / ttl / delay / persistent / correlationId / headers options. Optional schema validation via .channel(name, {schema}). Load when emitting an event after a domain change, fanning out a notification, or scheduling delayed work.
18
+
19
+ ### [`request-and-respond/`](./request-and-respond/SKILL.md)
20
+
21
+ Synchronous-style RPC over the message bus — channel.request<R>(payload, {timeout}) waits for a reply, channel.respond(handler) registers the responder, ctx.reply(response) sends the answer. Load when needing a request-response shape across services with loose coupling instead of direct HTTP.
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: consume-message
3
+ description: 'Subscribe to a channel via .subscribe(handler, options?) — handler receives (message, ctx). Control flow via ctx.ack / ctx.nack(requeue?) / ctx.reject / ctx.retry(delayMs). Configure prefetch, retry policy, dead-letter, consumer groups. Triggers: `subscribe`, `ctx.ack`, `ctx.nack`, `ctx.reject`, `ctx.retry`, `prefetch`, `group`, `retry`, `deadLetter`, `@Consumable`, `EventConsumer`, `defineConsumer`, `autoAck`; "consume messages from a queue", "implement a worker", "background queue processor", "set up retry and dead-letter", "class-based event consumer"; typical import `import { herald, Consumable, EventConsumer } from "@warlock.js/herald"`. Skip: setup — `@warlock.js/herald/herald-basics/SKILL.md`; producing — `@warlock.js/herald/publish-message/SKILL.md`; RPC reply — `@warlock.js/herald/request-and-respond/SKILL.md`; competing libs `amqplib`, `bullmq`, `kafkajs`; NestJS `@MessagePattern` / `@EventPattern`.'
4
+ ---
5
+
6
+ # Consume messages
7
+
8
+ Subscribe to a channel; receive each message with a flow-control `ctx`.
9
+
10
+ ## Minimal subscribe
11
+
12
+ ```ts
13
+ import { herald } from "@warlock.js/herald";
14
+
15
+ herald()
16
+ .channel<{ userId: number; email: string }>("user.created")
17
+ .subscribe(async (message, ctx) => {
18
+ try {
19
+ await sendWelcomeEmail(message.payload.email);
20
+ await ctx.ack(); // success — message removed from queue
21
+ } catch (error) {
22
+ await ctx.nack(true); // failure — requeue for redelivery
23
+ }
24
+ });
25
+ ```
26
+
27
+ **Smart auto-ack is on by default** (when `autoAck` is unset or `false`). The consumer runs with manual-ack enabled, and herald acks/nacks based on how your handler ends:
28
+
29
+ - Handler returns without calling any `ctx` method → herald **auto-acks**.
30
+ - Handler **throws** → herald **auto-nacks** (requeue, or DLQ/reject once retries are exhausted — see below).
31
+ - Handler calls `ctx.ack()` / `ctx.nack()` / `ctx.reject()` / `ctx.retry()` → herald respects that and does nothing further.
32
+
33
+ So the `try/catch` above is optional — letting the error throw produces the same auto-nack. Call `ctx` methods explicitly only when you want a *non-default* outcome (reject without requeue, route to DLQ, delayed retry). The one mode that loses messages is `autoAck: true`, where the broker acks on delivery before your handler runs.
34
+
35
+ ## Message context — flow control
36
+
37
+ ```ts
38
+ ctx.ack(); // acknowledge — message removed from the queue
39
+ ctx.nack(requeue?); // negative ack — requeue (true) or send to DLQ (false)
40
+ ctx.reject(); // shorthand for nack(false)
41
+ ctx.retry(delayMs); // delayed retry — requeue after delay
42
+ ctx.reply(payload); // for request-response pattern (see request-and-respond skill)
43
+ ```
44
+
45
+ Pick by intent:
46
+
47
+ | Intent | Use |
48
+ | --- | --- |
49
+ | Processed cleanly | `ctx.ack()` |
50
+ | Transient failure, try again | `ctx.nack(true)` or `ctx.retry(5000)` |
51
+ | Permanent failure, send to DLQ | `ctx.nack(false)` or `ctx.reject()` |
52
+ | Validation failure (bad message) | `ctx.reject()` — don't requeue |
53
+
54
+ ## Subscribe options
55
+
56
+ ```ts
57
+ await channel.subscribe(handler, {
58
+ group: "email-workers", // consumer group / tag — multiple consumers share work
59
+ prefetch: 10, // concurrency — how many in-flight messages this consumer holds
60
+ autoAck: false, // default; keep it false in production
61
+ exclusive: false, // single consumer only on this channel?
62
+ retry: {
63
+ maxRetries: 3, // redelivery ceiling on handler throw (delay not auto-applied — see below)
64
+ delay: 1000,
65
+ },
66
+ deadLetter: {
67
+ channel: "user.created.failed",
68
+ preserveOriginal: true,
69
+ },
70
+ });
71
+ ```
72
+
73
+ `group` is the unit of "share work" — N consumers in the same group split messages across them. Different groups each receive every message (fanout).
74
+
75
+ `prefetch` is the per-consumer concurrency cap. Higher = throughput; lower = even spread. For CPU-bound handlers, set ~= CPU cores. For IO-bound, can go higher (50+).
76
+
77
+ ## Retry policy
78
+
79
+ ```ts
80
+ retry: {
81
+ maxRetries: 3,
82
+ delay: 1000, // see the caveat below — delay is not auto-applied
83
+ }
84
+ ```
85
+
86
+ `maxRetries` is the part that does the work: when a handler **throws**, herald reads the message's `x-retry-count` header and, while it's under `maxRetries`, nacks with requeue so the broker redelivers. Once `x-retry-count` reaches `maxRetries`, it nacks-without-requeue (→ DLQ if configured) or rejects outright.
87
+
88
+ **Caveat on `delay`.** `RetryOptions.delay` (number or `(attempt) => number`) is **not applied on the automatic throw path** — a thrown handler requeues immediately, with no wait. The only place a delay takes effect is the explicit `ctx.retry(delayMs)` call, which republishes the message with an `x-delay` header — and even that needs the RabbitMQ delayed-message-exchange plugin installed, or the delay is ignored. So if you need real backoff, call `ctx.retry(ms)` from inside the handler and install the plugin; don't rely on the channel-level `retry.delay` for timing.
89
+
90
+ ## Dead-letter queue
91
+
92
+ ```ts
93
+ deadLetter: {
94
+ channel: "user.created.failed",
95
+ preserveOriginal: true, // accepted, but currently a no-op (see note)
96
+ }
97
+ ```
98
+
99
+ The DLQ always forwards the full original payload plus the message metadata, so `preserveOriginal` makes no observable difference today — the field is part of the type but the RabbitMQ driver doesn't branch on it yet. Set it or omit it; behaviour is the same.
100
+
101
+ Messages that exhausted retries land in `user.created.failed`. Subscribe to it separately for alerting / manual inspection:
102
+
103
+ ```ts
104
+ herald().channel("user.created.failed").subscribe(async (message, ctx) => {
105
+ await alerts.notify(`Failed: ${JSON.stringify(message.payload)}`);
106
+ await ctx.ack();
107
+ });
108
+ ```
109
+
110
+ ## Decorator-style consumers — `@Consumable` + `EventConsumer`
111
+
112
+ For class-based consumers that pair with the [`EventMessage`](@warlock.js/herald/publish-message/SKILL.md) producer layer. This is a **different handler shape** from the raw `.subscribe()` above — ack/nack is automatic, and you get the unwrapped payload plus an event-metadata object (no `ctx`):
113
+
114
+ ```ts
115
+ import { Consumable, EventConsumer } from "@warlock.js/herald";
116
+ import type { ConsumedEventMessage } from "@warlock.js/herald";
117
+
118
+ @Consumable() // or @Consumable({ broker: "analytics" }) to target a non-default broker
119
+ export class UserCreatedConsumer extends EventConsumer<{ id: number; email: string }> {
120
+ public static eventName = "user.created";
121
+
122
+ // handle(payload, event) — NOT (message, ctx). No ctx.ack() here.
123
+ public async handle(payload: { id: number; email: string }, event: ConsumedEventMessage) {
124
+ await sendWelcomeEmail(payload.email);
125
+ // return cleanly → herald acks. throw → herald nacks (requeue).
126
+ }
127
+ }
128
+ ```
129
+
130
+ The handler receives the **already-unwrapped payload** as the first argument and a `ConsumedEventMessage` as the second — `{ messageId, eventName, payload, version?, occurredAt?, metadata?, message }` (where `message` is the raw `Message` if you need `message.metadata.headers`). There is **no `ctx`**: the framework auto-acks when `handle` resolves and auto-nacks-with-requeue when it throws, so you never call `ack`/`nack` yourself in this style.
131
+
132
+ Wiring: the channel name comes from `static eventName`, and `@Consumable` self-registers the moment the class module is **imported** — if a broker is already connected it subscribes immediately, otherwise it buffers and subscribes once `connectToBroker` fires. So the only wiring you need is to import the consumer file on the boot path (e.g. your module's `main.ts`).
133
+
134
+ **Pair it with the producer:** an `EventConsumer` expects the envelope shape that `publishEvent(new SomeEvent(...))` emits — it reads `envelope.payload`. Don't point one at a channel fed by a bare `channel(name).publish(rawBody)`; the payload nesting won't match.
135
+
136
+ ### Validation + version gating
137
+
138
+ Two optional gates run before `handle`, both driven by fields on the class:
139
+
140
+ ```ts
141
+ import { Consumable, EventConsumer } from "@warlock.js/herald";
142
+ import { v } from "@warlock.js/seal";
143
+
144
+ @Consumable()
145
+ export class UserCreatedConsumer extends EventConsumer {
146
+ public static eventName = "user.created";
147
+
148
+ // Only accept events whose `version` falls in [minVersion, maxVersion].
149
+ // Out-of-range events are acked and skipped (not requeued).
150
+ public static minVersion = 2;
151
+ public static maxVersion = 3;
152
+
153
+ // Seal schema — invalid payloads are nacked before handle() runs.
154
+ public schema = v.object({ id: v.int(), email: v.string().email() });
155
+
156
+ public async handle(payload, event) {
157
+ // payload is validated + version-accepted here
158
+ }
159
+ }
160
+ ```
161
+
162
+ ### `defineConsumer` — no-class shorthand
163
+
164
+ ```ts
165
+ import { defineConsumer } from "@warlock.js/herald";
166
+
167
+ export const userCreatedConsumer = defineConsumer<{ id: number; email: string }>("user.created", {
168
+ schema: userCreatedSchema, // optional seal validation
169
+ handle: async (payload, event) => {
170
+ await sendWelcomeEmail(payload.email);
171
+ },
172
+ });
173
+ ```
174
+
175
+ `defineConsumer` self-registers via `@Consumable` internally, so importing the module is all the wiring it needs — same as the class form. (`subscribeConsumer(SomeConsumerClass)` is the imperative equivalent if you'd rather register explicitly.)
176
+
177
+ ## Subscription handle
178
+
179
+ `subscribe()` resolves to a `Subscription` you can manage:
180
+
181
+ ```ts
182
+ const subscription = await channel.subscribe(handler);
183
+
184
+ subscription.id; // the consumer id (string)
185
+ subscription.isActive(); // boolean
186
+
187
+ await subscription.unsubscribe(); // cancel the consumer on the broker
188
+ await subscription.pause(); // also cancels the consumer (RabbitMQ has no native pause)
189
+ ```
190
+
191
+ On the RabbitMQ driver, `pause()` and `unsubscribe()` both cancel the consumer; `resume()` is **not supported and throws** — create a fresh subscription to start consuming again. You can also cancel by id from the channel: `await channel.unsubscribeById(consumerId)`, or drop every consumer on the channel with `await channel.stopConsuming()`.
192
+
193
+ ## Channel admin
194
+
195
+ The channel exposes queue-management helpers beyond pub/sub:
196
+
197
+ ```ts
198
+ const { messageCount, consumerCount } = await channel.stats(); // queue depth + live consumers
199
+ const purged = await channel.purge(); // drop all pending messages, returns the count
200
+ const ok = await channel.exists(); // does the queue exist on the broker?
201
+ await channel.assert(); // create the queue with its options (idempotent)
202
+ await channel.delete(); // remove the queue entirely
203
+ ```
204
+
205
+ `assert()` runs lazily on the first `publish` / `subscribe`, so you rarely call it directly — reach for it only to pre-create a queue before any traffic.
206
+
207
+ ## Things NOT to do
208
+
209
+ - Don't catch the handler's error and return normally. Smart auto-ack reads a clean return as success and **acks** — silently dropping the work. Let it throw (auto-nack) or call `ctx.reject()` / `ctx.nack(false)` deliberately.
210
+ - Don't `ctx.nack(true)` in an infinite loop. With no `retry` policy, a perpetually-failing message ping-pongs forever. Set `retry.maxRetries` + a `deadLetter` so failures eventually move out.
211
+ - Don't ignore the `deadLetter` channel. Subscribe to it (or at least monitor its depth) — DLQ growth means real failures piling up.
212
+ - Don't use `autoAck: true` for messages that matter. The broker acks on delivery, so a crash mid-handling loses the message.
213
+
214
+ ## See also
215
+
216
+ - [`@warlock.js/herald/publish-message/SKILL.md`](@warlock.js/herald/publish-message/SKILL.md) — the producing side
217
+ - [`@warlock.js/herald/request-and-respond/SKILL.md`](@warlock.js/herald/request-and-respond/SKILL.md) — when you need to reply to a message
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: herald-basics
3
+ description: 'Start with @warlock.js/herald — connectToBroker config, herald() factory, channel concept, multi-broker support. Triggers: `connectToBroker`, `herald`, `channel`, `isDefault`, `autoAck`; "set up herald", "wire connectToBroker at boot", "configure multiple brokers", "notifications + analytics + events"; typical import `import { connectToBroker, herald } from "@warlock.js/herald"`. Skip: publishing — `@warlock.js/herald/publish-message/SKILL.md`; consuming — `@warlock.js/herald/consume-message/SKILL.md`; RPC — `@warlock.js/herald/request-and-respond/SKILL.md`; competing libs `amqplib`, `kafkajs`, `bullmq`, `nats`; NestJS messaging; native `EventEmitter`.'
4
+ ---
5
+
6
+ # Herald basics
7
+
8
+ Message bus library — wraps RabbitMQ (Kafka WIP) behind a unified pub/sub API. `herald()` returns a broker, `.channel(name)` returns a pub/sub interface, type-safe via TypeScript generics.
9
+
10
+ > This skill is the herald **map** — read it first, then load the specific skill for the task.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ yarn add @warlock.js/herald amqplib # amqplib for RabbitMQ
16
+ ```
17
+
18
+ ## Foundations
19
+
20
+ 1. **`connectToBroker(config)` is the bootstrap.** Call once per broker at app startup, before any publish/subscribe.
21
+ 2. **`herald()` returns the default broker.** `herald("name")` returns a named one. Most apps have one broker; multi-broker is for "notifications + analytics + events" scale.
22
+ 3. **`.channel(name)` is the queue / topic.** Publish into it from producer, subscribe to it from consumer.
23
+ 4. **Channels are typed.** `channel<UserPayload>("user.created")` gives full TS inference on publish and subscribe.
24
+ 5. **`@warlock.js/seal` schemas validate on publish + receive.** Pass `{ schema }` to `.channel(name, { schema })`.
25
+ 6. **Subscribers control message flow** via `ctx.ack()` / `ctx.nack()` / `ctx.reject()` / `ctx.retry(ms)`.
26
+ 7. **Smart auto-ack is the default** (`autoAck` unset/`false`). The consumer runs with manual-ack enabled, but herald acks for you when the handler returns cleanly and nacks-with-requeue when it throws — so a crash mid-handling re-delivers, and a clean handler that forgot `ctx.ack()` is still acked. Call `ctx` methods explicitly only when you need a non-default outcome (reject, DLQ, delayed retry). `autoAck: true` is the dangerous mode: the broker acks on delivery, so a crash loses the message.
27
+
28
+ ## Minimal example
29
+
30
+ ```ts
31
+ import { connectToBroker, herald } from "@warlock.js/herald";
32
+
33
+ // Boot
34
+ await connectToBroker({
35
+ driver: "rabbitmq",
36
+ host: "localhost",
37
+ port: 5672,
38
+ username: "guest",
39
+ password: "guest",
40
+ });
41
+
42
+ // Produce
43
+ await herald().channel("user.created").publish({ userId: 1, email: "ada@example.com" });
44
+
45
+ // Consume
46
+ herald()
47
+ .channel<{ userId: number; email: string }>("user.created")
48
+ .subscribe(async (message, ctx) => {
49
+ console.log("New user:", message.payload.userId);
50
+ await ctx.ack();
51
+ });
52
+ ```
53
+
54
+ ## Multi-broker
55
+
56
+ ```ts
57
+ await connectToBroker({
58
+ driver: "rabbitmq",
59
+ name: "notifications",
60
+ isDefault: true,
61
+ host: process.env.NOTIFICATIONS_HOST,
62
+ });
63
+
64
+ await connectToBroker({
65
+ driver: "rabbitmq",
66
+ name: "analytics",
67
+ isDefault: false, // ← required: `isDefault` defaults to true, so omitting it makes analytics the default
68
+ host: process.env.ANALYTICS_HOST,
69
+ });
70
+
71
+ herald().channel("emails").publish({ /* ... */ }); // → notifications
72
+ herald("analytics").channel("events").publish({ /* ... */ }); // → analytics
73
+ ```
74
+
75
+ `connectToBroker` defaults `isDefault` to `true`, and the registry promotes the most-recently-registered default. So when you register more than one broker, mark the secondaries `isDefault: false` — otherwise the last one wins and `herald()` returns the wrong broker.
76
+
77
+ ## Pick a skill
78
+
79
+ | If the task is about… | Load |
80
+ | --- | --- |
81
+ | Publishing messages — single + batch + publish options (priority, ttl, delay, persistent, headers) | [`@warlock.js/herald/publish-message/SKILL.md`](@warlock.js/herald/publish-message/SKILL.md) |
82
+ | Subscribing to messages — handler signature, message context (ack/nack/retry), prefetch, retry policy, dead-letter | [`@warlock.js/herald/consume-message/SKILL.md`](@warlock.js/herald/consume-message/SKILL.md) |
83
+ | Request/response (RPC) — `channel.request(...)` + `channel.respond(...)` for synchronous-style calls over a message bus | [`@warlock.js/herald/request-and-respond/SKILL.md`](@warlock.js/herald/request-and-respond/SKILL.md) |
84
+ | Schema-validated channels — `.channel(name, { schema })` with `@warlock.js/seal` | See [`@warlock.js/seal/seal-basics/SKILL.md`](@warlock.js/seal/seal-basics/SKILL.md) + skills below |
85
+
86
+ ## Things NOT to do
87
+
88
+ - Don't `connectToBroker` from inside a request handler. Call once at boot.
89
+ - Don't catch a handler error and swallow it — under smart auto-ack a thrown handler auto-nacks (re-delivers), but a caught-and-ignored error looks like success and gets auto-acked, silently dropping the work. Either let it throw or call `ctx.reject()` / `ctx.nack(false)` deliberately.
90
+ - Don't use `autoAck: true` in production. The default smart auto-ack re-delivers on a mid-handling crash; `autoAck: true` acks on delivery, so a crash loses the message.
91
+ - Don't share a typed channel across producer and consumer code without a shared type / schema file. Drift between sides causes silent payload corruption.
92
+
93
+ ## See also
94
+
95
+ - README at `@warlock.js/herald/README.md` for the full API surface and RabbitMQ / Kafka driver config
96
+ - [`@warlock.js/seal/seal-basics/SKILL.md`](@warlock.js/seal/seal-basics/SKILL.md) — schema validation
@@ -0,0 +1,172 @@
1
+ ---
2
+ name: publish-message
3
+ description: 'Publish messages to a channel — .publish(payload, options?) for single, .publishBatch([...], options?) for batch, with priority / ttl / delay / persistent / correlationId / headers options. Optional schema validation via .channel(name, {schema}). Triggers: `publish`, `publishBatch`, `channel`, `priority`, `ttl`, `delay`, `persistent`, `correlationId`, `headers`, `schema`; "publish a message", "emit an event after a domain change", "fan out a notification", "schedule delayed work", "batch publish"; typical import `import { herald } from "@warlock.js/herald"`. Skip: setup — `@warlock.js/herald/herald-basics/SKILL.md`; consuming — `@warlock.js/herald/consume-message/SKILL.md`; RPC — `@warlock.js/herald/request-and-respond/SKILL.md`; competing libs `amqplib`, `kafkajs`, `bullmq`; NestJS `ClientProxy.emit`.'
4
+ ---
5
+
6
+ # Publish messages
7
+
8
+ Push messages into a channel. The consumer side picks them up via [`@warlock.js/herald/consume-message/SKILL.md`](@warlock.js/herald/consume-message/SKILL.md).
9
+
10
+ ## Single publish
11
+
12
+ ```ts
13
+ import { herald } from "@warlock.js/herald";
14
+
15
+ await herald().channel("user.created").publish({
16
+ userId: 1,
17
+ email: "ada@example.com",
18
+ });
19
+ ```
20
+
21
+ Returns when the broker has accepted the message (not when a consumer has handled it — that's `.request()` territory).
22
+
23
+ ## Typed channels
24
+
25
+ ```ts
26
+ type UserPayload = { userId: number; email: string };
27
+
28
+ const channel = herald().channel<UserPayload>("user.created");
29
+
30
+ await channel.publish({ userId: 1, email: "test@example.com" }); // ✅ typed
31
+ await channel.publish({ userId: "1" } as never); // ❌ compile error
32
+ ```
33
+
34
+ Share the payload type between producer and consumer via a common `types/` file.
35
+
36
+ ## Schema-validated publish
37
+
38
+ ```ts
39
+ import { v } from "@warlock.js/seal";
40
+
41
+ const userSchema = v.object({
42
+ userId: v.int(),
43
+ email: v.string().email(),
44
+ });
45
+
46
+ const channel = herald().channel("user.created", { schema: userSchema });
47
+
48
+ await channel.publish({ userId: 1, email: "invalid" }); // Throws — fails .email()
49
+ ```
50
+
51
+ The schema runs `validate()` before the message hits the broker. Invalid payloads never leave the producer. See [`@warlock.js/seal/seal-basics/SKILL.md`](@warlock.js/seal/seal-basics/SKILL.md).
52
+
53
+ ## Publish options
54
+
55
+ ```ts
56
+ await channel.publish(payload, {
57
+ priority: 5, // 0-9, higher = served first
58
+ expiration: 60_000, // ms — message expires if not consumed (RabbitMQ uses `expiration`, not `ttl`)
59
+ delay: 5_000, // ms — delayed delivery (requires RabbitMQ delay plugin)
60
+ persistent: true, // survive broker restart (default true)
61
+ correlationId: "uuid", // for tracking across services
62
+ headers: {
63
+ tenantId: "42",
64
+ source: "billing-service",
65
+ },
66
+ });
67
+ ```
68
+
69
+ The headers field is free-form — consumers read `message.metadata.headers?.tenantId` to route or filter (headers live under `message.metadata`, alongside `messageId`, `correlationId`, `timestamp`, and `retryCount`).
70
+
71
+ ## Batch publishing
72
+
73
+ ```ts
74
+ await channel.publishBatch([
75
+ { userId: 1, email: "a@example.com" },
76
+ { userId: 2, email: "b@example.com" },
77
+ { userId: 3, email: "c@example.com" },
78
+ ], {
79
+ // Options apply to every message in the batch
80
+ persistent: true,
81
+ });
82
+ ```
83
+
84
+ Under the hood `publishBatch` iterates and calls `.publish()` per message — there's no AMQP-level batching today. It's an ergonomic shape for "emit these N items" (bulk import, fanout to many recipients), not a throughput optimization. The same `options` apply to every message.
85
+
86
+ ## Publish + transaction (outbox pattern)
87
+
88
+ Don't publish inside a database transaction — if the transaction rolls back but the publish already happened, you've emitted an event for a state that never persisted.
89
+
90
+ The outbox pattern: write to an `outbox` table inside the transaction, dispatch from the outbox via a worker after commit:
91
+
92
+ ```ts
93
+ await transaction(async () => {
94
+ await Order.create(orderData);
95
+ await Outbox.create({
96
+ channel: "order.created",
97
+ payload: { orderId: order.id, ... },
98
+ status: "pending",
99
+ });
100
+ });
101
+
102
+ // In a separate worker:
103
+ const pending = await Outbox.where("status", "pending").get();
104
+ for (const row of pending) {
105
+ await herald().channel(row.get("channel")).publish(row.get("payload"));
106
+ await row.merge({ status: "sent", sent_at: new Date() }).save();
107
+ }
108
+ ```
109
+
110
+ Full recipe at `domains/cascade/docs/recipes/outbox-pattern.md`.
111
+
112
+ ## Broadcasting use-case results
113
+
114
+ `@warlock.js/herald` ships `heraldBroadcast()` — a channel adapter that lets a `@warlock.js/core` `useCase()` publish its result to the bus automatically on success. Register it once in the use-cases config; each use case opts in with `broadcast: true`.
115
+
116
+ ```ts title="src/config/use-cases.ts"
117
+ import { type UseCaseConfigurations } from "@warlock.js/core";
118
+ import { heraldBroadcast } from "@warlock.js/herald";
119
+
120
+ export default {
121
+ broadcast: {
122
+ enabled: true,
123
+ channels: [heraldBroadcast({ broker: "default" })], // omit broker for the default
124
+ },
125
+ } satisfies UseCaseConfigurations;
126
+ ```
127
+
128
+ ```ts
129
+ // The use case opts in — channel name defaults to the use case name.
130
+ export const createUserUseCase = useCase({
131
+ name: "users.create", // → publishes to channel "users.create"
132
+ schema: createUserSchema,
133
+ handler: async (data) => User.create(data),
134
+ broadcast: true,
135
+ });
136
+ ```
137
+
138
+ The adapter publishes the broadcast envelope's `payload` to `channel(event.event)`. It's structurally typed, so herald keeps no dependency on core. See [`@warlock.js/core/write-use-case/SKILL.md`](@warlock.js/core/write-use-case/SKILL.md) for the `broadcast` option (payload projection, custom event name, payload-safety rules).
139
+
140
+ ## Event classes (`EventMessage`) — the typed event layer
141
+
142
+ Raw `channel(name).publish(payload)` is the low-level path. For domain events that travel between modules, herald ships a higher-level pair: define the event once as a class, publish instances of it, and consume them with an [`EventConsumer`](@warlock.js/herald/consume-message/SKILL.md). The channel name comes from the event's `eventName` — no string to keep in sync across producer and consumer.
143
+
144
+ ```ts
145
+ import { defineEvent, publishEvent } from "@warlock.js/herald";
146
+
147
+ // `defineEvent<IncomingData, OutgoingData>` — `toJSON` projects the wire payload.
148
+ const UserCreatedEvent = defineEvent<User, { id: number; email: string }>("user.created", {
149
+ toJSON: (user) => ({ id: user.id, email: user.email }),
150
+ // schema?: an @warlock.js/seal ObjectValidator (held on the instance; the consumer side validates)
151
+ });
152
+
153
+ // `publishEvent` serializes the instance and publishes to channel "user.created" on the default broker.
154
+ await publishEvent(new UserCreatedEvent(user));
155
+ ```
156
+
157
+ `publishEvent(event)` is shorthand for `herald().publish(event)` — it calls `event.serialize()` and sends an **envelope**: `{ payload, metadata, messageId, eventName, version, occurredAt }`. That nesting is why an `EventConsumer` reads `envelope.payload`, not the raw body — pair this only with the consumer side, not a bare `.subscribe()`.
158
+
159
+ Set an optional `version` on the event (instance field) to drive the consumer's `minVersion` / `maxVersion` acceptance gate. The class form (`class X extends EventMessage`) is equivalent — override `toJSON()` and set `eventName`, `version`, `schema` as fields.
160
+
161
+ ## Things NOT to do
162
+
163
+ - Don't publish inside a transaction. Use the outbox pattern.
164
+ - Don't pass non-JSON-serializable values (functions, `BigInt`, class instances with methods). Serialization happens at the broker boundary; functions go silent, BigInt throws.
165
+ - Don't `expiration: 0` — set a real expiry or omit. `0` means "expire immediately."
166
+ - Don't omit `persistent: true` for messages where loss matters. Default is `true` in this lib, but worth being explicit when the message represents money / customer state.
167
+ - Don't put secrets in headers. Headers travel in plaintext (encrypted only by TLS in transit, not at rest in the broker).
168
+
169
+ ## See also
170
+
171
+ - [`@warlock.js/herald/consume-message/SKILL.md`](@warlock.js/herald/consume-message/SKILL.md) — the receiving side
172
+ - [`@warlock.js/herald/request-and-respond/SKILL.md`](@warlock.js/herald/request-and-respond/SKILL.md) — when you need a reply