AgentTicket agent.ticket@1

Generated at from openvibe-contracts v0.419.0 and openvibe-sdk v0.161.0.

Version
1.0.0
Owner
actor
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/agent/ticket.v1.json

Authorized work with an immutable mandate. Policy changes notify, never cancel. Revalidate before resuming an ended ticket; bots and CI cannot resume it. Stage applies to open tickets.

Fields

FieldTypeRequiredDescriptionConstraints
idstringyes
  • minLength 1
trigger_idstringyes
  • minLength 1
mandateobjectyes
  • no other fields
mandate.policy_versionstringyes
  • minLength 1
mandate.scopestringyes
  • minLength 1
mandate.strengthenumyes
  • one of "explicit", "inferred"
mandate.matched_rulesarray of stringyes
  • unique items
  • items: minLength 1
mandate.actorobjectyes
  • no other fields
mandate.actor.sourcestringyes
  • minLength 1
mandate.actor.idstringyes
  • minLength 1
mandate.actor.kindenumyes
  • one of "person", "bot", "system"
mandate.source_scopestringyes
  • minLength 1
mandate.budgetobjectyes
  • no other fields
mandate.budget.usdnumberyes
  • minimum 0
mandate.budget.tokensintegeryes
  • minimum 0
mandate.budget.wall_minutesnumberyes
  • minimum 0
stateenumyes
  • one of "open", "ended"
stageagent.stageyes
threadsarray of stringyes
  • minItems 1
  • unique items
  • items: minLength 1

Examples

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

Valid: example
{
  "id": "tkt_1",
  "trigger_id": "trg_1",
  "mandate": {
    "policy_version": "1",
    "scope": "Fix issue 1",
    "strength": "explicit",
    "matched_rules": [],
    "actor": {
      "source": "github",
      "id": "owner",
      "kind": "person"
    },
    "source_scope": "issues",
    "budget": {
      "usd": 2,
      "tokens": 100000,
      "wall_minutes": 30
    }
  },
  "state": "open",
  "stage": "working",
  "threads": [
    "issue:1"
  ]
}
Rejected: budget
{
  "id": "tkt_1",
  "trigger_id": "trg_1",
  "mandate": {
    "policy_version": "1",
    "scope": "Fix issue 1",
    "strength": "explicit",
    "matched_rules": [],
    "actor": {
      "source": "github",
      "id": "owner",
      "kind": "person"
    },
    "source_scope": "issues",
    "budget": {
      "usd": -1,
      "tokens": 100000,
      "wall_minutes": 30
    }
  },
  "state": "open",
  "stage": "working",
  "threads": [
    "issue:1"
  ]
}
Rejected: unknown
{
  "id": "tkt_1",
  "trigger_id": "trg_1",
  "mandate": {
    "policy_version": "1",
    "scope": "Fix issue 1",
    "strength": "explicit",
    "matched_rules": [],
    "actor": {
      "source": "github",
      "id": "owner",
      "kind": "person"
    },
    "source_scope": "issues",
    "budget": {
      "usd": 2,
      "tokens": 100000,
      "wall_minutes": 30
    }
  },
  "state": "open",
  "stage": "working",
  "threads": [
    "issue:1"
  ],
  "unexpected": true
}

Validate

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