@cratis/pi 7.9.1 → 7.9.3
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/package/corpus/hooks/README.md +16 -14
- package/package/corpus/hooks/scripts/cratis-check-pr.mjs +19 -13
- package/package/corpus/hooks/scripts/cratis-store-mutations.json +1 -1
- package/package/corpus/hooks/settings.template.json +5 -5
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +23 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +25 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +6 -3
- package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +8 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +2 -2
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +3 -2
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +4 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +4 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +4 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +1 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +2 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +3 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +5 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/sources-and-streams.md +29 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +6 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +4 -1
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +5 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +3 -1
- package/package.json +1 -1
|
@@ -18,7 +18,9 @@ Three layers:
|
|
|
18
18
|
The Claude Code wiring that fires them is tracked here, in
|
|
19
19
|
[`settings.template.json`](./settings.template.json). Claude reads `.claude/settings.json`. In a
|
|
20
20
|
repository set up with `cratis ai install`, that file is a **symlink** to this template and follows
|
|
21
|
-
every `cratis ai update`; there is nothing to copy.
|
|
21
|
+
every `cratis ai update`; there is nothing to copy. The template runs each script through `bash`, so
|
|
22
|
+
a checkout or install that lost the scripts' execute bit still enforces every guard. Where the corpus
|
|
23
|
+
is present without the CLI,
|
|
22
24
|
activate the hooks by copying the template once:
|
|
23
25
|
|
|
24
26
|
```bash
|
|
@@ -498,22 +500,22 @@ pointing them at a repository that *has* the thing under test; where it is absen
|
|
|
498
500
|
# Run from an application checkout; <Module>/<Feature>/<Slice> is the layout general.md documents.
|
|
499
501
|
jq -nc '{session_id:"t", cwd:"'"$PWD"'", tool_name:"Edit",
|
|
500
502
|
tool_input:{file_path:"'"$PWD"'/Source/<Module>/<Feature>/<Slice>/<Slice>.cs"}}' \
|
|
501
|
-
| .cratis/ai/hooks/scripts/cratis-pattern-scan.sh; echo "exit=$?"
|
|
503
|
+
| bash .cratis/ai/hooks/scripts/cratis-pattern-scan.sh; echo "exit=$?"
|
|
502
504
|
|
|
503
505
|
# Hard block — expect exit 2
|
|
504
506
|
jq -nc '{session_id:"t", cwd:"'"$PWD"'", tool_name:"Edit",
|
|
505
507
|
tool_input:{file_path:"'"$PWD"'/Directory.Packages.props", new_string:"x"}}' \
|
|
506
|
-
| .cratis/ai/hooks/scripts/cratis-guard-writes.sh; echo "exit=$?"
|
|
508
|
+
| bash .cratis/ai/hooks/scripts/cratis-guard-writes.sh; echo "exit=$?"
|
|
507
509
|
|
|
508
510
|
# Store-mutation guard, both directions: expect exit 2, then exit 0 for the read-only neighbor
|
|
509
511
|
jq -nc '{tool_name:"Bash", tool_input:{command:"cratis chronicle observers replay my-observer --yes"}}' \
|
|
510
|
-
| .cratis/ai/hooks/scripts/cratis-guard-store-mutations.sh; echo "exit=$?"
|
|
512
|
+
| bash .cratis/ai/hooks/scripts/cratis-guard-store-mutations.sh; echo "exit=$?"
|
|
511
513
|
jq -nc '{tool_name:"Bash", tool_input:{command:"cratis chronicle observers list -o plain"}}' \
|
|
512
|
-
| .cratis/ai/hooks/scripts/cratis-guard-store-mutations.sh; echo "exit=$?"
|
|
514
|
+
| bash .cratis/ai/hooks/scripts/cratis-guard-store-mutations.sh; echo "exit=$?"
|
|
513
515
|
|
|
514
516
|
# Quality gate — show the dispatch plan without running anything
|
|
515
517
|
jq -nc '{session_id:"t", cwd:"'"$PWD"'", stop_hook_active:false}' \
|
|
516
|
-
| CRATIS_HOOKS_GATE_DRYRUN=1 .cratis/ai/hooks/scripts/cratis-quality-gate.sh
|
|
518
|
+
| CRATIS_HOOKS_GATE_DRYRUN=1 bash .cratis/ai/hooks/scripts/cratis-quality-gate.sh
|
|
517
519
|
```
|
|
518
520
|
|
|
519
521
|
The subpath guard takes corpus roots as arguments, so it is testable in both directions without
|
|
@@ -524,10 +526,10 @@ roots. A one-sided test passes vacuously; run both.
|
|
|
524
526
|
# Negative — expect a warning naming the file and line
|
|
525
527
|
mkdir -p /tmp/scratch-corpus
|
|
526
528
|
echo "import x from '@cratis/components/ThisDoesNotExist';" > /tmp/scratch-corpus/drift.md
|
|
527
|
-
.cratis/ai/hooks/scripts/validate-package-subpaths.sh .cratis/ai/rules /tmp/scratch-corpus
|
|
529
|
+
bash .cratis/ai/hooks/scripts/validate-package-subpaths.sh .cratis/ai/rules /tmp/scratch-corpus
|
|
528
530
|
|
|
529
531
|
# Positive — expect silence, and the report to show every real reference resolving
|
|
530
|
-
CRATIS_HOOKS_SUBPATH_REPORT=1 .cratis/ai/hooks/scripts/validate-package-subpaths.sh
|
|
532
|
+
CRATIS_HOOKS_SUBPATH_REPORT=1 bash .cratis/ai/hooks/scripts/validate-package-subpaths.sh
|
|
531
533
|
```
|
|
532
534
|
|
|
533
535
|
Tier 2 is testable the same way, and wants a third run the subpath guard does not: a probe of names
|
|
@@ -539,15 +541,15 @@ a correct one, so prove it stays quiet when it should.
|
|
|
539
541
|
mkdir -p /tmp/scratch-corpus
|
|
540
542
|
echo "import { CommandDialog, ThisNameDoesNotExist } from '@cratis/components/CommandDialog';" \
|
|
541
543
|
> /tmp/scratch-corpus/drift.md
|
|
542
|
-
.cratis/ai/hooks/scripts/validate-package-imports.sh /tmp/scratch-corpus
|
|
544
|
+
bash .cratis/ai/hooks/scripts/validate-package-imports.sh /tmp/scratch-corpus
|
|
543
545
|
|
|
544
546
|
# Discrimination — every name real, expect silence
|
|
545
547
|
echo "import { DataPage, MenuItem } from '@cratis/components/DataPage';" \
|
|
546
548
|
> /tmp/scratch-corpus/drift.md
|
|
547
|
-
.cratis/ai/hooks/scripts/validate-package-imports.sh /tmp/scratch-corpus
|
|
549
|
+
bash .cratis/ai/hooks/scripts/validate-package-imports.sh /tmp/scratch-corpus
|
|
548
550
|
|
|
549
551
|
# Positive — the real corpus, with the report showing every binding resolving
|
|
550
|
-
CRATIS_HOOKS_IMPORT_REPORT=1 .cratis/ai/hooks/scripts/validate-package-imports.sh
|
|
552
|
+
CRATIS_HOOKS_IMPORT_REPORT=1 bash .cratis/ai/hooks/scripts/validate-package-imports.sh
|
|
551
553
|
```
|
|
552
554
|
|
|
553
555
|
Tier 3 wants the same three runs, and its negative case is the one that motivated it. Put
|
|
@@ -559,15 +561,15 @@ own motivating case is the wrong design.
|
|
|
559
561
|
mkdir -p /tmp/scratch-corpus
|
|
560
562
|
printf 'A reactor may return a `ReactorSideEffect` to control where the event is appended.\n' \
|
|
561
563
|
> /tmp/scratch-corpus/drift.md
|
|
562
|
-
.cratis/ai/hooks/scripts/validate-type-references.sh /tmp/scratch-corpus
|
|
564
|
+
bash .cratis/ai/hooks/scripts/validate-type-references.sh /tmp/scratch-corpus
|
|
563
565
|
|
|
564
566
|
# Discrimination — every name real, expect silence
|
|
565
567
|
printf 'Return `EventForEventSourceId`, or a `ReactorSideEffectFailure` from an `IReactor`.\n' \
|
|
566
568
|
> /tmp/scratch-corpus/drift.md
|
|
567
|
-
.cratis/ai/hooks/scripts/validate-type-references.sh /tmp/scratch-corpus
|
|
569
|
+
bash .cratis/ai/hooks/scripts/validate-type-references.sh /tmp/scratch-corpus
|
|
568
570
|
|
|
569
571
|
# Positive — the real corpus, expect silence, with the report showing how each name resolved
|
|
570
|
-
CRATIS_HOOKS_TYPE_REPORT=1 .cratis/ai/hooks/scripts/validate-type-references.sh
|
|
572
|
+
CRATIS_HOOKS_TYPE_REPORT=1 bash .cratis/ai/hooks/scripts/validate-type-references.sh
|
|
571
573
|
```
|
|
572
574
|
|
|
573
575
|
Run `bash -n` on every script and `jq .` on every JSON file before committing. The owning
|
|
@@ -25,8 +25,8 @@ const warning = message => {
|
|
|
25
25
|
const run = (command, args, options = {}) => spawnSync(command, args, {
|
|
26
26
|
encoding: 'utf8', timeout: commandTimeout, maxBuffer: 32 * 1024 * 1024, ...options,
|
|
27
27
|
});
|
|
28
|
-
const gh = args => {
|
|
29
|
-
const result = run('gh', args);
|
|
28
|
+
const gh = (args, options = {}) => {
|
|
29
|
+
const result = run('gh', args, options);
|
|
30
30
|
if (result.error || result.status !== 0) throw new Error(`gh ${args[0]} failed: ${result.stderr?.trim() || result.error?.message || result.status}`);
|
|
31
31
|
return result.stdout;
|
|
32
32
|
};
|
|
@@ -62,7 +62,7 @@ function originRepository(cwd) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
function targetCallers(repository, cwd) {
|
|
65
|
-
if (repository?.toLowerCase() === originRepository(cwd)?.toLowerCase()) return callers(cwd);
|
|
65
|
+
if (cwd && repository?.toLowerCase() === originRepository(cwd)?.toLowerCase()) return callers(cwd);
|
|
66
66
|
let files;
|
|
67
67
|
try { files = JSON.parse(gh(['api', `repos/${repository}/contents/.github/workflows`])); }
|
|
68
68
|
catch (error) {
|
|
@@ -133,7 +133,7 @@ function rules(warn, repositoryCallers) {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
function check(argv, repositoryCallers) {
|
|
136
|
+
function check(argv, repositoryCallers, lookupOptions) {
|
|
137
137
|
const { values } = parseArgs({ args: argv, options: {
|
|
138
138
|
'body-file': { type: 'string' }, label: { type: 'string', multiple: true },
|
|
139
139
|
'add-label': { type: 'string', multiple: true }, 'remove-label': { type: 'string', multiple: true },
|
|
@@ -143,10 +143,11 @@ function check(argv, repositoryCallers) {
|
|
|
143
143
|
const warn = message => { warned = true; warning(`Warning: ${message}`); };
|
|
144
144
|
let pull;
|
|
145
145
|
// gh requires a selector when --repo is supplied; otherwise preserve current-branch lookup.
|
|
146
|
-
const
|
|
146
|
+
const lookupRepository = lookupOptions ? lookupOptions.env.GH_REPO : values.repo;
|
|
147
|
+
const repoArgs = values.pr && lookupRepository ? ['--repo', lookupRepository] : [];
|
|
147
148
|
if (values.pr !== undefined) {
|
|
148
149
|
pull = JSON.parse(gh(['pr', 'view', ...(values.pr ? [values.pr] : []), ...repoArgs,
|
|
149
|
-
'--json', 'labels,body,author,baseRefName']));
|
|
150
|
+
'--json', 'labels,body,author,baseRefName'], lookupOptions || (values.repo ? { env: { ...process.env, GH_REPO: values.repo } } : {})));
|
|
150
151
|
}
|
|
151
152
|
if (!values['body-file'] && !pull) throw new Error('--body-file is required when creating a pull request');
|
|
152
153
|
const split = labels => (labels || []).flatMap(label => label.split(',')).map(label => label.trim()).filter(Boolean);
|
|
@@ -312,7 +313,7 @@ function effectiveRepository(words, cwd, environmentRepository) {
|
|
|
312
313
|
if (/[$`]/.test(environmentRepository)) throw new Error('Use a literal value for GH_REPO, not a shell expansion.');
|
|
313
314
|
return repositoryName(environmentRepository);
|
|
314
315
|
}
|
|
315
|
-
return originRepository(cwd);
|
|
316
|
+
return cwd ? originRepository(cwd) : undefined;
|
|
316
317
|
}
|
|
317
318
|
|
|
318
319
|
function hook() {
|
|
@@ -343,14 +344,15 @@ function hook() {
|
|
|
343
344
|
}
|
|
344
345
|
if (words[0] !== 'gh' || words[1] !== 'pr' || !['create', 'edit'].includes(words[2])) continue;
|
|
345
346
|
if (words.includes('--help') || words.includes('-h')) continue;
|
|
346
|
-
|
|
347
|
-
|
|
347
|
+
const repository = effectiveRepository(words, knownDirectory ? cwd : undefined, environmentRepository);
|
|
348
|
+
if (!knownDirectory && !repository) {
|
|
349
|
+
if (!optedIn(cwd)) continue;
|
|
348
350
|
throw new Error('Use a literal directory before gh pr create/edit.');
|
|
349
351
|
}
|
|
350
|
-
const repository = effectiveRepository(words, cwd, environmentRepository);
|
|
351
352
|
if (!/^Cratis\/[^/]+$/i.test(repository)) continue;
|
|
352
|
-
const repositoryCallers = targetCallers(repository, cwd);
|
|
353
|
+
const repositoryCallers = targetCallers(repository, knownDirectory ? cwd : undefined);
|
|
353
354
|
if (!repositoryCallers.length) continue;
|
|
355
|
+
if (!knownDirectory) throw new Error('Use a literal directory before gh pr create/edit.');
|
|
354
356
|
const args = [];
|
|
355
357
|
let target = '', hasBody = false;
|
|
356
358
|
for (let index = 3; index < words.length; index++) {
|
|
@@ -377,10 +379,14 @@ function hook() {
|
|
|
377
379
|
}
|
|
378
380
|
if (words[2] === 'create' && !hasBody) throw new Error('write the body to `.ai-work/pr-body.md` and use `--body-file` when creating a pull request.');
|
|
379
381
|
if (words[2] === 'edit') args.push('--pr', target);
|
|
380
|
-
// Use the same resolved target for opt-in, PR metadata and repository metadata.
|
|
381
382
|
args.push('--repo', repository);
|
|
383
|
+
// Pin PR lookup only for a command-targeted repository; otherwise let gh resolve its base repo.
|
|
384
|
+
const lookupEnvironment = { ...process.env };
|
|
385
|
+
const targetedRepository = effectiveRepository(words, undefined, environmentRepository);
|
|
386
|
+
if (targetedRepository) lookupEnvironment.GH_REPO = targetedRepository;
|
|
387
|
+
else delete lookupEnvironment.GH_REPO;
|
|
382
388
|
process.chdir(cwd);
|
|
383
|
-
const code = check(args, repositoryCallers);
|
|
389
|
+
const code = check(args, repositoryCallers, { env: lookupEnvironment });
|
|
384
390
|
if (code !== 0 && code !== 3) throw new Error('The pull-request body or release intent failed cratis-check-pr. Fix the reported violations before retrying.');
|
|
385
391
|
}
|
|
386
392
|
return 0;
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
{ "command": "observers retry-partition", "effect": "retries a failed partition from the sequence number where it failed" },
|
|
69
69
|
{ "command": "observers clear-quarantine", "effect": "clears an observer's quarantine so it resumes processing" },
|
|
70
70
|
{ "command": "jobs stop", "effect": "stops a running background job" },
|
|
71
|
-
{ "command": "jobs resume", "effect": "resumes a stopped
|
|
71
|
+
{ "command": "jobs resume", "effect": "resumes a stopped background job" },
|
|
72
72
|
{ "command": "recommendations perform", "effect": "executes a server recommendation, such as a schema or replay maintenance action" },
|
|
73
73
|
{ "command": "recommendations ignore", "effect": "marks a recommendation as ignored so it no longer appears" },
|
|
74
74
|
{ "command": "subscriptions add", "effect": "adds an event store subscription to a target event store" },
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"hooks": [
|
|
8
8
|
{
|
|
9
9
|
"type": "command",
|
|
10
|
-
"command": "\"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-guard-writes.sh"
|
|
10
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-guard-writes.sh"
|
|
11
11
|
}
|
|
12
12
|
]
|
|
13
13
|
},
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"hooks": [
|
|
17
17
|
{
|
|
18
18
|
"type": "command",
|
|
19
|
-
"command": "\"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-guard-store-mutations.sh"
|
|
19
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-guard-store-mutations.sh"
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
"type": "command",
|
|
23
|
-
"command": "\"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-guard-pr-body.sh"
|
|
23
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-guard-pr-body.sh"
|
|
24
24
|
}
|
|
25
25
|
]
|
|
26
26
|
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"hooks": [
|
|
32
32
|
{
|
|
33
33
|
"type": "command",
|
|
34
|
-
"command": "\"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-pattern-scan.sh"
|
|
34
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-pattern-scan.sh"
|
|
35
35
|
}
|
|
36
36
|
]
|
|
37
37
|
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"hooks": [
|
|
42
42
|
{
|
|
43
43
|
"type": "command",
|
|
44
|
-
"command": "\"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-quality-gate.sh"
|
|
44
|
+
"command": "bash \"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-quality-gate.sh"
|
|
45
45
|
}
|
|
46
46
|
]
|
|
47
47
|
}
|
|
@@ -130,6 +130,29 @@ public IEnumerable<object> Handle() =>
|
|
|
130
130
|
`EventForEventSourceId` also carries optional `Subject`, `EventStreamType` and
|
|
131
131
|
`EventStreamId` init members when the target stream is not the default.
|
|
132
132
|
|
|
133
|
+
A command that always appends through a Chronicle event source definition (Arc 22.49.0
|
|
134
|
+
and later, definitions from Chronicle 19.30.0) declares it with
|
|
135
|
+
`[EventSource<TSource>(stream)]` from `Cratis.Arc.Chronicle.Commands`; the definition
|
|
136
|
+
supplies the event source type and validates the optional stream name:
|
|
137
|
+
|
|
138
|
+
```csharp
|
|
139
|
+
[EventSource]
|
|
140
|
+
[EventStream("transactions")]
|
|
141
|
+
public class Account : IEventSource;
|
|
142
|
+
|
|
143
|
+
[Command]
|
|
144
|
+
[EventSource<Account>("transactions")]
|
|
145
|
+
public record RecordTransaction(AccountId AccountId, decimal Amount)
|
|
146
|
+
{
|
|
147
|
+
public <TransactionRecorded> Handle() => new(Amount);
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
An event that sets legacy `EventSourceType`/`EventStreamType` is appended by those
|
|
152
|
+
strings, not through the definition. A command may also implement
|
|
153
|
+
`ICanProvideEventStreamId` to supply the stream id. Do not combine a definition with
|
|
154
|
+
contradicting `[EventSourceType]`/`[EventStreamType]` attributes.
|
|
155
|
+
|
|
133
156
|
Concurrency scope is resolved **per target stream** — one expected tail per
|
|
134
157
|
event source id, not one shared across the streams a cross-stream command writes
|
|
135
158
|
to.
|
|
@@ -255,6 +255,31 @@ Task<AppendManyResult> AppendMany(EventSourceId eventSourceId, IEnumerable<objec
|
|
|
255
255
|
Task<AppendManyResult> AppendMany(IEnumerable<EventForEventSourceId> events, /* ... */); // :167
|
|
256
256
|
```
|
|
257
257
|
|
|
258
|
+
Event source definitions (Chronicle 19.30.0 and later): a never-instantiated type marked
|
|
259
|
+
`IEventSource`, named by `[EventSource(name)]` (default: the type name without a trailing
|
|
260
|
+
`EventSource`) and declaring streams with `[EventStream(name)]` (all in
|
|
261
|
+
`Cratis.Chronicle.EventSources`; both take `Description` and `Concurrency`). Append through
|
|
262
|
+
it with `EventForEventSourceId { EventSource = typeof(<Definition>), EventStream = "<stream>" }`;
|
|
263
|
+
the source and stream types come from the definition and contradicting explicit
|
|
264
|
+
`EventSourceType`/`EventStreamType` values are rejected. The stream id stays with the caller
|
|
265
|
+
(`EventStreamId`, or `ICanProvideEventStreamId.GetEventStreamId()` on a reactor or command).
|
|
266
|
+
|
|
267
|
+
```csharp
|
|
268
|
+
[EventSource("Account")]
|
|
269
|
+
[EventStream("Transactions")]
|
|
270
|
+
public class Account : IEventSource;
|
|
271
|
+
|
|
272
|
+
await eventStore.EventLog.AppendMany(
|
|
273
|
+
[
|
|
274
|
+
new EventForEventSourceId(<accountId>, new <Deposited>(<amount>))
|
|
275
|
+
{
|
|
276
|
+
EventSource = typeof(Account),
|
|
277
|
+
EventStream = "Transactions",
|
|
278
|
+
EventStreamId = <streamId>
|
|
279
|
+
}
|
|
280
|
+
]);
|
|
281
|
+
```
|
|
282
|
+
|
|
258
283
|
```csharp
|
|
259
284
|
var result = await eventStore.EventLog.Append(<eventSourceId>, new <EventName>(<value>));
|
|
260
285
|
if (!result.IsSuccess)
|
|
@@ -318,9 +318,12 @@ to the routed scope. This does not make command `reads` protected.
|
|
|
318
318
|
|
|
319
319
|
Decision 0023's constructs differ in availability. **Authorable at 4.64.0, never
|
|
320
320
|
executable yet** (binding reports `PLAY0268`, so they stop a model at V1): generated
|
|
321
|
-
values and `returns` responses
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
values and `returns` responses, operations, and named event sources and streams with
|
|
322
|
+
command routes (`eventsource`, `stream`, `streamId`). Their ESM versions are allocated,
|
|
323
|
+
not implemented (the highest implemented is v6). Syntax or MCP acceptance is not proof of
|
|
324
|
+
execution. A model using sources, streams or routes can be authored and validated, but
|
|
325
|
+
not bound, run or rendered; hand-write the code with the model as contract
|
|
326
|
+
(`cratis-screenplay-toolchain` `references/sources-and-streams.md`). `derive` and `provide` have no documented syntax at that tag; treat them as
|
|
324
327
|
planned and do not write them.
|
|
325
328
|
|
|
326
329
|
## `constraint` — uniqueness at append time
|
package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md
CHANGED
|
@@ -32,7 +32,7 @@ reports what: `cratis-screenplay-toolchain` `references/versions.md`.
|
|
|
32
32
|
| `reads` under a reaction trigger that `produces` directly | accepted | `PLAY0268` |
|
|
33
33
|
| Generated properties, `returns` responses | authorable, syntax-only | `PLAY0268`; allocated to ESM v8 |
|
|
34
34
|
| `system`, `operation` | authorable, syntax-only | `PLAY0268`; allocated to ESM v9 |
|
|
35
|
-
| `eventsource`, `stream` | authorable, authoring-only | `PLAY0268`; allocated
|
|
35
|
+
| `eventsource`, `stream` | authorable, authoring-only | `PLAY0268`; allocated, not implemented (`cratis-screenplay-toolchain` `references/sources-and-streams.md`) |
|
|
36
36
|
| UI constructs | accepted | information `PLAY0269` |
|
|
37
37
|
|
|
38
38
|
A model that carries one of the blocked constructs is still a valid design model. Never remove
|
package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md
CHANGED
|
@@ -175,7 +175,7 @@ the standalone 4.64.0 tool for the rows marked "probed"; Cratis CLI 3.27.1
|
|
|
175
175
|
| Reaction with trigger `reads` | Direct-producing (or code-bodied) reaction with `reads`: `PLAY0268` ("ESM v6 cannot protect that decision dependency", decision 0006), non-executable. Invokes-only reaction with `reads`: information only; the invoked command must declare and protect its own decision reads. Keep the `reads`; never remove them to obtain binding |
|
|
176
176
|
| Binds as opaque code (v3); reference runner reports unsupported | Bodied reducers, bodied named rules, fenced `validate` blocks, code or file policies. A pure reducer body is the only attachment Stage 4.24.0 admits |
|
|
177
177
|
| Information only, never blocks (probed) | `persona` (report-only: `PLAY0270`, the policies it lists must exist), `authentication`, `domain`, `seed`, descriptions and `file` provenance. A persona does not block binding and does not change behavior, so state persona scope in a description or a policy the model uses |
|
|
178
|
-
| Authorable, not executable (`PLAY0268`, probed) | `generated` properties and `returns` responses (allocated ESM v8), `system` and `operation` (v9), `eventsource` and `stream` (
|
|
178
|
+
| Authorable, not executable (`PLAY0268`, probed) | `generated` properties and `returns` responses (allocated ESM v8), `system` and `operation` (v9), `eventsource` and `stream` (allocated, not implemented; see `cratis-screenplay-toolchain` `references/sources-and-streams.md`). The MCP reads and edits them (`declaration-details`, `find-fixtures`, `read-workspace` views `event-sources`/`event-streams`/`command-routes`) with `executionAvailable: false`. Keep them in the model as intent; do not strip them to make the model bind, and do not call the model executable |
|
|
179
179
|
| Blocks binding (`PLAY0268`) | `@pii`/`@sensitive` concepts (probed: "compliance attributes require portable data-subject semantics"), command `handler` (never binds; a command cannot declare both `produces` and `handler`, `PLAY0035`), bare `rule <Name>`, `require` or conditions over read-model paths, dates and `today` in comparisons, `$context.tenant`/claims/roles/causation in `produces`, `$env` conditions, `file` constraints, unquoted `import` of an external contract, a read model whose keyed queries in its own slice do not share one `by` property (none, or two different properties; several queries over the same property bind), any query other than `=> <ReadModel> optional` with one caller-supplied `by` argument (so also observable, filtered, scoped and performer-backed queries), `$causedBy` and templates in projections |
|
|
180
180
|
| Blocks binding (`PLAY0271`, legacy meaning) | Command `reads` and `concurrency` |
|
|
181
181
|
| Deferred (`PLAY0269`, information) | Screens, layouts, templates, forms, contributions, UI profiles, themes, behaviors and `on`/`uses` |
|
|
@@ -209,7 +209,7 @@ Decision 0023's generated values and `returns`, operations and named event
|
|
|
209
209
|
sources/streams are **authorable** at v4.64.0 (syntax only, see the table above and
|
|
210
210
|
`commands.md`, `operations.md`, `event-sources.md` in the Screenplay documentation):
|
|
211
211
|
write them, but binding reports `PLAY0268` and nothing executes them until
|
|
212
|
-
ESM
|
|
212
|
+
the allocated ESM versions are implemented (the highest implemented is v6). Do not drop them for the sake of a green bind.
|
|
213
213
|
Protected reads and `derive`/`provide` (allocated v11) have no documented syntax at
|
|
214
214
|
v4.64.0: do not teach or invent one. Affected-instance declarations, per-event data
|
|
215
215
|
subjects, external event origin and query paging/sorting/change-set delivery also
|
|
@@ -93,8 +93,9 @@ not host these production-repair transactions. Use MCP for production repairs.
|
|
|
93
93
|
## Syntax-only constructs through the MCP
|
|
94
94
|
|
|
95
95
|
`generated` properties and `returns` responses, `system`/`operation`, and
|
|
96
|
-
`eventsource`/`stream` are authorable but not executable (`PLAY0268
|
|
97
|
-
|
|
96
|
+
`eventsource`/`stream` are authorable but not executable (`PLAY0268`; the first two
|
|
97
|
+
are allocated to ESM v8 and v9, sources and streams are allocated, not implemented:
|
|
98
|
+
`cratis-screenplay-toolchain` `references/sources-and-streams.md`). The server reads and edits them: `declaration-details` exposes `isGenerated`
|
|
98
99
|
and a command `response` view, `route` and `streams` views; `read-workspace` offers
|
|
99
100
|
the views `event-sources`, `event-streams`, `event-source-details`,
|
|
100
101
|
`event-stream-details`, `command-routes` and `event-source-diagnostics` (detail
|
|
@@ -62,6 +62,10 @@ assume an answer to 4, and record it as `blocked` for the user.
|
|
|
62
62
|
| **B. Generated base plus authorized gap-fill** | an earlier admitted whole-model render exists and the user separately authorized hand-written scope, or a seam the model names needs an adapter | the generated output stays managed and untouched; hand-written code lives in `Customizations/` or a separate project (seam adapters by this skill, business gap-fill by `slice-implementer`), serves named model elements only, never claims render admission, and V5 is reported for the generated base **with its scope stated** |
|
|
63
63
|
| **C. Fully hand-written delivery** | the scope cannot render and no generated base is wanted | `slice-implementer` delivers it with the model as the contract (`references/gap-fill-handoff.md`); V5 is `not run: no render` |
|
|
64
64
|
|
|
65
|
+
Models with event sources, streams or command routes are case A or C today: they cannot
|
|
66
|
+
bind or render (`PLAY0268`, `STAGE-ESM-016`), so hand-write the code with the model as the
|
|
67
|
+
contract (`cratis-screenplay-toolchain` `references/sources-and-streams.md`).
|
|
68
|
+
|
|
65
69
|
Two rules hold in every case: a customization never makes a rejected model renderable, and
|
|
66
70
|
a whole-application V5 is never claimed from a subset. The CLI renders whole applications
|
|
67
71
|
only; a dependency-closed scope selection does not exist, so do not fake one with an
|
|
@@ -67,7 +67,10 @@ option, mark it `ASSUMED` in the slice or module `description` and in the sessio
|
|
|
67
67
|
each event belongs, and decide retain, split, view instead, or unresolved, by lifecycle and
|
|
68
68
|
invariant consequences, not names or length. For Chronicle keep event-source identity,
|
|
69
69
|
namespace, process-stream routing and concurrency scope apart
|
|
70
|
-
(`references/chronicle-boundaries.md`).
|
|
70
|
+
(`references/chronicle-boundaries.md`). Declared `eventsource`/`stream`/`streamId` and
|
|
71
|
+
command routes can be authored and validated but not bound, run or rendered today
|
|
72
|
+
(`PLAY0268`, `STAGE-ESM-016`): keep them as intent and hand-write the routing
|
|
73
|
+
(`cratis-screenplay-toolchain` `references/sources-and-streams.md`).
|
|
71
74
|
2. **Account for every invariant.** One row per rule in the table from
|
|
72
75
|
`references/consistency-and-concurrency.md`: rule, authoritative inputs, all paths that can
|
|
73
76
|
affect it, intended atomic decision point, exact construct, status (`enforced` / `recorded` /
|
|
@@ -189,7 +189,7 @@ Ask for each stream:
|
|
|
189
189
|
Some event stores decide consistency by a query over tagged events instead of one stream
|
|
190
190
|
(often called dynamic consistency boundaries). Chronicle's concurrency scopes can narrow a
|
|
191
191
|
check to event types, source type or stream (`concurrency` block, Screenplay
|
|
192
|
-
`commands.md`), and Screenplay has syntax-only event-source/stream declarations (ESM
|
|
192
|
+
`commands.md`), and Screenplay has syntax-only event-source/stream declarations (allocated, not implemented ESM version;
|
|
193
193
|
`event-sources.md`). None of this binds on either compiler (`versions.md` in `cratis-screenplay-toolchain`). Model the stream by business
|
|
194
194
|
identity; when a rule truly needs a cross-stream decision, record it (see
|
|
195
195
|
`consistency-and-concurrency.md`) rather than inventing a construct.
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
{ "kind": "skill-contains", "value": "retry identity" },
|
|
12
12
|
{ "kind": "skill-contains", "value": "CHR0034" },
|
|
13
13
|
{ "kind": "skill-contains", "value": "No calculated events" },
|
|
14
|
-
{ "kind": "skill-contains", "value": "decision tree and red flags" }
|
|
14
|
+
{ "kind": "skill-contains", "value": "decision tree and red flags" },
|
|
15
|
+
{ "kind": "skill-contains", "value": "not bound, run or rendered" }
|
|
15
16
|
]
|
|
16
17
|
}
|
|
@@ -103,6 +103,9 @@ changes with the root folder name.
|
|
|
103
103
|
`concurrency` do not bind (PLAY0271); no `@pii`; v6 constructs only on the standalone tool.
|
|
104
104
|
- **Renderable** (V5): `references/renderable-subset.md`. Stage 4.24 renders ESM v1 to v3
|
|
105
105
|
`StateChange`/`StateView` slices; Automation and Translate are gap-fill (Stage#79).
|
|
106
|
+
- **Event sources, streams and command routes**: authorable and validatable, but never
|
|
107
|
+
bound (`PLAY0268`: allocated, not implemented ESM version), run or rendered
|
|
108
|
+
(`STAGE-ESM-016`); gap-fill with the model as contract (`references/sources-and-streams.md`).
|
|
106
109
|
|
|
107
110
|
## Edit strategy
|
|
108
111
|
|
|
@@ -122,7 +122,7 @@ bodies still leave their owner non-executable.
|
|
|
122
122
|
| `join`, `children` or `remove via join` inside `nested` | blocked plan | binds; `UnsupportedProjectionBlock` |
|
|
123
123
|
| `$eventContext.occurred.Week` | PLAY0273 | derived value |
|
|
124
124
|
| Projection `parent p` where `p` is not on the child event | PLAY0273 | "Event property not found" |
|
|
125
|
-
| `generated` or `returns` (v8), operations or systems (v9), eventsource or stream (
|
|
125
|
+
| `generated` or `returns` (v8), operations or systems (v9), `numbers exact` (v7), eventsource or stream (allocated, not implemented; `sources-and-streams.md`) | PLAY0268 | syntax only; one such construct leaves the **whole** application without an executable model |
|
|
126
126
|
| Spec of a gated command or query without `given caller` | PLAY0389 | module and feature gates count |
|
|
127
127
|
| `given` or `then readmodel` missing the key property | PLAY0351 | key is the keyed query's `by` |
|
|
128
128
|
| When-less spec asserting events or errors | PLAY0352 | |
|
|
@@ -14,6 +14,11 @@ rejects members. A model that binds only on the standalone tool is not renderabl
|
|
|
14
14
|
|
|
15
15
|
## What Stage 4.24 admits
|
|
16
16
|
|
|
17
|
+
Models using `eventsource`, `stream` or command routes are not renderable: they fail
|
|
18
|
+
binding (`PLAY0268`) and Stage refuses their ESM version (`STAGE-ESM-016`); rendered
|
|
19
|
+
appends never carry event source type, event stream type or event stream id, so
|
|
20
|
+
Chronicle's defaults apply (Stage#177, #200, #201). See `sources-and-streams.md`.
|
|
21
|
+
|
|
17
22
|
Whole-model admission requires ESM schema v1 to v3; anything else is STAGE-ESM-016 (v4
|
|
18
23
|
generations also fail the CLI pre-check CLI-RENDER-003). The admitted vertical is concepts,
|
|
19
24
|
composite types, one command to its events, a one-instance projection, an optional keyed
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Event sources, streams and command routes
|
|
2
|
+
|
|
3
|
+
What a model that uses `eventsource`, `stream`, `streamId` or a command route can and
|
|
4
|
+
cannot do today. Facts read at Screenplay v4.64.0 (`SemanticModelBinder.CommandProductions.cs`),
|
|
5
|
+
Stage v4.24.0 (`SemanticCratisAdmission.cs`) and Chronicle v19.30.0 / Arc v22.49.0.
|
|
6
|
+
|
|
7
|
+
| Activity | Today |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| Author in `.play` (syntax, MCP views `event-sources`, `event-streams`, `command-routes`) | yes, since Screenplay v4.62.0 |
|
|
10
|
+
| Validate (V1: authorable) | yes |
|
|
11
|
+
| Bind (V3) and run specifications | no: binding reports `PLAY0268`; the whole application then has no executable model. V2 (executable diagnostics) shows that blocking `PLAY0268` as the evidence for the blocked V3 |
|
|
12
|
+
| Render (V5) | no: Stage admits ESM v1 to v3 only, so the model is refused with `STAGE-ESM-016` |
|
|
13
|
+
| Deliver as code | gap-fill by hand with the model as the contract (`cratis-screenplay-render-and-gap-fill`, case C) |
|
|
14
|
+
|
|
15
|
+
Why binding refuses: the constructs need an ESM version that is **allocated** but **not
|
|
16
|
+
implemented**. The highest **implemented** ESM version is v6. At 4.64.0 the `PLAY0268`
|
|
17
|
+
message names the allocated version; do not copy a number into a model, a skill or a
|
|
18
|
+
decision, because the numbering is under decision (Cratis/Screenplay PR #401). Tracked in
|
|
19
|
+
Cratis/Screenplay#407 (increment 2 of #302).
|
|
20
|
+
|
|
21
|
+
Stage: even when a model uses none of these constructs, Stage 4.24.0 renders appends
|
|
22
|
+
without event source type, event stream type or event stream id, so Chronicle's defaults
|
|
23
|
+
apply. Tracked in Cratis/Stage#177, #200 and #201. Keep a declared route as intent in the
|
|
24
|
+
model and implement it in hand-written code; never remove it to make the model bind or render.
|
|
25
|
+
|
|
26
|
+
Code-level target for the hand-written part: `IEventSource`, `[EventSource]`, `[EventStream]`
|
|
27
|
+
(Chronicle 19.30.0 and later) and Arc's `[EventSource<TSource>(stream)]` on a command
|
|
28
|
+
(Arc 22.49.0 and later); see `cratis-chronicle-client-dotnet` and `cratis-arc-command`
|
|
29
|
+
(`references/handler-shapes.md`).
|
|
@@ -83,6 +83,12 @@ not prove the older compiler: read the construct it names.
|
|
|
83
83
|
| Render | `cratis render` binds with the bundled compiler first, then Stage 4.24.0 admits. See `renderable-subset.md` | source |
|
|
84
84
|
| `prologue interpret` | no `--no-llm` flag; LLM resolution and `screenplay generate` flags were checked on 3.27.0 | source |
|
|
85
85
|
|
|
86
|
+
## Event sources and streams
|
|
87
|
+
|
|
88
|
+
Declared since Screenplay v4.62.0 but not bound: PLAY0268, allocated-not-implemented ESM
|
|
89
|
+
version (highest implemented: v6). Stage 4.24.0 admits ESM v1 to v3 and refuses with
|
|
90
|
+
STAGE-ESM-016. Details and trackers: `sources-and-streams.md`.
|
|
91
|
+
|
|
86
92
|
## MCP roots bug (4.63.1 and earlier; fixed in 4.63.2)
|
|
87
93
|
|
|
88
94
|
A dynamic-root server (`screenplay mcp` with no folder) asks a roots-capable client for
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
{ "kind": "skill-contains", "value": "cratis screenplay validate" },
|
|
11
11
|
{ "kind": "skill-contains", "value": "cli#244" },
|
|
12
12
|
{ "kind": "skill-contains", "value": "`notifications/initialized`" },
|
|
13
|
-
{ "kind": "skill-contains", "value": "A handler never binds" }
|
|
13
|
+
{ "kind": "skill-contains", "value": "A handler never binds" },
|
|
14
|
+
{ "kind": "skill-contains", "value": "references/sources-and-streams.md" },
|
|
15
|
+
{ "kind": "skill-contains", "value": "STAGE-ESM-016" },
|
|
16
|
+
{ "kind": "skill-contains", "value": "authorable and validatable" }
|
|
14
17
|
]
|
|
15
18
|
}
|
|
@@ -85,6 +85,11 @@ Facts that surprise:
|
|
|
85
85
|
|
|
86
86
|
## What Stage 4.24 admits
|
|
87
87
|
|
|
88
|
+
A model using `eventsource`, `stream` or command routes is refused (`STAGE-ESM-016`), and
|
|
89
|
+
rendered appends never carry event source type, event stream type or event stream id, so
|
|
90
|
+
Chronicle's defaults apply (Stage#177, #200, #201; Screenplay#407). Gap-fill the routing by
|
|
91
|
+
hand; see `cratis-screenplay-toolchain` `references/sources-and-streams.md`.
|
|
92
|
+
|
|
88
93
|
Whole-model admission needs ESM schema v1 to v3; anything else is `STAGE-ESM-016`. Event
|
|
89
94
|
generations (v4) also fail the CLI pre-check `CLI-RENDER-003`. The admitted vertical:
|
|
90
95
|
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
{ "kind": "skill-contains", "value": "`[ProtectedDecision]`" },
|
|
15
15
|
{ "kind": "skill-contains", "value": "`Customizations/`" },
|
|
16
16
|
{ "kind": "skill-contains", "value": "`Stage__Runtime__Engine=semantic`" },
|
|
17
|
-
{ "kind": "skill-contains", "value": "`--engine semantic`" }
|
|
17
|
+
{ "kind": "skill-contains", "value": "`--engine semantic`" },
|
|
18
|
+
{ "kind": "skill-contains", "value": "Stage#177" },
|
|
19
|
+
{ "kind": "skill-contains", "value": "never carry event source type" }
|
|
18
20
|
]
|
|
19
21
|
}
|