@devfellowship/access 0.2.1 → 0.3.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 +5 -1
- package/capabilities.json +2684 -45
- package/db-surface.json +18 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/principal.d.ts +11 -1
- package/dist/principal.js +78 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ npm run catalog:check # writes nothing; exit 1 when the file is out of date
|
|
|
96
96
|
node scripts/build-catalog.mjs --manifest <file> --gateway-modes <oauth-tools.generated.ts>
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
The build prints `tools: N` and `capabilities: N`. It exits 1 when a tool is **unmapped** (its verb is not in `VERBS`, or its name has no entity and `OVERRIDES` has no entry) or when two tools get one name. A new MCP tool with a new verb therefore fails the `catalog` CI job until someone adds the verb to `VERBS` with its mode (`read` or `write`) in `scripts/catalog-lib.mjs`. With `--gateway-modes`, the build also exits 1 when the catalog offers a write tool of the gateway registry as a read. The **mode guard** (CATALOG-READ-MODE-FIX): a tool whose name starts with `list`, `get`, `wait`, `read`, `search` or `describe` and is `write` fails the build, on the catalog and on the gateway registry, unless `READ_NAME_WRITE_ALLOWLIST` in `scripts/catalog-lib.mjs` names it with the reason it writes (an upload, a paid call, a job that registers media). An allow-list line with no reason, or for a tool that is no longer `write`, also fails. The verb `check` is `write` by default; a check that only reads gets an `OVERRIDES` entry with `mode: "read"`, and the gateway cross-check fails the build if the gateway says `write` for it. A deprecated alias adds no entry. Commands (kind `command`) enter the catalog when the first command exists (S2-T6). The kinds `table`, `rpc` and `function` come from the database surface (next section).
|
|
99
|
+
The build prints `tools: N` and `capabilities: N`. It exits 1 when a tool is **unmapped** (its verb is not in `VERBS`, or its name has no entity and `OVERRIDES` has no entry) or when two tools get one name. A new MCP tool with a new verb therefore fails the `catalog` CI job until someone adds the verb to `VERBS` with its mode (`read` or `write`) in `scripts/catalog-lib.mjs`. With `--gateway-modes`, the build also exits 1 when the catalog offers a write tool of the gateway registry as a read. The **mode guard** (CATALOG-READ-MODE-FIX): a tool whose name starts with `list`, `get`, `wait`, `read`, `search` or `describe` and is `write` fails the build, on the catalog and on the gateway registry, unless `READ_NAME_WRITE_ALLOWLIST` in `scripts/catalog-lib.mjs` names it with the reason it writes (an upload, a paid call, a job that registers media). An allow-list line with no reason, or for a tool that is no longer `write`, also fails. The verb `check` is `write` by default; a check that only reads gets an `OVERRIDES` entry with `mode: "read"`, and the gateway cross-check fails the build if the gateway says `write` for it. A deprecated alias adds no entry. Commands (kind `command`) enter the catalog when the first command exists (S2-T6). A command that has an MCP tool merges into that tool entry through `COMMANDS`. A command with **no** MCP tool (a UI-only write; CLAUDE.md: MCP is only for AI agents) is declared in `COMMAND_ONLY` (FIN-T4): one reviewed entry per capability with `command` (name), `route`, `mode` and `rule`; the entry gets kind `command`, doors `["commands"]`, no `tool`, and `domain_group` from `domains.json`. The build fails with the name when an MCP tool later takes the same capability; then move the entry to `COMMANDS`. An entry is a name only: it grants nothing. The gap check `services/dfl-os-commands/src/commands/access/command-catalog.test.ts` (CAMP-T4) reads the capability of every command of dfl-os-commands, with no hand-kept list, and fails with the names when one is not in `capabilities.json`: a new command with no MCP tool of the same capability name needs one `COMMAND_ONLY` entry and `npm run catalog`. The kinds `table`, `rpc` and `function` come from the database surface (next section).
|
|
100
100
|
|
|
101
101
|
## The database surface in the catalog (S7-T4)
|
|
102
102
|
|
|
@@ -128,6 +128,10 @@ npm run catalog # builds capabilities.json from the tools manifest and th
|
|
|
128
128
|
|
|
129
129
|
`resolvePrincipal(reads, actorId)` builds the `Principal` of `can()` and returns the lines to pass in: the actor, its role bundles, and for an agent its owner (the delegator of its one active delegation), up to `MAX_OWNER_DEPTH` layers. It does no I/O: the caller passes four reads (`readActor`, `readActorRoles`, `readActorOwners`, `readLines`), each with the caller's own token. `dfl-os-commands` passes SQL in a caller transaction; the gateway passes PostgREST reads. One copy of the owner-chain rules for both (plan `20261116-fleet-access-s3-gateway-decision`, ADR-1).
|
|
130
130
|
|
|
131
|
+
### Agent roles (0.3.0)
|
|
132
|
+
|
|
133
|
+
An agent gets a role through a line, not through `iam.user_roles` (S2-T5; Tainan Q `18e7e16f` = A; S9 ADR-5). An in-force **allow** line `agents.role.<role_id>` with scope `all` on an **agent** actor makes `<role_id>` one of its role ids, so the role lines (`principal_role_id = <role_id>`) apply to it. `resolvePrincipal(reads, actorId, now?)` reads those role lines with one more `readLines([], newRoleIds)`. A revoked, expired, deny, scoped or malformed line gives no role. A person or a service never gets a role this way. A line read through a role never adds a role (no nesting). The agent stays under its owner (agent ∩ owner). `agentRoleOf(line)` and `AGENT_ROLE_CAPABILITY_PREFIX` are exported. The pinned consumers (the gateway) get the rule when they bump the version.
|
|
134
|
+
|
|
131
135
|
## The parity fixture
|
|
132
136
|
|
|
133
137
|
`parity.json` (shipped, `@devfellowship/access/parity.json`) holds one world (actors, role bundles, owners, permission lines) and the decision of each case. `expected` is the answer of `dfl-os-commands` `runExplain`. Three tests assert it: `test/parity.test.mjs` here, `services/dfl-os-commands/src/commands/access/parity.test.ts` (the service), and the gateway test in `dfl-mcp-server`. A change of a rule that moves an answer changes `parity.json` in the same PR.
|