# Agent methods, their scopes, and which take a surface id

> Test vectors: Agent methods, their scopes, and which take a surface id. Shown here as it is in conformance/vectors/methods.json.

Protocol `0.1`. Covers: SPEC.md section 9 table; section 6 (hub methods); section 8 (scope order).

[Download methods.json](./methods.json): the file itself, as the conformance suite reads it.

## How to use it

Method to scope table, `HUB_METHODS`, `READ_ONLY_METHODS`, `CHAT_SPEAK_METHODS`, scope intersection.

## Notes

scope null means the method needs no grant scope. `takesSurface` follows "All but the first two and stream.close take s". `hub` marks HUB_METHODS, which section 6 lists.

## scopes

```json
[
  "observe",
  "act",
  "ui",
  "cursor",
  "show",
  "nav",
  "chat"
]
```

## methods

27 entries.

| `m` | `scope` | `takesSurface` | `hub` |
|---|---|---|---|
| `hub.info` | `null` | `false` | `true` |
| `surfaces.list` | `null` | `false` | `true` |
| `surface.attach` | `null` | `true` | `true` |
| `surface.detach` | `null` | `true` | `true` |
| `observe` | `observe` | `true` | `false` |
| `read` | `observe` | `true` | `false` |
| `state.get` | `observe` | `true` | `false` |
| `sub` | `observe` | `true` | `false` |
| `unsub` | `observe` | `true` | `false` |
| `act` | `act` | `true` | `false` |
| `ui.click` | `ui` | `true` | `false` |
| `ui.type` | `ui` | `true` | `false` |
| `ui.select` | `ui` | `true` | `false` |
| `ui.scroll` | `ui` | `true` | `false` |
| `ui.key` | `ui` | `true` | `false` |
| `cursor.move` | `cursor` | `true` | `false` |
| `cursor.set` | `cursor` | `true` | `false` |
| `show.toast` | `show` | `true` | `false` |
| `show.highlight` | `show` | `true` | `false` |
| `show.view` | `show` | `true` | `false` |
| `show.clear` | `show` | `true` | `false` |
| `nav.go` | `nav` | `true` | `false` |
| `chat.say` | `chat` | `true` | `false` |
| `chat.read` | `chat` | `true` | `false` |
| `chat.status` | `chat` | `true` | `false` |
| `stream.open` | `cursor` | `true` | `true` |
| `stream.close` | `null` | `false` | `true` |

## readOnly

```json
{
  "note": "READ_ONLY_METHODS as listed in SPEC.md section 9, \"Pause\": served while control is paused and while a consent prompt is up.",
  "methods": [
    "observe",
    "read",
    "state.get",
    "sub",
    "unsub",
    "chat.read"
  ]
}
```

## chatSpeak

```json
{
  "note": "CHAT_SPEAK_METHODS of SPEC.md section 9, \"Pause\" and \"Prompt up\": served while control is paused, refused with E_BUSY while a consent prompt is up.",
  "methods": [
    "chat.say",
    "chat.status"
  ]
}
```

## capScopes

6 cases.

```json
[
  {
    "requested": [
      "nav",
      "observe",
      "act"
    ],
    "caps": [],
    "expect": [
      "observe",
      "act",
      "nav"
    ]
  },
  {
    "requested": [
      "observe",
      "act",
      "ui"
    ],
    "caps": [
      [
        "act",
        "observe"
      ]
    ],
    "expect": [
      "observe",
      "act"
    ]
  },
  {
    "requested": [
      "ui"
    ],
    "caps": [
      [
        "observe",
        "act",
        "cursor",
        "show"
      ]
    ],
    "expect": []
  },
  {
    "requested": [
      "show",
      "cursor",
      "act",
      "observe"
    ],
    "caps": [
      [
        "observe",
        "act",
        "ui",
        "cursor",
        "show",
        "nav"
      ],
      [
        "cursor",
        "observe"
      ]
    ],
    "expect": [
      "observe",
      "cursor"
    ]
  },
  {
    "requested": [
      "chat",
      "observe",
      "nav"
    ],
    "caps": [],
    "expect": [
      "observe",
      "nav",
      "chat"
    ]
  },
  {
    "requested": [
      "chat",
      "observe"
    ],
    "caps": [
      [
        "observe",
        "act",
        "cursor",
        "show"
      ]
    ],
    "expect": [
      "observe"
    ]
  }
]
```

Generated by `conformance/tools/make-vectors.mjs` from the formulas in the specification, with `node:crypto` only.
