nutria-plugin 0.7.0__tar.gz → 0.9.0__tar.gz

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.
Files changed (77) hide show
  1. nutria_plugin-0.9.0/.github/workflows/ci.yml +21 -0
  2. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/.github/workflows/publish.yml +1 -0
  3. nutria_plugin-0.9.0/AGENTS.md +11 -0
  4. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/CHANGELOG.md +66 -0
  5. nutria_plugin-0.9.0/CONTRIBUTING.md +25 -0
  6. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/PKG-INFO +7 -3
  7. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/README.md +6 -2
  8. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/capability-authoring.md +31 -0
  9. nutria_plugin-0.9.0/docs/capability-families.md +90 -0
  10. nutria_plugin-0.9.0/docs/cli.md +89 -0
  11. nutria_plugin-0.9.0/docs/connection-types.md +95 -0
  12. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/index.md +3 -1
  13. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/manifest.md +19 -1
  14. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/outside-audience.md +10 -1
  15. nutria_plugin-0.9.0/docs/plugin-authoring/README.md +878 -0
  16. nutria_plugin-0.9.0/docs/plugin-authoring/briefs/correos.md +108 -0
  17. nutria_plugin-0.9.0/docs/plugin-authoring/briefs/email-update.md +129 -0
  18. nutria_plugin-0.9.0/docs/plugin-authoring/briefs/odoo.md +66 -0
  19. nutria_plugin-0.9.0/docs/plugin-authoring/briefs/wordpress-woo.md +69 -0
  20. nutria_plugin-0.9.0/docs/plugin-authoring/plugins-inventory.md +91 -0
  21. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/python-api.md +32 -7
  22. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/quickstart.md +1 -1
  23. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/reviewable-actions.md +45 -4
  24. nutria_plugin-0.9.0/docs/security.md +99 -0
  25. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/pyproject.toml +1 -1
  26. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/__init__.py +103 -3
  27. nutria_plugin-0.9.0/src/nutria_plugin/artifacts.py +180 -0
  28. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/capabilities.py +78 -12
  29. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/manifest.py +0 -20
  30. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/mcp_results.py +101 -1
  31. nutria_plugin-0.9.0/src/nutria_plugin/prepared_preview.py +638 -0
  32. nutria_plugin-0.9.0/tests/test_artifacts.py +294 -0
  33. nutria_plugin-0.9.0/tests/test_audience_contract.py +72 -0
  34. nutria_plugin-0.9.0/tests/test_authoring_guide_drift.py +444 -0
  35. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_mcp_results.py +17 -0
  36. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_prepared_preview.py +28 -1
  37. nutria_plugin-0.9.0/tests/test_receipts.py +180 -0
  38. nutria_plugin-0.9.0/tests/test_version.py +15 -0
  39. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/uv.lock +1 -1
  40. nutria_plugin-0.7.0/docs/cli.md +0 -188
  41. nutria_plugin-0.7.0/docs/connection-types.md +0 -326
  42. nutria_plugin-0.7.0/docs/security.md +0 -277
  43. nutria_plugin-0.7.0/src/nutria_plugin/prepared_preview.py +0 -163
  44. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/.gitignore +0 -0
  45. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/admin-extensions.md +0 -0
  46. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/admin-flows.md +0 -0
  47. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/conversation-ownership.md +0 -0
  48. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/migration-6.0.md +0 -0
  49. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/docs/skill-format.md +0 -0
  50. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/examples/my-first-plugin/README.md +0 -0
  51. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/examples/my-first-plugin/hooks/hooks.json +0 -0
  52. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/examples/my-first-plugin/plugin.json +0 -0
  53. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/examples/my-first-plugin/settings.schema.json +0 -0
  54. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/bundle.py +0 -0
  55. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/cli.py +0 -0
  56. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/conversation_scope.py +0 -0
  57. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/domains.py +0 -0
  58. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/hierarchy.py +0 -0
  59. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/migrate.py +0 -0
  60. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/operation_facts.py +0 -0
  61. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/ownership.py +0 -0
  62. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/packaging.py +0 -0
  63. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/signing.py +0 -0
  64. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/src/nutria_plugin/skills.py +0 -0
  65. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/__init__.py +0 -0
  66. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_bundle.py +0 -0
  67. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_capability_contracts.py +0 -0
  68. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_cli.py +0 -0
  69. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_contract_vnext.py +0 -0
  70. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_conversation_scope.py +0 -0
  71. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_hierarchy.py +0 -0
  72. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_manifest.py +0 -0
  73. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_ownership.py +0 -0
  74. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_packaging.py +0 -0
  75. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_reviewable_actions.py +0 -0
  76. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_signing.py +0 -0
  77. {nutria_plugin-0.7.0 → nutria_plugin-0.9.0}/tests/test_skill_format_docs.py +0 -0
@@ -0,0 +1,21 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["**"]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ with:
14
+ fetch-depth: 0 # hatch-vcs reads git tags for the version
15
+ - uses: astral-sh/setup-uv@v5
16
+ with:
17
+ enable-cache: true
18
+ - name: Tests
19
+ run: uv run --extra dev pytest -q
20
+ - name: Lint
21
+ run: uv run --extra dev ruff check src tests
@@ -29,6 +29,7 @@ jobs:
29
29
  with:
30
30
  name: dist
31
31
  path: dist/
32
+ retention-days: 1 # only handed to the publish job; PyPI is the real home
32
33
 
33
34
  publish:
34
35
  name: Publish to PyPI
@@ -0,0 +1,11 @@
1
+ # Agent instructions for nutria-plugin-sdk
2
+
3
+ This SDK is the contract between Nutria plugins and the Nutria Host. It carries contracts and their generic
4
+ validators, never domain logic or a provider name.
5
+
6
+ - Read `CONTRIBUTING.md`: every SDK change updates `docs/plugin-authoring/` in the same commit
7
+ (`tests/test_authoring_guide_drift.py` enforces part of it).
8
+ - Capability families (shared contracts several providers implement): follow `docs/capability-families.md` to add or
9
+ edit one. A family exists only for a fixed consumer; it is declarative data checked by a generic mechanism; shared
10
+ domain code belongs to a domain kit outside this SDK.
11
+ - Checks: `uv run --extra dev pytest` and `uv run --extra dev ruff check src tests`.
@@ -1,5 +1,71 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ Documentation only; no change to the package.
6
+
7
+ - Add the plugin authoring guide (`docs/plugin-authoring/`): guide, plugin inventory and briefs for the
8
+ email, WordPress+Woo, Odoo and Correos plugins.
9
+ - Add `tests/test_authoring_guide_drift.py` and `CONTRIBUTING.md`: SDK changes must update the guide.
10
+
11
+ ## 0.9.0
12
+
13
+ Additive: every 0.8.0 manifest keeps validating. An `artifact` input or output without the new spec
14
+ stays a plain World reference.
15
+
16
+ - Files as capability input and output: optional `ArtifactSpec` (`media_types`, `max_bytes`,
17
+ `delivery: inline_base64`) on `artifact` inputs and outputs, and the shared 25 MiB
18
+ `MAX_ARTIFACT_BYTES` limit (same as the Host artifact store).
19
+ - Add `ArtifactFile`, `ArtifactDescriptor`, `ArtifactPayload`, `artifact_descriptor`,
20
+ `read_artifact_argument`, `verify_artifact_output`, `media_type_accepted`, `ArtifactError`, and
21
+ `artifact_output`. Input helpers validate strict
22
+ base64, size, media type, and SHA-256 before plugin effects; prepared actions contain descriptors
23
+ without payload bytes.
24
+ - Extend prepared-preview conformance to compare artifact descriptors and reject
25
+ `preview_artifact_content_frozen` snapshots.
26
+ - Validate base64, media type, size and SHA-256 of artifact outputs that declare a spec. Export `ARTIFACT_OUTPUT_CONFORMANCE_VECTORS`.
27
+ - Update the plugin authoring guide, capability reference, manifest reference, and drift checks for
28
+ artifact contracts and helpers.
29
+
30
+ ## 0.8.0
31
+
32
+ Breaking for manifests that relied on the older, looser audience rules; additive for receipt-aware plugins.
33
+
34
+ - Model the prepared-preview receipt. `PluginReceipt` describes the top-level `receipt` object;
35
+ `HOST_CONTROL_RECEIPT_FIELDS` maps `prepared_action.state_fingerprint` and
36
+ `prepared_action.normalized_effect_fingerprint` to `state_fingerprint` and
37
+ `normalized_effect_fingerprint`; `required_receipt_fields` reads both per-argument
38
+ `x-nutria-host-control` markers and projected `metadata.host_control_bindings`.
39
+ - Add `check_receipt_bindings` and `assert_receipt_bindings`; the latter raises `ReceiptBindingError`
40
+ naming every missing or empty field. Add `RECEIPT_CONFORMANCE_VECTORS` next to the existing preview
41
+ vectors.
42
+ - Add `assert_server_receipt_bindings`/`host_controlled_tools` for plugin tests over every tool whose
43
+ schema declares a host-control marker, and dependency-free `assert_host_preserves_receipt` for Host
44
+ adapter tests.
45
+ - Enforce the closed audience vocabulary (`public_customer`, `private_internal`, `team_internal`).
46
+ Unknown audience values now fail validation.
47
+ - Treat `personal_identifier` as a private output class, like the Host. A `public_customer` capability
48
+ returning `personal_identifier`, `personal_content`, or `special_category` must scope an input to the
49
+ conversation contact.
50
+ - Require the `public_customer` audience when an input declares `scope: "conversation_contact"`.
51
+ - `__version__` now comes from package metadata (or the adjacent `pyproject.toml` in a source
52
+ checkout), with a test that it equals the project version.
53
+ - Remove unused `PreparationToolContract` and `normalize_capability_map`.
54
+
55
+ ### Migration notes
56
+
57
+ - A `public_customer` capability that returns `personal_identifier` without a conversation-scoped input
58
+ is now rejected. Either scope the contact input or drop `public_customer` from its audience. MRW
59
+ `mrw.shipments.status` is one such capability in 0.8.9-beta.
60
+ - A capability that declares `scope: "conversation_contact"` must also declare `public_customer`;
61
+ internal-only capabilities cannot use the scope.
62
+ - Replace any audience value outside the three-name vocabulary; `everyone` and similar values are
63
+ invalid.
64
+ - Plugins importing `PreparationToolContract` or calling `normalize_capability_map` must remove those
65
+ references; both were unused and are gone.
66
+ - A plugin that had pinned `nutria-plugin>=0.6.1` inherits these stricter rules on upgrade; validate
67
+ before publishing.
68
+
3
69
  ## 0.7.0
4
70
 
5
71
  Additive; manifests that do not use the new field are unchanged.
@@ -0,0 +1,25 @@
1
+ # Contributing
2
+
3
+ ## Checks
4
+
5
+ ```bash
6
+ uv run --extra dev pytest
7
+ uv run --extra dev ruff check src tests
8
+ ```
9
+
10
+ ## SDK changes must update the plugin authoring guide
11
+
12
+ [docs/plugin-authoring/](docs/plugin-authoring/README.md) is what a developer with no earlier context
13
+ follows to build a plugin. In the same change as any SDK change:
14
+
15
+ 1. Update the affected sections of the guide, and the briefs that depend on them.
16
+ 2. When releasing a version: re-read the changelog entry against the guide, check the `Host:` facts the
17
+ change touches, then update the "Last verified against SDK x.y.z" line.
18
+
19
+ `tests/test_authoring_guide_drift.py` fails when the guide cites an SDK path, name, manifest field or
20
+ CLI command that no longer exists, omits a contract field, enum value or command, or states another
21
+ version. It cannot see changed behaviour behind an unchanged name, or changes in the Host and plugin
22
+ repositories: those need a reader.
23
+
24
+ If the test reports a name that belongs to the Host, a plugin or a vendor, add it to `EXTERNAL_NAMES`
25
+ in the test, or cite a path with the `Host:`, `MRW:` or `plugin:` prefix.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: nutria-plugin
3
- Version: 0.7.0
3
+ Version: 0.9.0
4
4
  Summary: SDK for building, validating, signing, and packaging Nutria plugins
5
5
  Project-URL: Homepage, https://github.com/AlRos14/nutria-plugin-sdk
6
6
  Project-URL: Repository, https://github.com/AlRos14/nutria-plugin-sdk
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  SDK for building, validating, signing, and packaging Nutria plugins.
24
24
 
25
- Release `0.6.2` accepts only manifest schema `6.0`. Capabilities use their real
25
+ Release `0.9.0` accepts only manifest schema `6.0`. Capabilities use their real
26
26
  business effect (`read`, `write`, or `external_write`); preparation is expressed
27
27
  by producing `prepared_action`, not by a workflow-phase effect. Every parsed
28
28
  requirement resolves `task_context` to `required`, `optional`, or `forbidden`,
@@ -32,10 +32,14 @@ ChatBotNutralia owns task context, reviewable drafts, revisions, approval,
32
32
  idempotency, and completion receipts. Plugins own authoritative provider reads
33
33
  and exact delivery of an approved snapshot.
34
34
 
35
+ ## Building a plugin
36
+
37
+ Start with the [plugin authoring guide](docs/plugin-authoring/README.md).
38
+
35
39
  ## Install
36
40
 
37
41
  ```bash
38
- uv add nutria-plugin==0.6.2
42
+ uv add nutria-plugin==0.9.0
39
43
  ```
40
44
 
41
45
  ## Scaffold and validate
@@ -2,7 +2,7 @@
2
2
 
3
3
  SDK for building, validating, signing, and packaging Nutria plugins.
4
4
 
5
- Release `0.6.2` accepts only manifest schema `6.0`. Capabilities use their real
5
+ Release `0.9.0` accepts only manifest schema `6.0`. Capabilities use their real
6
6
  business effect (`read`, `write`, or `external_write`); preparation is expressed
7
7
  by producing `prepared_action`, not by a workflow-phase effect. Every parsed
8
8
  requirement resolves `task_context` to `required`, `optional`, or `forbidden`,
@@ -12,10 +12,14 @@ ChatBotNutralia owns task context, reviewable drafts, revisions, approval,
12
12
  idempotency, and completion receipts. Plugins own authoritative provider reads
13
13
  and exact delivery of an approved snapshot.
14
14
 
15
+ ## Building a plugin
16
+
17
+ Start with the [plugin authoring guide](docs/plugin-authoring/README.md).
18
+
15
19
  ## Install
16
20
 
17
21
  ```bash
18
- uv add nutria-plugin==0.6.2
22
+ uv add nutria-plugin==0.9.0
19
23
  ```
20
24
 
21
25
  ## Scaffold and validate
@@ -77,6 +77,35 @@ The Host decides what reaches the inference provider from these classes, the ten
77
77
  retention posture. It never guesses from field names, so classify honestly: an output that may carry
78
78
  personal text is `personal_content`.
79
79
 
80
+ ## 4.1 Artifact inputs and outputs
81
+
82
+ A `kind: resource` binding with `resource_type: artifact` is a plain World reference (no bytes) unless
83
+ it declares an `artifact` specification (`src/nutria_plugin/capabilities.py::ArtifactSpec`); with it
84
+ the Host delivers the file content. The specification requires a
85
+ non-empty `media_types` list, `max_bytes` from 1 through `MAX_ARTIFACT_BYTES` (25 MiB), and
86
+ `delivery: inline_base64`. Each media type is an exact MIME type such as `application/pdf` or a major
87
+ wildcard such as `image/*`. A different resource type cannot declare `artifact`.
88
+
89
+ The Agent supplies only the artifact reference. The Host resolves it in the authorized scope and
90
+ passes the plugin `{artifact_ref, sha256, media_type, byte_size, name, content_base64}` during preview
91
+ and execution. Plugins should call `read_artifact_argument(value, spec)` from
92
+ `src/nutria_plugin/artifacts.py` before any effect. It strictly decodes base64 and checks the media
93
+ type, maximum size, byte size and SHA-256. `ArtifactError.code` is one of
94
+ `ARTIFACT_MISSING_CONTENT`, `ARTIFACT_SHA256_MISMATCH`, `ARTIFACT_SIZE_MISMATCH`,
95
+ `ARTIFACT_TOO_LARGE`, `ARTIFACT_MEDIA_TYPE_NOT_ACCEPTED`, or `ARTIFACT_MALFORMED`.
96
+
97
+ Prepared actions retain an `ArtifactDescriptor` (`artifact_ref`, `sha256`, `media_type`, `byte_size`,
98
+ `name`) and never file bytes. A preview echoes that descriptor without `content_base64`; the Host
99
+ rejects an echoed payload with `PREVIEW_ARTIFACT_CONTENT_FROZEN`. The approval view can identify the
100
+ file by name, size and a short SHA-256.
101
+
102
+ An artifact output binding (`resource_type: artifact`) that declares `artifact` (the same
103
+ `ArtifactSpec`) returns `{name, media_type, byte_size, sha256, content_base64}`; with
104
+ `output.many: true`, a list of them. `artifact_output(name, media_type, content)` builds the object and
105
+ `verify_artifact_output(value, spec)` checks it; result validation checks base64, media type, maximum
106
+ size, byte size and SHA-256. The Host stores the file and gives the model only the reference. Run the shared
107
+ `ARTIFACT_OUTPUT_CONFORMANCE_VECTORS` for output conformance.
108
+
80
109
  ## 5. PreparedAction authoring
81
110
 
82
111
  A model-selectable `external_write` must declare `prepared_action`. The model calls the preparation
@@ -103,6 +132,8 @@ implementation.
103
132
 
104
133
  Schema extension keys the host understands on a tool argument: `x-nutria-host-control` (the host
105
134
  supplies the value, for example a state fingerprint). Anything else under `x-nutria-` is host-private.
135
+ A tool with a host-control argument must also return the matching fingerprint in its preview's
136
+ top-level `receipt`; see `reviewable-actions.md` and `assert_receipt_bindings`.
106
137
 
107
138
  ## 6. Hierarchical attribute operations
108
139
 
@@ -0,0 +1,90 @@
1
+ # Capability families
2
+
3
+ **Status: design approved by the owner on 2026-11-28; the validation mechanism is not implemented yet.** Until it
4
+ ships, no manifest can declare a family. This document is the rule book for adding or editing one. Decision record:
5
+ `Host:docs/plans/PLUGINS_DESIGN_REVIEW_2026-11.md` section 3.
6
+
7
+ ## What a family is
8
+
9
+ A family is a shared contract that several provider plugins implement so that a **fixed consumer** can use any of them
10
+ without knowing which provider it is talking to. It fixes:
11
+
12
+ - the verbs (`shipping.shipment.create`, `catalog.product.read`, ...);
13
+ - for each verb, the fields with a fixed meaning and unit (input semantic fields and produced outputs);
14
+ - the effect class, completion basis and the facts a successful execution must report;
15
+ - conformance vectors that every implementer runs.
16
+
17
+ A capability states that it implements a family verb at a major version (`<family>.<verb>@<major>`). The SDK checks
18
+ that its declared inputs and outputs cover the family's required fields with compatible data classes.
19
+
20
+ ## Families and domains
21
+
22
+ A family is the contract of a capability domain, not a second vocabulary. Domains form a tree: closed business roots
23
+ in this SDK (`shipping`, ...) and one provider subdomain declared by each plugin (`shipping.mrw`,
24
+ `shipping.correos`), so the SDK never lists provider names. Domains orient the agent and select context documents; a
25
+ root may additionally carry a family contract. Neither grants authority.
26
+
27
+ There is no provider selector in the Host. A fixed consumer always reaches the provider that owns the resource
28
+ (tracking comes from the carrier that created the shipment). Which provider to use for a new effect is the agent's
29
+ choice, guided by the company's context documents; when they state no preference and the request does not say, the
30
+ agent asks.
31
+
32
+ ## When to create one
33
+
34
+ Only when a **fixed consumer** must read or request something without knowing the provider:
35
+
36
+ | Fixed consumer | Example |
37
+ |---|---|
38
+ | Host code | the widget product card shows price and stock from a deterministic source, never from the model |
39
+ | Host verification | a customer's order lookup compares the billing email and phone of the order |
40
+ | Automation or store rule | "when the shipment is delivered, complete the order", for any carrier |
41
+
42
+ Not reasons on their own:
43
+
44
+ - two providers look alike;
45
+ - "the agent would learn one verb": the agent reads capability descriptions and copes with provider vocabulary;
46
+ - receipt classification: it is already provider-neutral (operation facts and completion basis).
47
+
48
+ If only the agent uses the data, keep provider-specific capabilities.
49
+
50
+ ## Design rules
51
+
52
+ 1. **Narrow.** The family fixes only the fields its consumer needs. Everything else is a provider extension field with
53
+ the provider's own name. No lowest common denominator, no speculative verbs.
54
+ 2. **Taken from reality.** Fields come from at least one real provider response and from existing shared contracts
55
+ (for shipping: the `nutralia-shipping` contracts used by the WooCommerce and Odoo integrations). Never invent them.
56
+ 3. **Contract here, logic elsewhere.** A family is declarative data in this SDK, checked by one generic mechanism that
57
+ knows nothing about shipping, catalogues or orders. Domain logic shared by several plugins (address or package
58
+ normalisation, tracking snapshots) belongs to a domain kit outside the SDK and outside the Host.
59
+ 4. **The Host never names a provider.** A Host consumer asks for "the authorized capability implementing this family
60
+ verb", never for a tool or connection name.
61
+ 5. **Approvals, idempotency and receipts do not change.** A family verb that is an effect follows the normal
62
+ prepared-action path and operation facts.
63
+
64
+ ## Adding a family
65
+
66
+ 1. Write down the fixed consumer and exactly which fields it reads or sends.
67
+ 2. Collect at least one production-shaped provider payload (anonymised) and the existing shared contracts.
68
+ 3. Add the family data, its conformance vectors and an oracle test to this SDK; update the plugin authoring guide.
69
+ 4. Release the SDK.
70
+ 5. Migrate the Host consumer to the family, with a test through the real family dispatch.
71
+ 6. Release the plugins that implement it; each runs the conformance vectors in its own CI.
72
+
73
+ ## Editing a family
74
+
75
+ | Change | Version |
76
+ |---|---|
77
+ | Add an optional field, clarify a description without changing meaning | minor |
78
+ | Add a required field, remove or rename a field, change a meaning or unit | new major (`@2`), coexisting with the old one until every implementer and consumer has moved |
79
+
80
+ A change to a plugin's tool arguments invalidates pending previews: announce it in that plugin's changelog.
81
+
82
+ ## Planned families
83
+
84
+ | Family | Fixed consumer | When |
85
+ |---|---|---|
86
+ | `shipping` (create, cancel, tracking with a "delivered" fact, label, confirm where the carrier has it) | shipping automations and store rules | with the Correos plugin; MRW migrates in an announced release |
87
+ | `catalog.product.read` | widget product card | when WooCommerce leaves the Host |
88
+ | `orders.order.read` | customer order verification and status | when WooCommerce leaves the Host |
89
+
90
+ `content`, `reviews`, `search_presence` and `erp` have no family until a fixed consumer appears.
@@ -0,0 +1,89 @@
1
+ # CLI Reference
2
+
3
+ Run `nutria-plugin` from the environment that has the SDK version pinned by the plugin project. The CLI is defined in
4
+ `src/nutria_plugin/cli.py`; source validation and packing are implemented in `src/nutria_plugin/packaging.py`.
5
+
6
+ ## `nutria-plugin new`
7
+
8
+ Create a starter plugin directory:
9
+
10
+ ```bash
11
+ nutria-plugin new <id> [--name <display-name>] [--dir <target-dir>]
12
+ ```
13
+
14
+ `id` is required. `--name` defaults to the ID; `--dir` defaults to a directory named after the ID. The scaffold
15
+ contains a schema 6.0 manifest and creates the component directories. Its starter manifest declares
16
+ `declarative_api`; for a packaged MCP plugin, change `runtime_types` and add the server and connection file. The
17
+ scaffold command fails if the target directory already exists.
18
+
19
+ ## `nutria-plugin validate`
20
+
21
+ Validate a source directory without producing a ZIP:
22
+
23
+ ```bash
24
+ nutria-plugin validate [<dir>]
25
+ ```
26
+
27
+ The directory defaults to `.`. Validation checks `plugin.json`, declared admin schema assets, source symlinks and
28
+ allowed file extensions. It does not require a connection file or a skill. It also does not parse skill frontmatter;
29
+ `nutria-plugin pack` validates skill files in the resulting bundle.
30
+
31
+ Exit code `0` means no errors were found; `1` means validation failed.
32
+
33
+ ## `nutria-plugin pack`
34
+
35
+ Validate source files and write a plugin ZIP:
36
+
37
+ ```bash
38
+ nutria-plugin pack [<dir>] [--output <path>] [--key <pem-file>]
39
+ ```
40
+
41
+ The directory defaults to `.`. Without `--output`, the ZIP is named `<plugin-id>-<version>.zip` in the current
42
+ directory. `--output` also has the short form `-o`. `--key` signs the manifest before packing and updates
43
+ `plugin.json` in the source directory.
44
+
45
+ The packer excludes hidden paths, bytecode caches, developer directories (`docs/`, `tests/`, `.github/`, and examples),
46
+ root build files and ZIP files. It also excludes root requirements files and `mcp_server/requirements.txt`, and rejects
47
+ source symlinks or disallowed extensions. The archive is written with DEFLATE compression and then checked by the bundle validator, including its
48
+ manifest, paths, size, extensions and skill frontmatter. Pack outside the source tree when the ZIP would otherwise be
49
+ included in a later build.
50
+
51
+ ## `nutria-plugin sign`
52
+
53
+ Sign a manifest in-place:
54
+
55
+ ```bash
56
+ nutria-plugin sign [<manifest>] --key <pem-file>
57
+ ```
58
+
59
+ The manifest defaults to `plugin.json`. `--key` is required. Signing changes the manifest; it does not create a ZIP.
60
+
61
+ ## `nutria-plugin keygen`
62
+
63
+ Generate an ECDSA P-256 key pair:
64
+
65
+ ```bash
66
+ nutria-plugin keygen [--out <stem>]
67
+ ```
68
+
69
+ The output stem defaults to `nutria-plugin`. The command writes `<stem>.pem` and `<stem>.pub.pem`; the resolved output
70
+ path must be within the current working directory. Keep the private key out of Git.
71
+
72
+ ## `nutria-plugin migrate`
73
+
74
+ Migrate a schema 5.0 manifest to 6.0 and print items that need review:
75
+
76
+ ```bash
77
+ nutria-plugin migrate [<manifest>]
78
+ ```
79
+
80
+ The manifest defaults to `plugin.json`. The command edits that file and removes its old signature. Review the output
81
+ and sign again if needed. Only schema 5.0 manifests can be migrated by this command.
82
+
83
+ ## Exit codes
84
+
85
+ | Code | Meaning |
86
+ |---:|---|
87
+ | `0` | Command succeeded. |
88
+ | `1` | Validation, signing, packaging, or other command error. |
89
+ | `2` | CLI usage error reported by `argparse`. |
@@ -0,0 +1,95 @@
1
+ # Connection Types
2
+
3
+ The SDK validates plugin manifests; it does not validate connection JSON files. The Host loads connection files as
4
+ `SkillConnection` objects and rejects unknown keys (`Host:src/personas/skills/connections.py`). In a plugin,
5
+ `plugin.json` declares `runtime_types`; each connection JSON uses the Host's separate `type` field.
6
+
7
+ ## Tool names
8
+
9
+ The Host prefixes a connection tool as:
10
+
11
+ ```text
12
+ conn_<connection-id>__<tool-name>
13
+ ```
14
+
15
+ The plugin ID is not part of this name. The parser is `Host:src/personas/skills/connections.py::parse_connection_tool_name`.
16
+ Capabilities in `plugin.json` refer to the connection's `id` and the MCP tool's exact name.
17
+
18
+ ## MCP connection
19
+
20
+ Use `type: "mcp"` for an MCP server. The Host discovers MCP tools from `tools/list`; for packaged plugin servers the
21
+ endpoint is `stdio://<file in mcp_server/>`:
22
+
23
+ ```json
24
+ {
25
+ "id": "acme",
26
+ "type": "mcp",
27
+ "name": "Acme",
28
+ "description": "Acme tools through the packaged server.",
29
+ "endpoint": "stdio://server.py",
30
+ "auth": {"type": "none"},
31
+ "tools": []
32
+ }
33
+ ```
34
+
35
+ The Host can also connect an MCP connection to an HTTP(S) endpoint. For a packaged server, the plugin manifest must
36
+ declare `remote_mcp`; runtime parity checks the packaged endpoint and its tools
37
+ (`Host:src/personas/plugins/runtime_parity.py`).
38
+
39
+ ## API connection
40
+
41
+ Use `type: "api"` for explicitly declared HTTP tools. The connection uses `endpoint` as its base URL. Tool parameters
42
+ are a list; each parameter can specify `location` as `auto`, `body`, `query`, `path` or `header`
43
+ (`Host:src/personas/skills/connections.py`).
44
+
45
+ ```json
46
+ {
47
+ "id": "acme-api",
48
+ "type": "api",
49
+ "name": "Acme API",
50
+ "description": "Acme user API.",
51
+ "endpoint": "https://api.example.com",
52
+ "auth": {"type": "api_key", "env_var": "ACME_API_KEY", "header": "X-API-Key"},
53
+ "tools": [
54
+ {
55
+ "name": "get_user",
56
+ "description": "Read one user by ID.",
57
+ "method": "GET",
58
+ "path": "/v1/users/{user_id}",
59
+ "authority_level": "read",
60
+ "parameters": [
61
+ {"name": "user_id", "type": "string", "description": "User ID.",
62
+ "required": true, "location": "path"}
63
+ ]
64
+ }
65
+ ]
66
+ }
67
+ ```
68
+
69
+ The Host's `AuthConfig` uses environment-variable names such as `env_var` and `username_env_var`; it does not use a
70
+ `secret` field. Authentication options and supported fields depend on the selected Host transport
71
+ (`Host:src/personas/skills/connections.py`, `Host:src/ai/tools/mcp/generic_api_client.py`).
72
+
73
+ ## SOAP connection
74
+
75
+ Use `type: "soap"` for a SOAP connection. Its `soap` object requires `target_namespace` and version `"1.1"` or
76
+ `"1.2"` (`Host:src/personas/skills/connections.py`). The Host can generate SOAP connections from plugin WSDL files
77
+ when `plugin.json` declares `soap_bridge` in `runtime_types` (`Host:src/personas/plugins/soap_bridge.py`).
78
+
79
+ ## Generated bridge connections
80
+
81
+ `openapi_bridge` and `soap_bridge` are values of the plugin manifest's `runtime_types`, not connection `type` values.
82
+ The Host generates `api` or `soap` connections from files under `specs/`; the generated ID is
83
+ `<plugin-directory>--<spec-stem>` (`Host:src/personas/plugins/openapi_bridge.py`,
84
+ `Host:src/personas/plugins/soap_bridge.py`).
85
+
86
+ ## Capability effects
87
+
88
+ Every capability declares its effect and requirements in `plugin.json`. A connection file does not grant authority or
89
+ control approval.
90
+
91
+ | Effect | Description |
92
+ |---|---|
93
+ | `read` | Read-only query with no external business mutation. |
94
+ | `write` | Local or internal mutation under Host authority. |
95
+ | `external_write` | External business effect governed by the capability contract. |
@@ -1,13 +1,15 @@
1
1
  # nutria-plugin SDK documentation
2
2
 
3
- Developer reference for SDK `0.7.0` and manifest schema `6.0`.
3
+ Developer reference for SDK `0.8.0` and manifest schema `6.0`.
4
4
 
5
5
  | Document | Purpose |
6
6
  |---|---|
7
+ | [plugin-authoring/](plugin-authoring/README.md) | Start here: end-to-end guide, plugin inventory and briefs |
7
8
  | [quickstart.md](quickstart.md) | Build a strict schema 6.0 plugin |
8
9
  | [migration-6.0.md](migration-6.0.md) | Migrate a 5.0 plugin to 6.0 |
9
10
  | [manifest.md](manifest.md) | Manifest, capability, and provider contracts |
10
11
  | [capability-authoring.md](capability-authoring.md) | Effect scope, completion, operation facts, data classes, PreparedActions, validation errors |
12
+ | [capability-families.md](capability-families.md) | When and how to create or edit a shared contract several providers implement |
11
13
  | [outside-audience.md](outside-audience.md) | Capabilities offered to an outside audience, scoped to the conversation contact |
12
14
  | [reviewable-actions.md](reviewable-actions.md) | Host-owned drafts and external delivery |
13
15
  | [python-api.md](python-api.md) | Public Python API |
@@ -1,7 +1,7 @@
1
1
  # plugin.json manifest reference
2
2
 
3
3
  `plugin.json` is the single source of truth for plugin identity, runtime,
4
- capability authority, prepared-action provider defaults, and provider topology. SDK 0.6.2 accepts exactly schema
4
+ capability authority, prepared-action provider defaults, and provider topology. SDK 0.9.0 accepts exactly schema
5
5
  `6.0`; older schemas and unknown fields fail validation.
6
6
 
7
7
  ## Required top-level fields
@@ -137,6 +137,24 @@ Capability connections must have a matching provider connection. Referenced
137
137
  search, inspect, health, prepare, and execute capabilities must exist in the
138
138
  same manifest.
139
139
 
140
+ ## Artifact bindings
141
+
142
+ A `kind: resource` input with `resource_type: artifact` is a plain World reference unless it declares
143
+ `input.artifact`. With it, file bytes travel: an `ArtifactSpec` with a non-empty `media_types` list, `max_bytes` between 1 and
144
+ `MAX_ARTIFACT_BYTES` (25 MiB), and `delivery: inline_base64`. `media_types` accepts exact MIME types
145
+ such as `application/pdf` or major wildcards such as `image/*`. A spec on any other input fails
146
+ validation.
147
+
148
+ The model supplies only an artifact reference. The Host resolves it in the authorized turn and gives
149
+ the plugin `{artifact_ref, sha256, media_type, byte_size, name, content_base64}` at preview and
150
+ execution. Prepared action arguments store the same descriptor without `content_base64`. Preview
151
+ conformance compares descriptors and rejects content in frozen arguments.
152
+
153
+ An output with `resource_type: artifact` and `output.artifact` (the same `ArtifactSpec`) contains
154
+ `{name, media_type, byte_size, sha256, content_base64}`; `many: true` contains a list. The result
155
+ validator strictly decodes base64 and checks media type, maximum size, byte size and SHA-256. Without
156
+ `output.artifact` an artifact output is a plain reference and carries no bytes.
157
+
140
158
  ## Reviewable actions
141
159
 
142
160
  The host owns the encrypted draft and approval lifecycle. A reviewable action
@@ -3,13 +3,22 @@
3
3
  An agent that answers a person outside the company works in a `public_customer` turn. A capability is offered to that
4
4
  audience only if its manifest says so (`requirements.audience` contains `public_customer`). Most capabilities are not.
5
5
 
6
+ ## Audience vocabulary
7
+
8
+ `requirements.audience` accepts exactly `public_customer`, `private_internal`, and `team_internal`. The SDK rejects any
9
+ other value; the Host uses the same closed vocabulary.
10
+
6
11
  ## The rule
7
12
 
8
13
  A capability offered to `public_customer`:
9
14
 
10
15
  - is a **read** (`effect: read`); writes and sends go through the host's own approval path;
11
16
  - takes **no person-identifying input** (`data_class: personal_identifier`) except the one scoped to the conversation contact;
12
- - if it returns `personal_content` or `special_category` data, **must scope an input to the conversation contact**.
17
+ - if it returns `personal_identifier`, `personal_content`, or `special_category` data, **must scope an input to the
18
+ conversation contact**. Those three classes are private outputs.
19
+
20
+ A capability **not** offered to `public_customer` must not declare `scope: "conversation_contact"`: the scope exists only
21
+ to pin an outside-audience turn.
13
22
 
14
23
  ## Scoping an input
15
24