@clipboard-health/ai-rules 1.6.12 → 1.6.13

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/backend/AGENTS.md CHANGED
@@ -48,8 +48,17 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
48
48
  import { TRIGGER_NOTIFICATION_JOB_NAME } from "./triggerNotification.constants";
49
49
 
50
50
  /**
51
- * For mongo-jobs, implement `HandlerInterface<SerializableTriggerChunkedRequest>`.
52
- * For background-jobs-postgres, implement `Handler<SerializableTriggerChunkedRequest>`.
51
+ * For @clipboard-health/mongo-jobs:
52
+ * 1. Implement `HandlerInterface<SerializableTriggerChunkedRequest>`.
53
+ * 2. The 10 default `maxAttempts` with exponential backoff of `2^attemptsCount` means ~17 minutes
54
+ * of cumulative delay. If your notification could be stale before this, set
55
+ * `SerializableTriggerChunkedRequest.expiresAt` when enqueueing.
56
+ *
57
+ * For @clipboard-health/background-jobs-postgres:
58
+ * 1. Implement `Handler<SerializableTriggerChunkedRequest>`.
59
+ * 2. The 20 default `maxRetryAttempts` with exponential backoff of `10s * 2^(attempt - 1)` means
60
+ * ~121 days of cumulative delay. If your notification could be stale before this, set
61
+ * `maxRetryAttempts` (and `SerializableTriggerChunkedRequest.expiresAt`) when enqueueing.
53
62
  */
54
63
  export class TriggerNotificationJob implements BaseHandler<SerializableTriggerChunkedRequest> {
55
64
  public name = TRIGGER_NOTIFICATION_JOB_NAME;
@@ -64,13 +73,16 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
64
73
  public async perform(
65
74
  data: SerializableTriggerChunkedRequest,
66
75
  /**
67
- * For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has _id, attemptsCount, and uniqueKey.
68
- * For background-jobs-postgres, implement `Job<SerializableTriggerChunkedRequest>`, which has id, retryAttempts, and idempotencyKey.
76
+ * For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has
77
+ * `_id`, `attemptsCount`, and `uniqueKey`.
78
+ *
79
+ * For background-jobs-postgres, implement `Job<SerializableTriggerChunkedRequest>`, which has
80
+ * `id`, `retryAttempts`, and `idempotencyKey`.
69
81
  */
70
82
  job: { _id: string; attemptsCount: number; uniqueKey?: string },
71
83
  ) {
72
84
  const metadata = {
73
- // Include the job's attempts count for debugging, this is called `retryAttempts` in `background-jobs-postgres`.
85
+ // For background-jobs-postgres, this is called `retryAttempts`.
74
86
  attempt: job.attemptsCount + 1,
75
87
  jobId: job._id,
76
88
  recipientCount: data.body.recipients.length,
@@ -48,8 +48,17 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
48
48
  import { TRIGGER_NOTIFICATION_JOB_NAME } from "./triggerNotification.constants";
49
49
 
50
50
  /**
51
- * For mongo-jobs, implement `HandlerInterface<SerializableTriggerChunkedRequest>`.
52
- * For background-jobs-postgres, implement `Handler<SerializableTriggerChunkedRequest>`.
51
+ * For @clipboard-health/mongo-jobs:
52
+ * 1. Implement `HandlerInterface<SerializableTriggerChunkedRequest>`.
53
+ * 2. The 10 default `maxAttempts` with exponential backoff of `2^attemptsCount` means ~17 minutes
54
+ * of cumulative delay. If your notification could be stale before this, set
55
+ * `SerializableTriggerChunkedRequest.expiresAt` when enqueueing.
56
+ *
57
+ * For @clipboard-health/background-jobs-postgres:
58
+ * 1. Implement `Handler<SerializableTriggerChunkedRequest>`.
59
+ * 2. The 20 default `maxRetryAttempts` with exponential backoff of `10s * 2^(attempt - 1)` means
60
+ * ~121 days of cumulative delay. If your notification could be stale before this, set
61
+ * `maxRetryAttempts` (and `SerializableTriggerChunkedRequest.expiresAt`) when enqueueing.
53
62
  */
54
63
  export class TriggerNotificationJob implements BaseHandler<SerializableTriggerChunkedRequest> {
55
64
  public name = TRIGGER_NOTIFICATION_JOB_NAME;
@@ -64,13 +73,16 @@ Send notifications through [Knock](https://docs.knock.app) using the `@clipboard
64
73
  public async perform(
65
74
  data: SerializableTriggerChunkedRequest,
66
75
  /**
67
- * For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has _id, attemptsCount, and uniqueKey.
68
- * For background-jobs-postgres, implement `Job<SerializableTriggerChunkedRequest>`, which has id, retryAttempts, and idempotencyKey.
76
+ * For mongo-jobs, implement `BackgroundJobType<SerializableTriggerChunkedRequest>`, which has
77
+ * `_id`, `attemptsCount`, and `uniqueKey`.
78
+ *
79
+ * For background-jobs-postgres, implement `Job<SerializableTriggerChunkedRequest>`, which has
80
+ * `id`, `retryAttempts`, and `idempotencyKey`.
69
81
  */
70
82
  job: { _id: string; attemptsCount: number; uniqueKey?: string },
71
83
  ) {
72
84
  const metadata = {
73
- // Include the job's attempts count for debugging, this is called `retryAttempts` in `background-jobs-postgres`.
85
+ // For background-jobs-postgres, this is called `retryAttempts`.
74
86
  attempt: job.attemptsCount + 1,
75
87
  jobId: job._id,
76
88
  recipientCount: data.body.recipients.length,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@clipboard-health/ai-rules",
3
3
  "description": "Pre-built AI agent rules for consistent coding standards.",
4
- "version": "1.6.12",
4
+ "version": "1.6.13",
5
5
  "bugs": "https://github.com/ClipboardHealth/core-utils/issues",
6
6
  "devDependencies": {
7
7
  "@intellectronica/ruler": "0.3.21"