watchfor 0.17.2 → 0.18.0

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
@@ -48,6 +48,11 @@ await wf.monitors.reset(monitor.id!);
48
48
  // Page integrity: after a deploy, check the pages and accept what that check saw.
49
49
  await wf.monitors.acceptBaseline(integrityMonitorId, { fresh: true });
50
50
 
51
+ // MCP servers: before a release, keep tool drift quiet for 30 minutes (downtime still pages);
52
+ // a drift incident the user confirms was theirs is accepted as an expected change.
53
+ await wf.monitors.setExpectedChangeWindow(mcpMonitorId, { window: 30, note: "v2.4 release" });
54
+ await wf.incidents.acceptExpectedChange(19352, { note: "New search tool shipped in v2.4" });
55
+
51
56
  // Browser checks: try a Playwright script once (nothing saved), then read the result.
52
57
  const { id } = await wf.playwright.testRun({ script, target: "https://shop.example.com" });
53
58
  const run = await wf.playwright.getTestRun(id); // status: queued | running | done | error
@@ -206,5 +211,5 @@ WATCHFOR_ORGANIZATION=<organization-id> npx watchfor summary
206
211
  ## Links
207
212
 
208
213
  - API docs: https://watchfor.io/docs/api
209
- - MCP server for AI agents (61 tools): https://watchfor.io/docs/api/mcp
214
+ - MCP server for AI agents (63 tools): https://watchfor.io/docs/api/mcp
210
215
  - Create an API key: dashboard → Settings → API keys (`read` or `read+write` scope)
package/dist/client.d.ts CHANGED
@@ -28,6 +28,12 @@ export type IntegrityBaseline = components["schemas"]["IntegrityBaseline"];
28
28
  export type IntegrityBaselineAccept = components["schemas"]["IntegrityBaselineAccept"];
29
29
  /** A fresh accept whose check has not landed yet (HTTP 202). */
30
30
  export type IntegrityBaselineAcceptPending = components["schemas"]["IntegrityBaselineAcceptPending"];
31
+ /** `monitors.setExpectedChangeWindow()` — a release marker on an MCP
32
+ * monitor: drift does not page until `ends_at`. */
33
+ export type ExpectedChangeWindow = components["schemas"]["ExpectedChangeWindow"];
34
+ /** `incidents.acceptExpectedChange()` — a drift incident recorded as an
35
+ * intended change. */
36
+ export type ExpectedChangeAccept = components["schemas"]["ExpectedChangeAccept"];
31
37
  export type PlaywrightTestRunAccepted = components["schemas"]["PlaywrightTestRunAccepted"];
32
38
  export type PlaywrightTestRun = components["schemas"]["PlaywrightTestRun"];
33
39
  export type PlaywrightRun = components["schemas"]["PlaywrightRun"];
@@ -317,6 +323,18 @@ export declare class WatchFor {
317
323
  pages?: string[];
318
324
  fresh?: boolean;
319
325
  }, idempotencyKey?: string) => Promise<IntegrityBaselineAccept | IntegrityBaselineAcceptPending>;
326
+ /** MCP monitors: release marker — call it from a deploy pipeline
327
+ * before the rollout. For `window` minutes (1–60, default 15) the
328
+ * monitor's drift rules (Tool Inventory Changed) are silenced — only
329
+ * those, downtime still pages — and drift incidents opened inside
330
+ * the window resolve within a minute. Markers stack; 12 per hour per
331
+ * monitor (429). Page integrity monitors → 400 (use
332
+ * `acceptBaseline(id, { fresh: true })` after the deploy); no enabled
333
+ * drift rule → 409. */
334
+ setExpectedChangeWindow: (id: string, opts?: {
335
+ window?: number;
336
+ note?: string;
337
+ }, idempotencyKey?: string) => Promise<ExpectedChangeWindow>;
320
338
  /** Browser checks: runs, newest first (`status` failed | flaky). */
321
339
  runs: (id: string, params?: {
322
340
  status?: "all" | "failed" | "flaky";
@@ -417,6 +435,16 @@ export declare class WatchFor {
417
435
  * it (marking again returns the same one); delete that window to
418
436
  * undo. */
419
437
  markMaintenance: (id: number, idempotencyKey?: string) => Promise<MaintenanceMarking>;
438
+ /** Drift incidents only (an MCP monitor's Tool Inventory Changed;
439
+ * others → 400): mark the change as intended. An open incident is
440
+ * resolved asynchronously (`resolve_requested`; poll `get()`), and
441
+ * the accept is recorded on the incident and drift timelines and in
442
+ * the Activity log. Accepting again returns the first accept with
443
+ * `already_accepted: true`. `note` (≤ 500 chars) says why. Only call
444
+ * it when the user confirms the change was theirs. */
445
+ acceptExpectedChange: (id: number, body?: {
446
+ note?: string;
447
+ }, idempotencyKey?: string) => Promise<ExpectedChangeAccept>;
420
448
  /** The incident's post-mortem. 404 when it has none yet —
421
449
  * `updatePostmortem` creates it. */
422
450
  getPostmortem: (id: number) => Promise<Postmortem>;
package/dist/client.js CHANGED
@@ -268,6 +268,19 @@ export class WatchFor {
268
268
  body: body ?? {},
269
269
  idempotencyKey,
270
270
  }),
271
+ /** MCP monitors: release marker — call it from a deploy pipeline
272
+ * before the rollout. For `window` minutes (1–60, default 15) the
273
+ * monitor's drift rules (Tool Inventory Changed) are silenced — only
274
+ * those, downtime still pages — and drift incidents opened inside
275
+ * the window resolve within a minute. Markers stack; 12 per hour per
276
+ * monitor (429). Page integrity monitors → 400 (use
277
+ * `acceptBaseline(id, { fresh: true })` after the deploy); no enabled
278
+ * drift rule → 409. */
279
+ setExpectedChangeWindow: (id, opts = {}, idempotencyKey) => this.request("POST", `/monitors/${id}/expected-change`, {
280
+ query: { window: opts.window },
281
+ body: opts.note === undefined ? {} : { note: opts.note },
282
+ idempotencyKey,
283
+ }),
271
284
  /** Browser checks: runs, newest first (`status` failed | flaky). */
272
285
  runs: (id, params = {}) => this.request("GET", `/monitors/${id}/runs`, { query: params }),
273
286
  /** Browser checks: one run — steps, errors, Web Vitals, screenshot
@@ -343,6 +356,17 @@ export class WatchFor {
343
356
  markMaintenance: (id, idempotencyKey) => this.request("POST", `/incidents/${id}/mark-maintenance`, {
344
357
  idempotencyKey,
345
358
  }),
359
+ /** Drift incidents only (an MCP monitor's Tool Inventory Changed;
360
+ * others → 400): mark the change as intended. An open incident is
361
+ * resolved asynchronously (`resolve_requested`; poll `get()`), and
362
+ * the accept is recorded on the incident and drift timelines and in
363
+ * the Activity log. Accepting again returns the first accept with
364
+ * `already_accepted: true`. `note` (≤ 500 chars) says why. Only call
365
+ * it when the user confirms the change was theirs. */
366
+ acceptExpectedChange: (id, body, idempotencyKey) => this.request("POST", `/incidents/${id}/expected-change`, {
367
+ body: body ?? {},
368
+ idempotencyKey,
369
+ }),
346
370
  /** The incident's post-mortem. 404 when it has none yet —
347
371
  * `updatePostmortem` creates it. */
348
372
  getPostmortem: (id) => this.request("GET", `/incidents/${id}/postmortem`),
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { type ActivityEvent, type AlertingState, type AlertRule, type Announcement, type AnnouncementCreate, type AnnouncementUpdate, type ApiErrorBody, type BatchOperation, type BatchResult, type BulkResult, type Check, type CheckList, type CheckNowAck, type Contact, type ContactGroup, type Deleted, type DiagnosticCatalog, type DiagnosticCatalogEntry, type DiagnosticReport, type DiagnosticRun, type DiagnosticSlug, type Incident, type IncidentStats, type IntegrityBaseline, type IntegrityBaselineAccept, type IntegrityBaselineAcceptPending, type List, type MaintenanceMarking, type MaintenanceWindow, type Me, type Monitor, type MonitorDetail, type MonitorReset, type Notification, ORGANIZATION_HEADER, type Organization, type Plan, type PlaywrightRun, type PlaywrightRunSummary, type PlaywrightTestRun, type PlaywrightTestRunAccepted, type PlaywrightTestRunRequest, type Postmortem, type PostmortemUpdate, type ReportFilters, type ResponseTimeBucket, type ScriptVersion, type ScriptVersionSummary, type StatusPage, type StatusPageComponentCreate, type StatusPageCreate, type StatusPageUpdate, type Summary, type Uptime, type Variable, type VariableDeleted, WatchFor, WatchForError, type WatchForGrade, type WatchForOptions, } from "./client.js";
1
+ export { type ActivityEvent, type AlertingState, type AlertRule, type Announcement, type AnnouncementCreate, type AnnouncementUpdate, type ApiErrorBody, type BatchOperation, type BatchResult, type BulkResult, type Check, type CheckList, type CheckNowAck, type Contact, type ContactGroup, type Deleted, type DiagnosticCatalog, type DiagnosticCatalogEntry, type DiagnosticReport, type DiagnosticRun, type DiagnosticSlug, type ExpectedChangeAccept, type ExpectedChangeWindow, type Incident, type IncidentStats, type IntegrityBaseline, type IntegrityBaselineAccept, type IntegrityBaselineAcceptPending, type List, type MaintenanceMarking, type MaintenanceWindow, type Me, type Monitor, type MonitorDetail, type MonitorReset, type Notification, ORGANIZATION_HEADER, type Organization, type Plan, type PlaywrightRun, type PlaywrightRunSummary, type PlaywrightTestRun, type PlaywrightTestRunAccepted, type PlaywrightTestRunRequest, type Postmortem, type PostmortemUpdate, type ReportFilters, type ResponseTimeBucket, type ScriptVersion, type ScriptVersionSummary, type StatusPage, type StatusPageComponentCreate, type StatusPageCreate, type StatusPageUpdate, type Summary, type Uptime, type Variable, type VariableDeleted, WatchFor, WatchForError, type WatchForGrade, type WatchForOptions, } from "./client.js";
package/dist/schema.d.ts CHANGED
@@ -455,6 +455,26 @@ export interface paths {
455
455
  patch?: never;
456
456
  trace?: never;
457
457
  };
458
+ "/monitors/{id}/expected-change": {
459
+ parameters: {
460
+ query?: never;
461
+ header?: never;
462
+ path?: never;
463
+ cookie?: never;
464
+ };
465
+ get?: never;
466
+ put?: never;
467
+ /**
468
+ * Release marker — drift on this monitor doesn't page for the next N minutes (call before a deploy)
469
+ * @description MCP monitors (drift = the Tool Inventory Changed rule). Call it from a deploy pipeline before the rollout starts: for the window, the monitor's drift rules are silenced — only those, so downtime and every other rule still page — the drift incidents opened inside the window are resolved within a minute (timeline: "Resolved — expected change (release marker)"), and the drift timeline marks those changes "Expected — release marker". The dashboard shows "Expected change window until HH:MM" on the monitor. Markers stack (each its own window). Pick a window longer than the rollout plus one check interval: drift first seen after it pages as usual. 12 per hour per monitor (429 + `Retry-After`). Page integrity monitors → 400 (they use `POST /v1/monitors/{id}/baseline?fresh=true` after the deploy); no enabled drift rule → 409. Optional body: `{"note": "v2.4 release"}` (and `window`, when not in the query).
470
+ */
471
+ post: operations["setMonitorExpectedChange"];
472
+ delete?: never;
473
+ options?: never;
474
+ head?: never;
475
+ patch?: never;
476
+ trace?: never;
477
+ };
458
478
  "/monitors/{id}/uptime": {
459
479
  parameters: {
460
480
  query?: never;
@@ -634,6 +654,26 @@ export interface paths {
634
654
  patch?: never;
635
655
  trace?: never;
636
656
  };
657
+ "/incidents/{id}/expected-change": {
658
+ parameters: {
659
+ query?: never;
660
+ header?: never;
661
+ path?: never;
662
+ cookie?: never;
663
+ };
664
+ get?: never;
665
+ put?: never;
666
+ /**
667
+ * Mark a drift incident as an expected change — resolves it and records it as intended
668
+ * @description Drift incidents only (an MCP monitor's Tool Inventory Changed; others → 400). The change was intended: an open incident is resolved through the manual-resolve path (asynchronous — 202; the channels get "resolved — accepted as an expected change by <key>"), and the accept is recorded on the incident timeline and the monitor's drift timeline ("Accepted as expected by <key>") and in the Activity log. A drift incident that already auto-resolved is only recorded (200). Accepting again returns the first accept with `already_accepted: true`. Optional body: `{"note": "why"}` (up to 500 characters).
669
+ */
670
+ post: operations["acceptIncidentExpectedChange"];
671
+ delete?: never;
672
+ options?: never;
673
+ head?: never;
674
+ patch?: never;
675
+ trace?: never;
676
+ };
637
677
  "/incidents/{id}/exclude": {
638
678
  parameters: {
639
679
  query?: never;
@@ -2982,6 +3022,45 @@ export interface components {
2982
3022
  expires_at: string;
2983
3023
  message?: string;
2984
3024
  };
3025
+ /** @description A drift incident accepted as an intended change. `resolve_requested` = this call asked the alert-manager to resolve it (asynchronous — `incident` may still read firing; poll GET /v1/incidents/{id}). */
3026
+ ExpectedChangeAccept: {
3027
+ /** @constant */
3028
+ object: "expected_change";
3029
+ /** @constant */
3030
+ kind: "accepted";
3031
+ incident_id: number;
3032
+ /** Format: uuid */
3033
+ monitor_id: string;
3034
+ /** @description Who accepted it (dashboard user or API key) */
3035
+ accepted_by: string;
3036
+ /** Format: date-time */
3037
+ accepted_at: string;
3038
+ note?: string | null;
3039
+ resolve_requested: boolean;
3040
+ /** @description true = accepted before; nothing changed */
3041
+ already_accepted: boolean;
3042
+ incident: components["schemas"]["Incident"];
3043
+ };
3044
+ /** @description A release marker: until `ends_at`, drift on the monitor (the listed rules only) does not page, and drift incidents opened in the window are resolved within a minute. */
3045
+ ExpectedChangeWindow: {
3046
+ /** @constant */
3047
+ object: "expected_change_window";
3048
+ /** Format: uuid */
3049
+ monitor_id: string;
3050
+ window_minutes: number;
3051
+ /** Format: date-time */
3052
+ starts_at: string;
3053
+ /** Format: date-time */
3054
+ ends_at: string;
3055
+ /** @description The drift alert rules the window covers */
3056
+ rules: {
3057
+ /** Format: uuid */
3058
+ id: string;
3059
+ name: string;
3060
+ }[];
3061
+ note?: string | null;
3062
+ created_by: string;
3063
+ };
2985
3064
  MonitorReset: {
2986
3065
  /** @constant */
2987
3066
  object?: "monitor_reset";
@@ -5351,6 +5430,51 @@ export interface operations {
5351
5430
  };
5352
5431
  };
5353
5432
  };
5433
+ setMonitorExpectedChange: {
5434
+ parameters: {
5435
+ query?: {
5436
+ /** @description Minutes the window stays open (1–60, default 15). Out of range → 400, never clamped. */
5437
+ window?: number;
5438
+ };
5439
+ header?: {
5440
+ /** @description Unique key for safe retries (Stripe semantics, 24h window): the same key + body replays the original response instead of re-creating. */
5441
+ "Idempotency-Key"?: string;
5442
+ };
5443
+ path: {
5444
+ /** @description Resource id (UUID) */
5445
+ id: string;
5446
+ };
5447
+ cookie?: never;
5448
+ };
5449
+ requestBody?: {
5450
+ content: {
5451
+ "application/json": {
5452
+ window?: number;
5453
+ note?: string;
5454
+ };
5455
+ };
5456
+ };
5457
+ responses: {
5458
+ /** @description Window opened */
5459
+ 201: {
5460
+ headers: {
5461
+ [name: string]: unknown;
5462
+ };
5463
+ content: {
5464
+ "application/json": components["schemas"]["ExpectedChangeWindow"];
5465
+ };
5466
+ };
5467
+ /** @description Error */
5468
+ default: {
5469
+ headers: {
5470
+ [name: string]: unknown;
5471
+ };
5472
+ content: {
5473
+ "application/json": components["schemas"]["Error"];
5474
+ };
5475
+ };
5476
+ };
5477
+ };
5354
5478
  getMonitorUptime: {
5355
5479
  parameters: {
5356
5480
  query?: {
@@ -5821,6 +5945,57 @@ export interface operations {
5821
5945
  };
5822
5946
  };
5823
5947
  };
5948
+ acceptIncidentExpectedChange: {
5949
+ parameters: {
5950
+ query?: never;
5951
+ header?: {
5952
+ /** @description Unique key for safe retries (Stripe semantics, 24h window): the same key + body replays the original response instead of re-creating. */
5953
+ "Idempotency-Key"?: string;
5954
+ };
5955
+ path: {
5956
+ /** @description Incident id (integer) */
5957
+ id: string;
5958
+ };
5959
+ cookie?: never;
5960
+ };
5961
+ requestBody?: {
5962
+ content: {
5963
+ "application/json": {
5964
+ /** @description Why the change was expected */
5965
+ note?: string;
5966
+ };
5967
+ };
5968
+ };
5969
+ responses: {
5970
+ /** @description Recorded (the incident was already resolved, or accepted before) */
5971
+ 200: {
5972
+ headers: {
5973
+ [name: string]: unknown;
5974
+ };
5975
+ content: {
5976
+ "application/json": components["schemas"]["ExpectedChangeAccept"];
5977
+ };
5978
+ };
5979
+ /** @description Recorded; resolution requested */
5980
+ 202: {
5981
+ headers: {
5982
+ [name: string]: unknown;
5983
+ };
5984
+ content: {
5985
+ "application/json": components["schemas"]["ExpectedChangeAccept"];
5986
+ };
5987
+ };
5988
+ /** @description Error */
5989
+ default: {
5990
+ headers: {
5991
+ [name: string]: unknown;
5992
+ };
5993
+ content: {
5994
+ "application/json": components["schemas"]["Error"];
5995
+ };
5996
+ };
5997
+ };
5998
+ };
5824
5999
  excludeIncidentFromUptime: {
5825
6000
  parameters: {
5826
6001
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watchfor",
3
- "version": "0.17.2",
3
+ "version": "0.18.0",
4
4
  "description": "Official TypeScript SDK + CLI for WatchFor — uptime & infrastructure monitoring (monitors, alert rules, incidents, maintenance windows) over the REST API.",
5
5
  "keywords": [
6
6
  "watchfor",