@cratis/pi 7.153.5 → 7.153.7

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 (18) hide show
  1. package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +1 -0
  2. package/package/corpus/rules/profiles.md +1 -0
  3. package/package/corpus/skills/cratis-environments-and-secrets/SKILL.md +24 -0
  4. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +3 -0
  5. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/statemachines-and-workflows.md +9 -9
  6. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/systems-and-abilities.md +143 -0
  7. package/package/corpus/skills/cratis-screenplay-extension-packages/SKILL.md +62 -0
  8. package/package/corpus/skills/cratis-screenplay-extension-packages/verification.json +13 -0
  9. package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +3 -1
  10. package/package/corpus/skills/cratis-screenplay-specifications/references/ability-answers.md +12 -0
  11. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +2 -0
  12. package/package/corpus/skills/cratis-screenplay-toolchain/references/neighbouring-skills.md +1 -0
  13. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +43871 -30547
  14. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
  15. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +2 -0
  16. package/package/corpus/skills/cratis-screenplay-ui-composition/references/extension-components.md +19 -0
  17. package/package/profile-catalog.json +1 -0
  18. package/package.json +1 -1
@@ -311,6 +311,7 @@ and one phase skill, then the construct skill needed for syntax.
311
311
  | `cratis-screenplay-ui-composition` | `layout`, templates, `form`, `contribute`, `ui profile`, `theme`, `$strings`, `file` |
312
312
  | `cratis-screenplay-captures-and-reactions` | The Change Data Capture Language, `reaction`, `trigger` |
313
313
  | `cratis-screenplay-authentication-and-onboarding` | `authentication`, `onboarding`, and the environment keys derived from them |
314
+ | `cratis-screenplay-extension-packages` | Authoring, verifying, locking and restoring extension packages that realize a `system` |
314
315
  | `cratis-screenplay-specifications` | Given/when/then and the reference execution |
315
316
  | `cratis-screenplay-model-authoring` | Typed MCP authoring, model navigation/refactoring, compiler diagnostics, and source-versus-executable readiness |
316
317
 
@@ -310,6 +310,7 @@ and one phase skill, then the construct skill needed for syntax.
310
310
  | `cratis-screenplay-ui-composition` | `layout`, templates, `form`, `contribute`, `ui profile`, `theme`, `$strings`, `file` |
311
311
  | `cratis-screenplay-captures-and-reactions` | The Change Data Capture Language, `reaction`, `trigger` |
312
312
  | `cratis-screenplay-authentication-and-onboarding` | `authentication`, `onboarding`, and the environment keys derived from them |
313
+ | `cratis-screenplay-extension-packages` | Authoring, verifying, locking and restoring extension packages that realize a `system` |
313
314
  | `cratis-screenplay-specifications` | Given/when/then and the reference execution |
314
315
  | `cratis-screenplay-model-authoring` | Typed MCP authoring, model navigation/refactoring, compiler diagnostics, and source-versus-executable readiness |
315
316
 
@@ -73,6 +73,30 @@ cratis config --missing ./model # keys the model needs and the environm
73
73
  All accept `-o json`. Exit codes: `0` success, `1` not found, `4` authentication failed (wrong
74
74
  passphrase), `5` validation, including any key missing under `--missing`.
75
75
 
76
+ ## Extension settings and secrets
77
+
78
+ A Screenplay system realized by an extension needs values that belong to the environment, not the model. The model says where each value comes from; the environment holds the value. Never put a value in the model, the lock or a brief.
79
+
80
+ | The model says | Environment key | Kind |
81
+ |---|---|---|
82
+ | Nothing about a setting the extension's contract declares | `systems.<System>.<setting>` | Secret when the contract declares the setting `secret`, otherwise plain |
83
+ | `secret <Name>`, used by `setting <name> from secret <Name>` | `secrets.<Name>` | Always a secret; one value for every system that maps it |
84
+ | `setting <name> = <literal>` (non-secret settings only) | `systems.<System>.<name>` | Optional; the environment value overrides the literal |
85
+
86
+ ```bash
87
+ cratis config --requires ./model # keys, kind (setting or secret), set or missing; never prints a value
88
+ cratis config set secrets.StripeKey # always stored as a secret; stdin or hidden prompt
89
+ cratis config set systems.Payments.accountId acct_123
90
+ cratis run ./model -e development
91
+ ```
92
+
93
+ - A key under `secrets.` is stored as a secret with or without `--secret` and is never read from an argument.
94
+ - `--requires` exits `5` while any key is missing, and when an extension is not restored, because its contract's settings cannot be known. `--missing` remains the narrower check.
95
+ - `activation always` or `activation on demand [idle after <n> <unit>]` on the system overrides the extension contract's default; neither is an environment key.
96
+ - A literal on a `secret` setting, an unknown setting, an unused secret and a duplicate mapping are errors (`PLAY0990` to `PLAY0997`).
97
+ - Registry credentials for private extension packages are environment keys too: `extensions.registry.<host>.token`, or `.username` with `.password`, set as secrets. See [extension packages](../cratis-screenplay-extension-packages/SKILL.md).
98
+ - `cratis run` hands the Stage the settings and secrets of the admitted extensions; read the CLI environments and `run` pages for details rather than assuming.
99
+
76
100
  ## Choosing a secrets provider
77
101
 
78
102
  Default to **passphrase** for a project with one team and a committed environment file. Choose a
@@ -32,6 +32,9 @@ pending-work contracts when changing each reaction/capture, not at final review.
32
32
  a refused construct. Run `screenplay test` or MCP `run-specifications` for V4.
33
33
  - Read [realization and gap-fill](references/realization-and-gap-fill.md) before
34
34
  promising Automation/Translate delivery (STAGE-ESM-024).
35
+ - Read [systems and abilities](references/systems-and-abilities.md) before
36
+ declaring an external `system` or `ability`, choosing its effect class, or
37
+ writing `invokes`/`starts` (never the deprecated `sends`, `send`, `start`).
35
38
  - Invokes have no caller without `runs as`. Read captures-and-reactions
36
39
  [invocation identity](../cratis-screenplay-captures-and-reactions/references/invocation-identity.md)
37
40
  for the ESM v10 actor and role/authenticated versus claim/opaque admission.
@@ -89,7 +89,7 @@ statemachine InvoiceLifecycle
89
89
  on InvoiceMarkedOverdue -> Overdue
90
90
  on InvoicePaid -> Paid
91
91
  state Overdue
92
- entering start CollectOverdue
92
+ entering starts CollectOverdue
93
93
  on InvoicePaid -> Paid
94
94
  on InvoiceWrittenOff -> WrittenOff
95
95
  state Paid final
@@ -108,13 +108,13 @@ workflow CollectOverdue
108
108
  for Invoice
109
109
  trigger when InvoiceLifecycle enters Overdue
110
110
  -> Remind
111
- action Remind sends SendReminder
111
+ action Remind invokes SendReminder
112
112
  next -> AwaitPayment
113
113
  wait AwaitPayment for InvoicePaid expires after 14 days
114
114
  expired -> ApproveWriteOff
115
115
  approval ApproveWriteOff by FinanceController expires after 7 days
116
116
  approved -> WriteOff
117
- action WriteOff sends WriteOffInvoice
117
+ action WriteOff invokes WriteOffInvoice
118
118
 
119
119
  specification AnUnpaidInvoiceIsWrittenOff
120
120
  given InvoiceSent
@@ -123,8 +123,8 @@ workflow CollectOverdue
123
123
  for "9c858901-8a57-4791-81fe-4c455b099bc9"
124
124
  outcome AwaitPayment expired
125
125
  outcome ApproveWriteOff approved
126
- then sends SendReminder
127
- then sends WriteOffInvoice
126
+ then invokes SendReminder
127
+ then invokes WriteOffInvoice
128
128
  then completes
129
129
 
130
130
  specification TheRunWaitsForPayment
@@ -132,7 +132,7 @@ workflow CollectOverdue
132
132
  for "9c858901-8a57-4791-81fe-4c455b099bc9"
133
133
  when append InvoiceMarkedOverdue
134
134
  for "9c858901-8a57-4791-81fe-4c455b099bc9"
135
- then sends SendReminder
135
+ then invokes SendReminder
136
136
  then waits at AwaitPayment
137
137
  ```
138
138
 
@@ -143,7 +143,7 @@ workflow CollectOverdue
143
143
  transition on it, in declaration order across the whole machine, whose condition holds and
144
144
  whose target the current state allows. Anything else is ignored, not an error.
145
145
  - Workflow nodes: `trigger` (`on <Event>`, `when <StateMachine> enters <State>`, `every`,
146
- `at`, `manual`), `action <Name> sends <Command> [attempts n] [timeout] [retry after]`,
146
+ `at`, `manual`), `action <Name> invokes <Command> [attempts n] [timeout] [retry after]`,
147
147
  `decide <Name> when <condition>` with exactly two outlets, `wait` for an event or a
148
148
  duration, `approval <Name> by <Persona or Policy>`, `foreach <Name> over <collection>` and
149
149
  `join all|any|at least n`. Edges are `<outlet> -> <Node>` under their node; a workflow
@@ -156,8 +156,8 @@ workflow CollectOverdue
156
156
 
157
157
  | Construct | Lines |
158
158
  | --- | --- |
159
- | `statemachine` | `given <Event>`, `when append <Event>`, `then is <State>`, `then sends <Command>`, `then starts <Workflow>` (every command and workflow, in order) |
160
- | `workflow` | `given <Event>`, `when append <Event>` or `when start <key>`, `outcome <Node> <outlet>`, `then sends <Command>` (every one, in order), `then completes`, `then fails at <Node>`, `then waits at <Node>` |
159
+ | `statemachine` | `given <Event>`, `when append <Event>`, `then is <State>`, `then invokes <Command>`, `then starts <Workflow>` (every command and workflow, in order) |
160
+ | `workflow` | `given <Event>`, `when append <Event>` or `when start <key>`, `outcome <Node> <outlet>`, `then invokes <Command>` (every one, in order), `then completes`, `then fails at <Node>`, `then waits at <Node>` |
161
161
 
162
162
  The reference evaluator steps the run deterministically. A wait or approval with no stated
163
163
  `outcome` suspends the run (`then waits at`); an action defaults to `next`; a wait for a
@@ -0,0 +1,143 @@
1
+ # Systems and abilities
2
+
3
+ ## Contents
4
+
5
+ - Code computes, abilities touch the world
6
+ - Declare a system
7
+ - Effect classes
8
+ - Inputs, returns and outcomes
9
+ - Answers that arrive later
10
+ - Implementation
11
+ - The one `invokes` verb
12
+ - Invoke an ability
13
+ - Realize a system with an extension
14
+ - What is admitted and what is not
15
+
16
+ ## Code computes, abilities touch the world
17
+
18
+ A model reaches something outside itself (a carrier, a ledger, a chat tool) through a `system` with `ability` declarations, not through an invented command or a free-text effect. Pure computation stays in code; anything with an external effect is an ability whose retry behavior, returned values and refusals are declared and therefore checkable. Record what an ability returned as a fact only through an event the model `produces`; an ability's result is never a fact by itself.
19
+
20
+ ## Declare a system
21
+
22
+ ```screenplay
23
+ concept ParcelId : Uuid
24
+ concept TrackingNumber : String
25
+
26
+ type Address
27
+ street String
28
+ postalCode String
29
+
30
+ system Carrier
31
+ description "The parcel carrier's booking service"
32
+ ability BookPickup idempotent
33
+ description "Books a pickup for one parcel"
34
+ parcelId ParcelId
35
+ address Address
36
+ returns
37
+ trackingNumber TrackingNumber
38
+ pickupAt DateTime
39
+ outcome NoCapacity
40
+ description "No pickup slot on the requested day"
41
+ ability Quote safe
42
+ address Address
43
+ returns
44
+ price Decimal
45
+ ```
46
+
47
+ - A `system` belongs to the application, also when its file is imported into a module or feature. It names the business system, not a provider interface; an extension or implementation owns how.
48
+ - Everything under `ability` is optional and in any order: `description`, typed inputs, `returns`, `outcome`, `answers later`, `implementation`. Ability names are unique within a system, ignoring case (`PLAY0983`).
49
+ - Declaring an ability selects ESM v50; models without one keep their bytes and version.
50
+
51
+ ## Effect classes
52
+
53
+ Write the class after the ability name. It says what a retry may do when an attempt's outcome is unknown.
54
+
55
+ | Class | Meaning | Unknown outcome |
56
+ | --- | --- | --- |
57
+ | `safe` | No external effect, such as a lookup | Retry freely |
58
+ | `idempotent` | Same idempotency key has the effect once | Retry with the same key |
59
+ | `once` | A repeat may repeat the effect | Never retry; stop for reconciliation |
60
+
61
+ `once` is the default because it is never wrong. Do not mark an ability `idempotent` unless the system really deduplicates. Any other class is `PLAY0984`.
62
+
63
+ ## Inputs, returns and outcomes
64
+
65
+ - Inputs use the operation-input grammar: concepts, enums, composite types, collections, `optional`. Not `identifier` or `generated`, no subject modifier. A keyword-named input is written with `@` (`@outcome String`).
66
+ - `returns` holds at least one typed field; an ability without it returns nothing. Every type must be declared (`PLAY0986`).
67
+ - An `outcome <Name>` is a business result other than success, the external counterpart of a command refusal. It has a name and description, no payload. It cannot be named `next`, `refused`, `failed`, `returned` or `expired` (`PLAY0985`); those are invocation outlets.
68
+
69
+ ## Answers that arrive later
70
+
71
+ `answers later` marks an ability whose answer arrives after the invocation returns (a person approves in chat, a partner confirms by webhook). Workflows and `approval ... via` use these.
72
+
73
+ ## Implementation
74
+
75
+ An ability owns at most one `file` or tagged fence, directly or in an `implementation` wrapper (`PLAY0494` when combined). Its result is exactly one of: values matching `returns`, a declared outcome, or a failure. A hints-only block is intent and leaves the ability unrealized.
76
+
77
+ ## The one `invokes` verb
78
+
79
+ `invokes` is the single verb for asking a command to run. The old forms still compile with deprecation `PLAY0397` and a repair; never author them.
80
+
81
+ | Before | After |
82
+ | --- | --- |
83
+ | `entering send <Command>` | `entering invokes <Command>` |
84
+ | `entering start <Workflow>` | `entering starts <Workflow>` |
85
+ | `then sends <Command>` | `then invokes <Command>` |
86
+ | `action <Name> sends <Command>` | `action <Name> invokes <Command>` |
87
+
88
+ ## Invoke an ability
89
+
90
+ A reaction, a workflow action and a state's `entering` line ask a system for an ability with `invokes <System>.<Ability>`; the dotted name is what tells an ability from a command. Map every declared input exactly once with a compatible value (`PLAY1003`, `PLAY1004`, `PLAY1005`); the system and ability must exist (`PLAY1001`). The answer is handled where the call is made:
91
+
92
+ ```play
93
+ reaction PickupBooking
94
+ runs as system
95
+ when OrderPacked
96
+ parcelId
97
+ shippingAddress
98
+ invokes Carrier.BookPickup
99
+ parcelId = parcelId
100
+ address = shippingAddress
101
+ on returned
102
+ produces PickupBooked
103
+ trackingNumber = $result.trackingNumber
104
+ on NoCapacity
105
+ produces PickupUnavailable
106
+ on failed
107
+ produces PickupBookingFailed
108
+ reason = $failure.reason
109
+ ```
110
+
111
+ - `on returned` reads `$result.<field>` from the ability's `returns`; `on failed` reads `$failure.reason`; `on <Outcome>` handles a declared outcome (`PLAY1002` when undeclared). A branch is declared once (`PLAY1006`); reading a branch value outside its branch is `PLAY1008`. The result becomes a fact only through the `produces` the model writes.
112
+ - Workflow action: `action BookPickup invokes Carrier.BookPickup attempts 3`, inputs on the lines under it (a literal, a property of the workflow's subject or an earlier node's result as `Node.field`), then edges `next -> ...`, `failed -> ...` and one edge per declared outcome. An outlet that can never be taken, such as `expired` on an ability that does not answer later, is `PLAY1007`. A node may only read the result of a node that always ran before it (`PLAY1009`).
113
+ - State machine: `entering invokes <System>.<Ability>` with inputs mapped below. `entering` may run again on redelivery, so the ability should be `safe` or `idempotent`. A state machine holds nothing to wait with, so an `answers later` ability there is `PLAY1011`; a reaction cannot invoke one either (`PLAY1010`).
114
+ - A `once` ability is never retried; `attempts` above one on its call site is the warning `PLAY1015`.
115
+ - Specifications script the answer with `given <System>.<Ability> returns` (with the returned fields), `given <System>.<Ability> answers <Outcome>` or `given <System>.<Ability> fails "<reason>"`, and assert the call with `then invokes <System>.<Ability>`. Naming an ability, outcome or field the system does not declare is `PLAY1017`. See [specifications](../../cratis-screenplay-specifications/SKILL.md).
116
+ - Operations in an Arc command can invoke abilities too (`invokes <System>.<Ability>` in an operation phase; Arc's `ISystemAbilities`); see Arc's command-operations page on abilities and the Screenplay operations page.
117
+
118
+ Invoking an ability selects ESM v51. Models that invoke none keep their bytes and version. Take the call's name, inputs and branch names from the page, never from memory.
119
+
120
+ ## Realize a system with an extension
121
+
122
+ A system is realized either by code attached to its abilities (see Implementation) or by an extension package. Name the package on the system and map its settings:
123
+
124
+ ```play
125
+ secret MailerApiKey
126
+ description "The API key of the transactional mail service"
127
+
128
+ system Mailer
129
+ extension "ghcr.io/cratis/extension-mail" version 2
130
+ setting apiKey from secret MailerApiKey
131
+ setting senderName = "Invoicing"
132
+ activation on demand idle after 10 minutes
133
+ ```
134
+
135
+ - A system that names an extension declares no abilities of its own (`PLAY1106`); it receives the contract's abilities, and the contract's triggers become application triggers a reaction uses as `when Payments.PaymentSucceeded`.
136
+ - `extension`, `setting` and `activation` are realization metadata: they change no bytes of the executable model.
137
+ - The contract, `screenplay.lock` and restore are in [extension packages](../../cratis-screenplay-extension-packages/SKILL.md); settings, named secrets and the environment keys are in [environments and secrets](../../cratis-environments-and-secrets/SKILL.md).
138
+
139
+ ## What is admitted and what is not
140
+
141
+ According to the Screenplay documentation, these parse, print and validate but are not admitted yet, and binding reports `PLAY0268` naming Screenplay#1252: ability invocations in operation phases, an approval answered through an ability (`approval <Name> by <Policy> via <System>.<Ability> expires after 2 days`), `compute <Name>` nodes with `returns` fields and a C# body, a `$trigger` value, a `decide` that reads an ability or compute result, and a bare `entering` followed by a C# fence or `file` body. Author them when the model needs them, but report them as authored, not executable, and recheck the pages for the installed Screenplay version before claiming otherwise. Stage lists what it renders and runs in its [ESM feature matrix](https://github.com/Cratis/Stage/blob/main/Documentation/reference/esm-feature-matrix.md).
142
+
143
+ Read Screenplay's [systems and abilities](https://github.com/Cratis/Screenplay/blob/main/Documentation/screenplay/systems.md) page and [decision 0159](https://github.com/Cratis/Screenplay/blob/main/decisions/0159-systems-with-abilities-extensions-and-durable-invocations.md) for the contract.
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: cratis-screenplay-extension-packages
3
+ description: Use when authoring, verifying, publishing or consuming a Cratis extension package that realizes a Screenplay system, including its contract, lock, restore, settings and components. Not for declaring a system's abilities in a model or invoking them; use cratis-screenplay-automations-and-translations.
4
+ license: MIT
5
+ ---
6
+
7
+ # Building and consuming extension packages
8
+
9
+ An **extension package** is the code and contract that realizes a Screenplay `system`. The model names what the business can ask (abilities, triggers, components); the package carries how. Do not invent package behavior: the contract below is the Screenplay documentation, and the tooling is the Cratis CLI. If a fact is not on a linked page, say so instead of guessing.
10
+
11
+ ## Pages to read first
12
+
13
+ - Screenplay [extension contracts](https://github.com/Cratis/Screenplay/blob/main/Documentation/screenplay/extension-contracts.md): the contract file, manifest, settings, components, the `extension` reference, the lock, the cache and restore, provider compatibility.
14
+ - Screenplay [systems and abilities](https://github.com/Cratis/Screenplay/blob/main/Documentation/screenplay/systems.md) and [environments](https://github.com/Cratis/Screenplay/blob/main/Documentation/screenplay/environments.md#system-settings-and-named-secrets).
15
+ - Screenplay [screens: extension components](https://github.com/Cratis/Screenplay/blob/main/Documentation/screenplay/screens.md#extension-components) and the [command line `restore`](https://github.com/Cratis/Screenplay/blob/main/Documentation/screenplay/tool.md#restore-extensions).
16
+ - Stage [extension backends](https://github.com/Cratis/Stage/blob/main/Documentation/extensions/index.md) (protocol, SDKs for C#, Kotlin, Go and TypeScript, host services), [packages](https://github.com/Cratis/Stage/blob/main/Documentation/extensions/packages.md) and [execution tiers and activation](https://github.com/Cratis/Stage/blob/main/Documentation/extensions/execution-tiers.md).
17
+ - Scene [extension component contract](https://github.com/Cratis/Scene/blob/main/Documentation/extensions/contract.md): how a frontend component registers and what conformance checks.
18
+ - Cratis CLI [manage extension packages](https://github.com/Cratis/cli/blob/main/Documentation/reference/extension.md), [`extension new`](https://github.com/Cratis/cli/blob/main/Documentation/reference/extension-new.md), [`extension verify`](https://github.com/Cratis/cli/blob/main/Documentation/reference/extension-verify.md), [`restore`](https://github.com/Cratis/cli/blob/main/Documentation/reference/extension-restore.md), [`update`](https://github.com/Cratis/cli/blob/main/Documentation/reference/extension-update.md) and [`vendor`](https://github.com/Cratis/cli/blob/main/Documentation/reference/extension-vendor.md).
19
+
20
+ ## Author a package
21
+
22
+ 1. **Scaffold, do not hand-roll.** `cratis extension new -n <Name> [--kind extension|package] [--backend csharp|kotlin|go|typescript|none] [--frontend react|mount|screenplay|none] [--component react|mount] [--publisher <name>]`. The result already has a `contract.play`, builds and passes `cratis extension verify` without edits. In an AI agent or with redirected output it never prompts; it uses flags and defaults. `--dry-run` lists files without writing. The templates are `Cratis.Templates.Extensions` (`cratis-extension`, `cratis-extension-package`) from Cratis/Templates.
23
+ 2. **Choose the kind.** `extension` is an OCI artifact (contract, optional backend, optional frontend). `package` is an npm package with frontend components only and no backend. An extension with neither backend nor frontend that only declares abilities is valid.
24
+ 3. **Write the contract** (`contract.play`): a manifest (`display name`, `description`, `icon` required, else `PLAY0999`; `image`, `requires stage|screenplay|platform|runtime`, `activation`), then `setting`, `ability` (same grammar as [systems](../cratis-screenplay-automations-and-translations/references/systems-and-abilities.md)), `trigger`, `component` and `backend runtime <name> <version> assembly "<file>"` / `frontend "<path>"`. Contents are read from their declarations; never restate them in the manifest. Types resolve in the consuming model's scope.
25
+ 4. **Settings.** `setting <name> [public | secret]`. `public` may reach a browser; `secret` never does; both is `PLAY1103`; neither stays with the backend.
26
+ 5. **Components.** `kind react | mount | screenplay` (else `PLAY1100`), `platform`, `placeholder "<path>"` (required for `react` and `mount`, `PLAY1102`), typed `property` lines, `raises <signal>` with typed values, and `invokes <Ability>` for abilities the component may call through the host (must be declared, `PLAY1104`). A placeholder is static HTML: no script, inline event handler, `javascript:` URL or external reference, styles inline and images as `data:` URIs (`PLAY1113`).
27
+ 6. **Backend.** Stage hosts backends outside its own process over a two-way gRPC protocol; the backend asks Stage for settings, secrets and telemetry through host services. Tier is chosen by Stage (`None`, `SharedHost`, `Native`, `Container`) from the contract's runtime. A backend is told its address, system and package digest by `STAGE_EXTENSION_*` environment variables. Read the Stage SDK page for the language chosen.
28
+ 7. **Frontend.** A frontend component registers as its declared kind and must pass the Scene conformance kit; use the Scene contract page, not memory.
29
+ 8. **Same name twice** (abilities, triggers, components, settings, ignoring case) is `PLAY1105`; anything else unrecognized in the file is `PLAY0998`.
30
+
31
+ A `.extensionignore` in the package folder names what the build does not ship (sources, specifications, scripts) so verify can tell it from what ships.
32
+
33
+ ## Verify before publishing
34
+
35
+ `cratis extension verify [TARGET] [--range <r>] [--baseline <folder>] [--strict] [--format table|json]`. TARGET is a package folder (default current directory), a `contract.play`, or a package reference. Checks always appear with a status: `passed`, `failed`, `skipped` (could not run; never a pass; `--strict` fails it) or `notapplicable`. The checks are `contract`, `manifest`, `contents`, `placeholders`, `frontend` and `backend`. The `frontend` and `backend` checks report `EXTV060` and `EXTV070` where they cannot run yet; read what the CLI page says does not run yet and report that honestly, never as green.
36
+
37
+ ## Consume a package from a model
38
+
39
+ ```play
40
+ system Payments
41
+ extension "cratis/stripe" version 2
42
+ setting secretKey from secret StripeSecretKey
43
+ ```
44
+
45
+ - A system that names an extension declares no abilities of its own (`PLAY1106`); it gets the contract's abilities, and the contract's triggers become `<System>.<Trigger>` for reactions.
46
+ - A reference is a catalog short name (`owner/name` resolves to `ghcr.io/owner/extension-name`), a full OCI reference, or `npm:<package>` for frontend-only packages. `version 2` is the latest 2.x, `2.3.1` exactly, `"^2.3"` and `"~2.3"` as in semver.
47
+ - **The lock.** `screenplay.lock` beside the model root pins each reference (range, resolved reference, version, package `digest`, `contract` hash, `publisher`). Commit it. The compiler never resolves a range; it reads the contract by locked digest from the vendored `extensions` folder, then the user cache (`SCREENPLAY_EXTENSION_CACHE`). Unlocked is `PLAY1107`, range mismatch `PLAY1110`, not restored `PLAY1108`, contract differs from the hash `PLAY1109`, malformed lock `PLAY1111`. The language server and MCP downgrade some to warnings and restore on opening a model root.
48
+ - **Restore, update, vendor.** `cratis extension restore` fills the cache from the lock and pins what is missing; `cratis extension update` moves references to the newest release in range and shows how each contract changes; `cratis extension vendor` copies every locked package to a folder or private registry for offline use. `--locked` is for CI and never pins. Shared options: `--root`, `--source <folder|oci://host/prefix>`, `-e <environment>`, `-o <format>`. `screenplay restore` in the Screenplay tool restores from a directory without network.
49
+ - **Trust.** Naming a package is not trusting it. The CLI requires a valid signature for exactly the package digest and a publisher in the committed `.cratis/extensions.json` allow-list. An interactive terminal may ask once; CI and AI agents cannot ask and fail `Unallowed`. Never edit the allow-list or accept a publisher to make a command pass without the user's say; a changed key is reviewed, never auto-trusted.
50
+ - **Exit codes** of the extension commands: `0` ok, `1` not found, `2` registry unreachable, `4` credentials refused or missing, `5` not locked, unallowed, unsigned, mismatched or incompatible.
51
+ - **Registry credentials** live in the selected environment (`extensions.registry.<host>.token` or `.username` and `.password`, as secrets), never in the model or lock. See [environments and secrets](../cratis-environments-and-secrets/SKILL.md).
52
+ - **Swapping providers.** A replacement must offer the same abilities, triggers, components, properties and signals with the same typed shape; mismatches are reported at each use (`PLAY1112`, unknown ability).
53
+
54
+ ## Configure and run
55
+
56
+ Settings, named secrets and activation are set in the model and supplied by the environment; see [environments and secrets](../cratis-environments-and-secrets/SKILL.md). `cratis run <model> -e <environment>` admits the model's locked extensions and hands the Stage their settings and secrets; read the CLI `run` page.
57
+
58
+ ## Boundaries
59
+
60
+ - Declaring a system and invoking its abilities from the model is [automations and translations](../cratis-screenplay-automations-and-translations/SKILL.md).
61
+ - Placing a package component on a screen is [UI composition](../cratis-screenplay-ui-composition/references/extension-components.md).
62
+ - Do not publish, push to a registry or change an allow-list unless the user asked for that effect.
@@ -0,0 +1,13 @@
1
+ {
2
+ "skill": "cratis-screenplay-extension-packages",
3
+ "input": "We want to build a Stripe extension package with a Go backend and a React component, lock it in our model and restore it in CI.",
4
+ "fixtures": [],
5
+ "assertions": [
6
+ { "kind": "skill-contains", "value": "cratis extension new" },
7
+ { "kind": "skill-contains", "value": "cratis extension verify" },
8
+ { "kind": "skill-contains", "value": "`screenplay.lock`" },
9
+ { "kind": "skill-contains", "value": "`--locked` is for CI" },
10
+ { "kind": "skill-contains", "value": "`.cratis/extensions.json`" },
11
+ { "kind": "skill-contains", "value": "PLAY1106" }
12
+ ]
13
+ }
@@ -194,7 +194,9 @@ Read [references/actions-beyond-commands.md](references/actions-beyond-commands.
194
194
  From ESM v6 every action sets reactions off. A specification runs only the slice that declares it: only that slice's reactions, captures and publications run, and `then` events compare the new facts of that slice. A specification whose action is a command goes in the slice that declares the command and states the command's own events. Another slice's event is `PLAY0285` (unreachable): state it in the slice that produces it. An automation states a command it invokes in another slice with `then invokes <Command>` (ESM v34).
195
195
  Read [references/reactions-and-cascades.md](references/reactions-and-cascades.md) when a specification's expected events include what a reaction appends, when a cascade, clock tick or invoked command is involved, or when a compiler reports `PLAY0285` (it holds the "Version skew and `PLAY0285`" section).
196
196
 
197
- A `statemachine` or `workflow` (ESM v36) carries its own specifications with `then is`, `then sends`, `then starts`, `outcome`, `then completes`, `then fails at` and `then waits at`. Read automations-and-translations [state machines and workflows](../cratis-screenplay-automations-and-translations/references/statemachines-and-workflows.md) when specifying either.
197
+ Ability answers (`given <System>.<Ability> returns|answers|fails`): [references/ability-answers.md](references/ability-answers.md).
198
+
199
+ A `statemachine` or `workflow` (ESM v36) carries its own specifications with `then is`, `then invokes`, `then starts`, `outcome`, `then completes`, `then fails at` and `then waits at`. Read automations-and-translations [state machines and workflows](../cratis-screenplay-automations-and-translations/references/statemachines-and-workflows.md) when specifying either.
198
200
 
199
201
  ## Published-event specifications (released ESM v9)
200
202
 
@@ -0,0 +1,12 @@
1
+ # Ability answers and `then invokes`
2
+
3
+ A reaction specification scripts what a system's ability answers while the reaction runs, then asserts the events and the call:
4
+
5
+ ```play
6
+ given Carrier.BookPickup returns
7
+ trackingNumber = "TRK-1"
8
+ given Carrier.BookPickup answers NoCapacity
9
+ given Carrier.BookPickup fails "carrier unavailable"
10
+ ```
11
+
12
+ `returns` gives the returned fields, `answers` names a declared outcome, `fails` supplies the failure reason, and `then invokes <System>.<Ability>` asserts the call. Naming an ability, outcome or returned field the system does not declare is `PLAY1017`. A branch that reads a value the specification did not script is not silently passed. Read the Screenplay [specifications](https://github.com/Cratis/Screenplay/blob/main/Documentation/screenplay/specifications.md#ability-answers) page for the exact rules, and [systems and abilities](../../cratis-screenplay-automations-and-translations/references/systems-and-abilities.md) for the declaration.
@@ -99,6 +99,8 @@ for MCP initialization, source identity and reporting. Without MCP, report
99
99
  version, source identity and any blocking codes; MCP `modelRevision` is semantic,
100
100
  not the source identity.
101
101
 
102
+ A model whose systems name an `extension` also needs `screenplay.lock` and restored contracts: every compile is strict about them (`PLAY1107` not locked, `PLAY1108` not restored, `PLAY1109` contract differs, `PLAY1110` other range, `PLAY1111` malformed lock). Restore with `cratis extension restore` or `screenplay restore [<folder>] [--locked] [--update] [--source <directory>] [--vendor]`; the language server and MCP restore on opening a model root and report warnings until then. See [extension packages](../cratis-screenplay-extension-packages/SKILL.md).
103
+
102
104
  Read [observation comparison](references/observation-comparison.md) when asking whether a running namespace holds what the model declares, or when reading a `conform-namespace` verdict. It differs from model comparison (model versus model) and `conform` (model versus code).
103
105
 
104
106
  PLAY0516 ordering is presentation-only, not execution. For a wildcard-import
@@ -9,6 +9,7 @@ Which skill owns each task next to the toolchain.
9
9
  `cratis-screenplay-specifications`, `cratis-screenplay-ui-composition`.
10
10
  - Sign-in providers, onboarding and the environment keys a model needs: `cratis-screenplay-authentication-and-onboarding`;
11
11
  creating the environment and setting secrets: `cratis-environments-and-secrets`.
12
+ - Extension packages (contract, lock, restore, `cratis extension new` and `verify`): `cratis-screenplay-extension-packages`.
12
13
  - Rendering and gap-fill: `cratis-screenplay-render-and-gap-fill`,
13
14
  `cratis-stage-rendering-and-sandbox`.
14
15
  - Running systems (Chronicle server operations through the `cratis` CLI, with its authorization boundaries): `cratis-chronicle-cli-operations`.