WatchRequest watch.watch-request@1

Generated at from openvibe-contracts v0.454.0 and openvibe-sdk v0.193.0.

Version
1.0.0
Owner
watch
Visibility
first-party
Status
planned
Compatibility
backward
Schema
https://openvibe.network/contracts/watch/watch-request.v1.json

watch.watch-request@1: the body of POST /api/v1/watches and PATCH /api/v1/watches/:id on OpenVibe.Watch (watch.watch.manage; the acting person). Every field is optional on a patch, project_id included (null clears it); a create requires source, extraction, condition and action, which the service enforces in code (422 watch.invalid).

Fields

FieldTypeRequiredDescriptionConstraints
namestring
  • minLength 1
  • maxLength 120
labelsobject
project_idstring | nullThe project the watch's project work belongs to (its run-job actions are billed to it). The acting person must be an admin or owner of the unarchived project: Watch checks with Network when it is saved (network.project.member.read; 403 project.not_delegated otherwise) and OpenVibe.Run checks again at every job (ADR-003 amendment 2026-10-12). null clears it.
  • pattern ^prj_[0-9A-HJKMNP-TV-Z]{26}$
project_envenumThe project environment the watch's project secrets (ADR-056: a source credential's or a webhook action's secret_ref) are looked up in. Defaults to production when the watch names a project; meaningless without one.
  • one of "sandbox", "production"
sourcehttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/source
cadencehttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/cadence
extractionhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/extraction
comparisonhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/comparison
conditionhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/condition
actionhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/action
  • minItems 1
  • maxItems 8
budgethttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/budget
retentionhttps://openvibe.network/contracts/watch/watch.v1.json#/$defs/retention
statusenum
  • one of "active", "paused", "disabled", "failed"

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: create-event-watch
{
  "name": "Release 0.102.0 published",
  "source": {
    "kind": "event",
    "pattern": "host.release.published",
    "filter": null
  },
  "cadence": null,
  "extraction": {
    "kind": "json",
    "selector": null,
    "fields": null,
    "value_path": "$.release",
    "ai": null
  },
  "comparison": {
    "mode": "changed",
    "tolerance": null,
    "percent": null
  },
  "condition": {
    "op": "changed",
    "value": null,
    "for_sec": null
  },
  "action": [
    {
      "kind": "notification",
      "category": "service",
      "priority": "normal"
    }
  ],
  "budget": {
    "checks_per_day": 100,
    "usd_per_month": 0,
    "max_runtime_ms": 5000,
    "max_bytes": 1048576
  },
  "retention": {
    "observations_days": 30,
    "keep_snapshots": false
  },
  "status": "active"
}
Valid: project-run-job
{
  "name": "Rebuild the docs site on release",
  "source": {
    "kind": "event",
    "pattern": "host.release.published",
    "filter": null
  },
  "cadence": null,
  "extraction": {
    "kind": "json",
    "selector": null,
    "fields": null,
    "value_path": "$.release",
    "ai": null
  },
  "comparison": {
    "mode": "changed",
    "tolerance": null,
    "percent": null
  },
  "condition": {
    "op": "changed",
    "value": null,
    "for_sec": null
  },
  "action": [
    {
      "kind": "run-job",
      "class": "function",
      "artifact": {
        "name": "docs-build",
        "version": "1.4.0"
      },
      "args": {
        "site": "docs"
      },
      "limits": {
        "wall_ms": 120000,
        "cpu_ms": 60000,
        "mem_bytes": 268435456
      },
      "egress": "openvibe-only",
      "firing_arg": "firing"
    }
  ],
  "budget": {
    "checks_per_day": 100,
    "usd_per_month": 0,
    "max_runtime_ms": 5000,
    "max_bytes": 1048576
  },
  "retention": {
    "observations_days": 30,
    "keep_snapshots": false
  },
  "status": "active",
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPS"
}
Valid: project-webhook-secret
{
  "name": "Tell my server when the release changes",
  "source": {
    "kind": "event",
    "pattern": "host.release.published",
    "filter": null
  },
  "cadence": null,
  "extraction": {
    "kind": "json",
    "selector": null,
    "fields": null,
    "value_path": "$.release",
    "ai": null
  },
  "comparison": {
    "mode": "changed",
    "tolerance": null,
    "percent": null
  },
  "condition": {
    "op": "changed",
    "value": null,
    "for_sec": null
  },
  "action": [
    {
      "kind": "webhook",
      "url": "https://hooks.example.com/watch",
      "secret_ref": "webhook-signing"
    }
  ],
  "budget": {
    "checks_per_day": 100,
    "usd_per_month": 0,
    "max_runtime_ms": 5000,
    "max_bytes": 1048576
  },
  "retention": {
    "observations_days": 30,
    "keep_snapshots": false
  },
  "status": "active",
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "project_env": "production"
}
Rejected: bad-project-id
{
  "name": "Rebuild the docs site on release",
  "source": {
    "kind": "event",
    "pattern": "host.release.published",
    "filter": null
  },
  "cadence": null,
  "extraction": {
    "kind": "json",
    "selector": null,
    "fields": null,
    "value_path": "$.release",
    "ai": null
  },
  "comparison": {
    "mode": "changed",
    "tolerance": null,
    "percent": null
  },
  "condition": {
    "op": "changed",
    "value": null,
    "for_sec": null
  },
  "action": [
    {
      "kind": "run-job",
      "class": "function",
      "artifact": {
        "name": "docs-build",
        "version": "1.4.0"
      },
      "args": {
        "site": "docs"
      },
      "limits": {
        "wall_ms": 120000,
        "cpu_ms": 60000,
        "mem_bytes": 268435456
      },
      "egress": "openvibe-only",
      "firing_arg": "firing"
    }
  ],
  "budget": {
    "checks_per_day": 100,
    "usd_per_month": 0,
    "max_runtime_ms": 5000,
    "max_bytes": 1048576
  },
  "retention": {
    "observations_days": 30,
    "keep_snapshots": false
  },
  "status": "active",
  "project_id": "project-1"
}
Rejected: run-job-partial-limits
{
  "name": "Rebuild the docs site on release",
  "source": {
    "kind": "event",
    "pattern": "host.release.published",
    "filter": null
  },
  "cadence": null,
  "extraction": {
    "kind": "json",
    "selector": null,
    "fields": null,
    "value_path": "$.release",
    "ai": null
  },
  "comparison": {
    "mode": "changed",
    "tolerance": null,
    "percent": null
  },
  "condition": {
    "op": "changed",
    "value": null,
    "for_sec": null
  },
  "action": [
    {
      "kind": "run-job",
      "class": "function",
      "artifact": {
        "name": "docs-build",
        "version": "1.4.0"
      },
      "args": {
        "site": "docs"
      },
      "limits": {
        "wall_ms": 120000
      },
      "egress": "openvibe-only",
      "firing_arg": "firing"
    }
  ],
  "budget": {
    "checks_per_day": 100,
    "usd_per_month": 0,
    "max_runtime_ms": 5000,
    "max_bytes": 1048576
  },
  "retention": {
    "observations_days": 30,
    "keep_snapshots": false
  },
  "status": "active",
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPS"
}
Rejected: unknown-status
{
  "name": "Release 0.102.0 published",
  "source": {
    "kind": "event",
    "pattern": "host.release.published"
  },
  "condition": {
    "op": "changed"
  },
  "action": [
    {
      "kind": "notification"
    }
  ],
  "status": "archived"
}
Rejected: webhook-without-secret
{
  "name": "Tell my server when the release changes",
  "source": {
    "kind": "event",
    "pattern": "host.release.published",
    "filter": null
  },
  "cadence": null,
  "extraction": {
    "kind": "json",
    "selector": null,
    "fields": null,
    "value_path": "$.release",
    "ai": null
  },
  "comparison": {
    "mode": "changed",
    "tolerance": null,
    "percent": null
  },
  "condition": {
    "op": "changed",
    "value": null,
    "for_sec": null
  },
  "action": [
    {
      "kind": "webhook",
      "url": "https://hooks.example.com/watch"
    }
  ],
  "budget": {
    "checks_per_day": 100,
    "usd_per_month": 0,
    "max_runtime_ms": 5000,
    "max_bytes": 1048576
  },
  "retention": {
    "observations_days": 30,
    "keep_snapshots": false
  },
  "status": "active",
  "project_id": "prj_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "project_env": "production"
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('watch.watch-request@1', value);   // { valid, errors: [{ path, message }] }