@cratis/pi 7.189.3 → 7.189.5

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.
@@ -57,8 +57,9 @@ Read the **cratis-arc-elixir** and **cratis-chronicle-client-elixir** skills bef
57
57
  never carries a secret.
58
58
  - **Every slice tells a whole story**: a state change has a command and the events it appends; a view
59
59
  has a read model and consumes events (`consumes:` when it reads the event log); an automation reacts to
60
- an event and records a fact of its own, so the event model shows what it did. A reactor that calls a
61
- third party returns the event recording that it did.
60
+ an event, runs a command and records the fact that command appends, so the event model shows what it
61
+ did. A reactor that calls a third party does not append events itself: it runs a `:system` command
62
+ (`Cratis.Arc.execute/3`) that records the outcome, and the command lives in the reactor's slice folder.
62
63
  - **Order is the story**: a slice that uses events of several sub-features goes in a sub-feature after
63
64
  them. Build with `arc: [event_model_strict: true]` so an incomplete model fails the build.
64
65
  - **Third parties are integrations behind a behaviour**, with an in-memory stand-in for specs; only
@@ -421,7 +421,21 @@ path (or stdout) only with exactly recognised non-executing, non-deleting option
421
421
  source deletion and program execution are refused. Option environments (`UNZIP`, `UNZIPOPT`,
422
422
  `TAR_OPTIONS`, `ZIPOPT`) and argfile arguments are refused; assigning/exporting those variables is
423
423
  also blocked. Extraction-to-stdout forms do not accept `--`. Extract outside the agent shell (or ask
424
- the user), then copy the specific files needed. Git checkout-index still requires a directory
424
+ the user), then copy the specific files needed.
425
+
426
+ Archive operands (tar/bsdtar/gtar, zip, 7z, jar, ar, cpio, pax; ditto and unar are already refused outright)
427
+ must not be able to expand into an option or an `@listfile` reference. A word containing an active glob
428
+ (`*`, `?`, `[`) is admitted only when its **first** character is a literal character other than `-` or `@`: a plain
429
+ character, a character of a plain quoted segment, or a backslash-escaped plain character. A leading glob, a
430
+ `$` expansion, a backquote or a `$'..'`/`$".."` segment never anchors, quoted or not (`"$x"?`, `"$PWD"/?x`). The
431
+ same rule applies in an option-value position (`-f ""?`). In archive mode any word containing a `$'..'` segment
432
+ with a backslash is refused whether or not it has a glob, because its escapes are not decoded. This is a lexical
433
+ check: it never expands the glob, reads the directory or runs anything, so it does not depend on which files
434
+ exist today. **Compatibility change:** `tar -cf out.tar ?x`, `zip out.zip [a]*` and similar unanchored patterns are
435
+ now refused even in a directory with no option-shaped names. Re-spell them with a literal anchor (`./?x`,
436
+ `dir/?x`), which stays allowed. `--` is not an anchor for any family (tar, zip, 7z, cpio, pax, ...): the guard
437
+ cannot verify what each tool does after it, so the remediation is `./`. A `--` that is itself an option value
438
+ (`zip out.zip -x -- ?x`) is data, not a terminator. Git checkout-index still requires a directory
425
439
  prefix ending in `/`, checked against all protected-path policy.
426
440
 
427
441
  In destructive scope only, an existing directory also receives a metadata-only inventory for
@@ -489,6 +503,27 @@ arguments are operands. A lone `-` is a stdin operand. Value-free short flags ma
489
503
  | `rsync` | `-a -r -v -n -u -z -t -p`; `--archive --recursive --verbose --dry-run --update --compress --times --perms` |
490
504
  | `install` | `-c -v -C -p`; `-d` directory operands; `-m MODE`/`-mMODE` (three or four octal digits); the same target-directory forms as `cp` |
491
505
 
506
+ ### Support matrix and boundary (#1252, #1223)
507
+
508
+ These guards check a **supported command-shape subset on a best-effort basis**; they are defense in depth,
509
+ not a sandbox. File permissions and OS-level isolation are the boundary. "Out of scope" below means the guard
510
+ does not examine the shape, **not** that the shape is safe: a zero verdict there proves only the limit.
511
+ Standalone verdicts differ: the secrets guard decides reads, the shell-write guard decides writes and
512
+ destructive scope, and an allowance by one never authorizes the other. A support-matrix spec in the
513
+ Cratis AI repository pins each row with JSON-only invocations (no candidate text is executed).
514
+
515
+ | Class | Supported | Refused | Out of scope (not examined) |
516
+ |---|---|---|---|
517
+ | State inherited from earlier calls | The supplied `cwd`; literal `cd`/`git -C` within one command; modeled archive option environments | Unresolved destructive destinations; `UNZIP`/`TAR_OPTIONS`-style archive environments | Earlier assignments, executor shell options (`dotglob`, `nullglob`), files created by prior calls or races |
518
+ | Aliases and functions | Literal executable names | Protected references and unresolved destructive effects stay visible | What an alias, function or shadowing executable does; definitions are never loaded or run |
519
+ | Directory resolution | Literal cwd, `cd`, Git `-C`, logical and physical (symlink) path checks | Ambiguous destructive cwd; links resolving into protected or whole-worktree scope | `CDPATH`, unmodeled directory options, symlinks created during execution |
520
+ | Expansion and quoting | Literal and quoted operands; ordinary source globs and bounded literal-prefix probes; archive operands whose first character is a literal other than `-`/`@` (`./?x`, `dir/?x`; a quoted expansion such as `"$x"` never anchors, and `--` is no anchor) or quoting | Archive operands that can expand to options or `@` (above); unresolved destructive operands; over-budget parsing | General shell grammar (bash versus zsh), indirect expansion |
521
+ | Wrappers and shell entry points | Modeled wrappers (`env`, `nice`, `sudo`, `timeout`, …) and literal nested `sh -c` bodies | Protected inline-interpreter vocabulary; executable heredocs; uncertain destructive wrapper context | Dynamic code, external scripts, generated stdin, custom wrappers, archive file-list (`-T`) contents |
522
+
523
+ Remaining redesign (a command-shape allowlist per tool family, argument-file and dynamic-code handling, a
524
+ recovered #1222 shape inventory) stays on #1223. Shipped hook changes reach a consuming repository through
525
+ `cratis ai update`.
526
+
492
527
  ### Read-only admissions and deliberate refusals (#1255)
493
528
 
494
529
  | Case | Decision | Reason | Workaround |
@@ -1070,8 +1070,8 @@ function data_substitutions(text, d, word, i, c, body, k) {
1070
1070
  }
1071
1071
  }
1072
1072
  }
1073
- function lex(text, d, i, c, nextc, quote, word, quoted, active, n, body, k, pending, delimiter, strip, hd_index, end, word_start) {
1074
- n = 0; quote = ""; word = ""; active = 0; quoted = 0; pending = 0
1073
+ function lex(text, d, i, c, nextc, quote, word, quoted, active, n, body, k, pending, delimiter, strip, hd_index, end, word_start, glob_at, xf, ansi) {
1074
+ n = 0; quote = ""; word = ""; active = 0; quoted = 0; pending = 0; glob_at = 0; xf = ""; ansi = 0
1075
1075
  for (i = 1; i <= length(text); i++) {
1076
1076
  c = substr(text, i, 1); nextc = substr(text, i + 1, 1)
1077
1077
  if (!active) word_start = i
@@ -1085,14 +1085,17 @@ function lex(text, d, i, c, nextc, quote, word, quoted, active, n, body, k, p
1085
1085
  i = sub_end; word = word "$__sub"; active = 1; continue
1086
1086
  }
1087
1087
  if (quote != "") {
1088
- if (c == quote) { quote = ""; continue }
1088
+ if (c == quote) { quote = ""; ansi = 0; continue }
1089
+ if (ansi && c == "\\" && xf !~ /e/) xf = xf "e"
1090
+ if (c == "\\" && quote != "\047" && nextc == "\n") { i++; continue }
1089
1091
  if (c == "\\" && quote != "\047" && nextc ~ /[$`"\\]/) c = substr(text, ++i, 1)
1090
1092
  word = word c; continue
1091
1093
  }
1092
1094
  if (c == "\047" || c == "\"" || (c == "$" && nextc == "\047")) {
1093
- if (c == "$") c = substr(text, ++i, 1)
1095
+ if (c == "$") { c = substr(text, ++i, 1); ansi = 1; if (word == "") xf = xf "f" }
1094
1096
  quote = c; if (!active) quoted = 1; active = 1; continue
1095
1097
  }
1098
+ if (c == "\\" && nextc == "\n") { i++; continue }
1096
1099
  if (c == "\\") { if (!active) quoted = 1; word = word substr(text, ++i, 1); active = 1; continue }
1097
1100
  if (c == "#" && !active) {
1098
1101
  while (i <= length(text) && substr(text, i, 1) != "\n") i++
@@ -1106,7 +1109,7 @@ function lex(text, d, i, c, nextc, quote, word, quoted, active, n, body, k, p
1106
1109
  }
1107
1110
  if (c == "{" && nextc == "}") { word = word "{}"; i++; active = 1; continue }
1108
1111
  if (c ~ /[ \t\r\n;&|(){}<>]/) {
1109
- if (active) { W[d, ++n] = word; Q[d, n] = quoted; DQ[d, n] = quoted_prefix(substr(text, word_start, i - word_start)); CT[d, n] = literal_current_directory(substr(text, word_start, i - word_start), word); K[d, n] = "word"; T[d, n] = i - 1; F[d, n] = !quoted && word ~ /^[0-9]+$/ && substr(text, i - length(word), length(word)) == word; word = ""; active = quoted = 0 }
1112
+ if (active) { W[d, ++n] = word; Q[d, n] = quoted; DQ[d, n] = quoted_prefix(substr(text, word_start, i - word_start)); CT[d, n] = literal_current_directory(substr(text, word_start, i - word_start), word); K[d, n] = "word"; T[d, n] = i - 1; F[d, n] = !quoted && word ~ /^[0-9]+$/ && substr(text, i - length(word), length(word)) == word; GL[d, n] = glob_at; XF[d, n] = xf; word = ""; active = quoted = glob_at = 0; xf = "" }
1110
1113
  if (c ~ /[ \t\r]/) continue
1111
1114
  if (c == "<" && nextc == "<") {
1112
1115
  if (substr(text, i, 3) == "<<<") { W[d, ++n] = "<<<"; K[d, n] = "<<<"; T[d, n] = i; i += 2; continue }
@@ -1140,8 +1143,10 @@ function lex(text, d, i, c, nextc, quote, word, quoted, active, n, body, k, p
1140
1143
  continue
1141
1144
  }
1142
1145
  word = word c; active = 1
1146
+ # Offset of the first unquoted pathname-expansion character; quoted and escaped ones never get here.
1147
+ if (!glob_at && c ~ /[*?\[]/) glob_at = length(word)
1143
1148
  }
1144
- if (active) { W[d, ++n] = word; Q[d, n] = quoted; DQ[d, n] = quoted_prefix(substr(text, word_start)); CT[d, n] = literal_current_directory(substr(text, word_start), word); K[d, n] = "word" }
1149
+ if (active) { W[d, ++n] = word; Q[d, n] = quoted; DQ[d, n] = quoted_prefix(substr(text, word_start)); CT[d, n] = literal_current_directory(substr(text, word_start), word); K[d, n] = "word"; GL[d, n] = glob_at; XF[d, n] = xf }
1145
1150
  if (quote != "" || pending) unclassified(remaining(d, 1, n))
1146
1151
  return n
1147
1152
  }
@@ -1178,7 +1183,7 @@ function wrapper_flag(program, option) {
1178
1183
  function copy_token(source, from, dest, to, j) {
1179
1184
  W[dest, to] = W[source, from]; Q[dest, to] = Q[source, from]; DQ[dest, to] = DQ[source, from]; K[dest, to] = K[source, from]
1180
1185
  H[dest, to] = H[source, from]; T[dest, to] = T[source, from]; F[dest, to] = F[source, from]
1181
- BC[dest, to] = BC[source, from]
1186
+ BC[dest, to] = BC[source, from]; GL[dest, to] = GL[source, from]; XF[dest, to] = XF[source, from]
1182
1187
  for (j = 1; j <= BC[source, from]; j++) B[dest, to, j] = B[source, from, j]
1183
1188
  }
1184
1189
  function redirection(d, i) { return K[d, i] ~ /^[<>]/ || K[d, i] ~ /^&>/ }
@@ -1203,7 +1208,7 @@ function env_words(text, slot, i, c, nextc, quote, word, active, n) {
1203
1208
  for (i = 1; i <= length(text) + 1; i++) {
1204
1209
  c = substr(text, i, 1); nextc = substr(text, i + 1, 1)
1205
1210
  if (c == "" || (quote == "" && c ~ /[[:space:]]/)) {
1206
- if (active) { W[slot, ++n] = word; Q[slot, n] = 1; K[slot, n] = "word"; word = ""; active = 0 }
1211
+ if (active) { W[slot, ++n] = word; Q[slot, n] = 1; K[slot, n] = "word"; GL[slot, n] = 0; XF[slot, n] = ""; word = ""; active = 0 }
1207
1212
  continue
1208
1213
  }
1209
1214
  if (quote == "" && c == "#" && !active) break
@@ -1212,7 +1217,7 @@ function env_words(text, slot, i, c, nextc, quote, word, active, n) {
1212
1217
  if (nextc == "c") break
1213
1218
  if (nextc == "_") {
1214
1219
  if (quote == "") {
1215
- if (active) { W[slot, ++n] = word; Q[slot, n] = 1; K[slot, n] = "word"; word = ""; active = 0 }
1220
+ if (active) { W[slot, ++n] = word; Q[slot, n] = 1; K[slot, n] = "word"; GL[slot, n] = 0; XF[slot, n] = ""; word = ""; active = 0 }
1216
1221
  continue
1217
1222
  }
1218
1223
  c = " "
@@ -1230,7 +1235,7 @@ function env_words(text, slot, i, c, nextc, quote, word, active, n) {
1230
1235
  word = word c; active = 1
1231
1236
  }
1232
1237
  if (quote != "") { unclassified(text); return -1 }
1233
- if (active) { W[slot, ++n] = word; Q[slot, n] = 1; K[slot, n] = "word" }
1238
+ if (active) { W[slot, ++n] = word; Q[slot, n] = 1; K[slot, n] = "word"; GL[slot, n] = 0; XF[slot, n] = "" }
1234
1239
  return n
1235
1240
  }
1236
1241
  function executable(d, start, end, i, j, program, option, split_at, text, slot, count, first, expansions) {
@@ -1343,8 +1348,37 @@ function option_grammars() {
1343
1348
  option_schema("read-tree", "uminv", "", "reset merge dry-run verbose no-sparse-checkout", "prefix index-output")
1344
1349
  option_schema("checkout-index", "afqunz", "", "all force quiet index no-create stdin temp", "prefix")
1345
1350
  }
1351
+ # Archive operands. A word whose expansion can begin with `-` or `@` is an option, or a bsdtar/7z list-file
1352
+ # reference. A word with an active glob is therefore admitted only when its FIRST element is a literal character
1353
+ # other than `-`/`@`: a plain character, a character of a plain quoted segment, or an escaped plain character.
1354
+ # A `$` expansion, backquote, `$'..'` segment or leading glob never anchors, because it can expand to nothing or to
1355
+ # an option. A `$'..'` segment containing a backslash is refused outright: its escapes are not decoded here.
1356
+ # Lexical only: no expansion and no filesystem access, and `--` is never treated as proof.
1357
+ function archive_escape(d, i) { return XF[d, i] ~ /e/ }
1358
+ function option_shaped_glob(d, i) {
1359
+ return archive_escape(d, i) || (GL[d, i] && (GL[d, i] == 1 || W[d, i] ~ /^[-@$`]/ || XF[d, i] ~ /f/))
1360
+ }
1361
+ # A simple copy may retain a leading glob only after the same bounded metadata check as reader_globs.
1362
+ # Keep this exception local to the current directory and plain star/question patterns; never evaluate text.
1363
+ function copy_source_glob(d, i, cwd, uncertain, script, cmd, line, count, ok) {
1364
+ if (!exception_allowed || uncertain || cwd != ENVIRON["GSW_CWD"] || ENVIRON["GSW_GLOB_SAFE"] != "1") return 0
1365
+ if (!GL[d, i] || XF[d, i] != "" || W[d, i] !~ /^[*?][a-zA-Z0-9._*?-]*$/) return 0
1366
+ script = "cd -- \"$1\" && [ -r . ] && [ -x . ] || exit 3; unset GLOBIGNORE; " \
1367
+ "shopt -s nullglob dotglob nocaseglob && shopt -q nullglob dotglob nocaseglob || exit 3; : *; " \
1368
+ "n=0; while IFS= read -r f; do n=$((n+1)); [ \"$n\" -le 200 ] || exit 3; " \
1369
+ "case $f in -*|*[!a-zA-Z0-9._/@+=,:%-]*) exit 3;; esac; printf \"F:%s\\n\" \"$f\"; done < <(compgen -G \"$2\"); echo OK"
1370
+ cmd = "bash -c " quote_path(script) " guard-copy-glob " quote_path(cwd) " " quote_path(W[d, i]) " 2>/dev/null"
1371
+ while ((cmd | getline line) > 0) {
1372
+ if (line == "OK") { ok = 1; continue }
1373
+ if (ok || substr(line, 1, 2) != "F:" || ++count > 200) { ok = 0; break }
1374
+ }
1375
+ return close(cmd) == 0 && ok
1376
+ }
1377
+ function option_operand(d, i, family, cwd, uncertain) {
1378
+ return !option_shaped_glob(d, i) || (member("cp rsync", family) && copy_source_glob(d, i, cwd, uncertain))
1379
+ }
1346
1380
  function option_value(d, i, end) {
1347
- return i <= end && K[d, i] == "word" && W[d, i] != "" && (Q[d, i] || W[d, i] !~ /[$`*?\[{}]/)
1381
+ return i <= end && K[d, i] == "word" && W[d, i] != "" && (Q[d, i] || W[d, i] !~ /[$`*?\[{}]/) && !(archive_operands && (GL[d, i] || archive_escape(d, i)))
1348
1382
  }
1349
1383
  # Return the last consumed word, or zero. Option values are data, never another option.
1350
1384
  function option_end(d, i, end, family, old, schema, w, key, kind, j, last) {
@@ -1375,14 +1409,21 @@ function option_end(d, i, end, family, old, schema, w, key, kind, j, last) {
1375
1409
  }
1376
1410
  return last
1377
1411
  }
1378
- function known_options(d, start, end, family, cwd, uncertain, creation, i, w, old, last, schema) {
1412
+ function known_options(d, start, end, family, cwd, uncertain, creation, i, j, w, old, last, schema) {
1379
1413
  schema = creation ? "creation:" family : family
1380
1414
  for (i = start; i <= end; i++) {
1381
1415
  w = W[d, i]
1382
1416
  if (redirection(d, i)) break
1383
- if (w == "--") return !member("unzip jar ar", family)
1417
+ if (archive_operands && archive_escape(d, i)) return 0
1418
+ if (w == "--") {
1419
+ if (member("unzip jar ar", family)) return 0
1420
+ # A terminator is not proof for any family: tool behaviour after it is unverified.
1421
+ if (archive_operands) for (j = i + 1; j <= end && !redirection(d, j); j++) if (!option_operand(d, j, family, cwd, uncertain)) return 0
1422
+ return 1
1423
+ }
1384
1424
  old = member("tar jar ar", family) && i == start && w ~ /^[a-zA-Z]+$/
1385
1425
  if (w !~ /^-/ && !old) {
1426
+ if (archive_operands && !option_operand(d, i, family, cwd, uncertain)) return 0
1386
1427
  if (w ~ /[$`]/ && (!Q[d, i] || DQ[d, i]) && (!DQ[d, i] || resolved(w, Q[d, i], cwd, uncertain, DQ[d, i]) == "!")) return 0
1387
1428
  continue
1388
1429
  }
@@ -1483,10 +1524,12 @@ function archive_command(d, verb, end, cwd, uncertain, fed, family, i, mode)
1483
1524
  if (W[d, i] ~ /^@/) { emit("!archive"); return }
1484
1525
  }
1485
1526
  mode = archive_mode(d, verb + 1, end, family)
1527
+ archive_operands = 1
1486
1528
  if (mode == 2) {
1487
1529
  if (!known_options(d, verb + 1, end, family, cwd, uncertain, 1)) emit("!archive")
1488
1530
  else archive_creation(d, verb, end, cwd, uncertain, family)
1489
1531
  } else if (mode != 1 || !known_options(d, verb + 1, end, family, cwd, uncertain)) emit("!archive")
1532
+ archive_operands = 0
1490
1533
  }
1491
1534
  function creation_output_option(family, flag) {
1492
1535
  return (member("tar jar pax", family) && member("-f --file", flag)) ||
@@ -1942,8 +1985,10 @@ function segment(d, start, end, cwd, uncertain, depth, findpaths, pipe, fed, out
1942
1985
  else if (w == "find") find_command(d, head, end, cwd, context, depth + 1, fed)
1943
1986
  else if (bulk_family(w) != "") {
1944
1987
  if (w == "cp" || w == "rsync") {
1988
+ archive_operands = 1
1945
1989
  if (fed || !known_options(d, head + 1, end, w, cwd, context)) emit("!")
1946
1990
  else copy_effect(d, head, end, cwd, context)
1991
+ archive_operands = 0
1947
1992
  } else archive_command(d, head, end, cwd, context, fed, bulk_family(w))
1948
1993
  }
1949
1994
  else if (destructive(w)) {
@@ -1961,7 +2006,7 @@ function segment(d, start, end, cwd, uncertain, depth, findpaths, pipe, fed, out
1961
2006
  function parse(text, cwd, uncertain, depth, fed, n, i, start, kind, level, head, path, old, j, pipe, data) {
1962
2007
  # Lex before the depth fallback so properly terminated heredoc bodies stay data.
1963
2008
  # A depth slot may be reused by several script words.
1964
- for (i = 1; i <= N[depth]; i++) { delete W[depth, i]; delete Q[depth, i]; delete DQ[depth, i]; delete CT[depth, i]; delete K[depth, i]; delete H[depth, i]; delete T[depth, i]; delete F[depth, i]; BC[depth, i] = 0 }
2009
+ for (i = 1; i <= N[depth]; i++) { delete W[depth, i]; delete Q[depth, i]; delete DQ[depth, i]; delete CT[depth, i]; delete K[depth, i]; delete H[depth, i]; delete T[depth, i]; delete F[depth, i]; delete GL[depth, i]; delete XF[depth, i]; BC[depth, i] = 0 }
1965
2010
  n = lex(text, depth); N[depth] = n; start = 1; level = 0
1966
2011
  if (text ~ /(^|[[:space:]])GIT_[A-Z_]+=/) git_context_unknown = 1
1967
2012
  if (depth == 0) simple_tool = simple_command(text, depth, n)
@@ -2006,7 +2051,9 @@ while [ ! -e "$repository_root/.git" ]; do
2006
2051
  repository_root="${repository_root%/*}"
2007
2052
  [ -n "$repository_root" ] || repository_root=/
2008
2053
  done
2009
- destructive_text="$(GSW_COMMAND="$command_text" GSW_CWD="$cwd" GSW_ROOT="$repository_root" LC_ALL=C awk "$destructive_program" </dev/null)" || parser_failed
2054
+ glob_shell_safe=1
2055
+ if [[ -n "${BASH_ENV+x}" || -n "${ENV+x}" || -n "${GLOBIGNORE+x}" ]]; then glob_shell_safe=0; fi
2056
+ destructive_text="$(GSW_COMMAND="$command_text" GSW_CWD="$cwd" GSW_ROOT="$repository_root" GSW_GLOB_SAFE="$glob_shell_safe" LC_ALL=C awk "$destructive_program" </dev/null)" || parser_failed
2010
2057
  if [ -n "$destructive_text" ]; then
2011
2058
  destructive_candidates=()
2012
2059
  while IFS= read -r candidate; do
@@ -2034,8 +2081,6 @@ if [ -n "$destructive_text" ]; then
2034
2081
  exit 2
2035
2082
  fi
2036
2083
  fi
2037
- glob_shell_safe=1
2038
- if [[ -n "${BASH_ENV+x}" || -n "${ENV+x}" || -n "${GLOBIGNORE+x}" ]]; then glob_shell_safe=0; fi
2039
2084
  candidates_text="$(GSW_COMMAND="$command_text" GSW_CWD="$cwd" GSW_GLOB_SAFE="$glob_shell_safe" GSW_MODE=targets LC_ALL=C awk "$program" </dev/null)" || parser_failed
2040
2085
  [ -n "$candidates_text" ] || exit 0
2041
2086
  # The lowercase alias of a mixed-case path serves case-insensitive file systems. Drop it only where the
@@ -56,8 +56,9 @@ Read the **cratis-arc-elixir** and **cratis-chronicle-client-elixir** skills bef
56
56
  never carries a secret.
57
57
  - **Every slice tells a whole story**: a state change has a command and the events it appends; a view
58
58
  has a read model and consumes events (`consumes:` when it reads the event log); an automation reacts to
59
- an event and records a fact of its own, so the event model shows what it did. A reactor that calls a
60
- third party returns the event recording that it did.
59
+ an event, runs a command and records the fact that command appends, so the event model shows what it
60
+ did. A reactor that calls a third party does not append events itself: it runs a `:system` command
61
+ (`Cratis.Arc.execute/3`) that records the outcome, and the command lives in the reactor's slice folder.
61
62
  - **Order is the story**: a slice that uses events of several sub-features goes in a sub-feature after
62
63
  them. Build with `arc: [event_model_strict: true]` so an incomplete model fails the build.
63
64
  - **Third parties are integrations behind a behaviour**, with an in-memory stand-in for specs; only
@@ -57,7 +57,7 @@ The compiler reports what is incomplete (warnings; errors with `event_model_stri
57
57
  | --- | --- |
58
58
  | a state change without a command, or whose command appends no events | the command must build its event types in its own module |
59
59
  | a view without a read model, or that consumes no events | add a reducer or projection, or `consumes:` |
60
- | an automation that reacts to no event, or records none | have the reactor return the event that says what it did (`SecretRetiredInOry`), not nothing |
60
+ | an automation that reacts to no event, or records none | the reactor runs a command in its slice folder that appends the fact (`RecordSecretRetirement` appends `SecretRetiredInOry`); a slice with a reactor and its command is an automation showing reaction, command and event |
61
61
  | a consumed event no slice produces | the event needs a command appending it |
62
62
  | a fact used before it is produced | move the slice into a sub-feature after the ones it uses |
63
63
 
@@ -29,7 +29,7 @@
29
29
  | Mistake | What happens | Do this |
30
30
  | --- | --- | --- |
31
31
  | A read model module in the parent namespace (`ApiCredentials.Listing` beside `ApiCredentials.Listing.Reducer`) | The view is grouped with the parent feature, not its slice | Put the query module inside the slice folder (`Listing.Queries`) |
32
- | A reactor that returns nothing | The automation slice shows no events | Return the event that records what it did |
32
+ | A reactor that appends events itself or returns nothing | The automation slice shows no command or no events | Have the reactor run a command in its slice folder that appends the fact; Arc shows reaction, command and event |
33
33
  | A view over a model another slice builds | Old Arc showed no events | Arc 1.4 reads them from the reducer; use `consumes:` for a model read from the event log |
34
34
  | Reading the last module segment as the name | The model shows the `id:` | Name by `id:` and keep `display_names:` in mind |
35
35
  | Slices that use events of several sub-features in the parent feature | A fact is drawn after what uses it; validation fails | Give them a sub-feature that follows the others |
@@ -9,7 +9,7 @@
9
9
  | Elixir requirement | `~> 1.18` | `mix.exs` |
10
10
  | Chronicle dependency | `cratis_chronicle ~> 4.0` (modules are `Cratis.Chronicle.*`) | `Source/arc/mix.exs` |
11
11
  | MongoDB driver | `mongodb_driver ~> 1.6` | `Source/arc_mongodb/mix.exs` |
12
- | Release | Source preview. Releases are GitHub tags and Hex may lag them: pin a git tag or a path, and check hex.pm before quoting a version | repository, `gh release list` |
12
+ | Release | Source preview. Every release is published to Hex automatically: depend on `{:cratis_arc, "~> 1.4"}` from Hex, never a path or git reference, and check hex.pm for the current version | repository, `gh release list` |
13
13
  | Module namespace | Everything is `Cratis.Arc.*` (`use Cratis.Arc.Command, id: "..."`); sources are under `Source/arc/lib/cratis/arc/` | repository |
14
14
  | Documented gaps | `Documentation/limits-and-gaps.md` | repository |
15
15
  | Contract | The Arc HTTP contract | Cratis/Arc `Documentation/http-contract.md` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/pi",
3
- "version": "7.189.3",
3
+ "version": "7.189.5",
4
4
  "description": "Configuration-aware Cratis AI integration for Pi",
5
5
  "type": "module",
6
6
  "files": [