@eventmodelers/cli 1.0.72 → 1.0.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -5
- package/RELEASE_NOTES.md +5 -0
- package/cli.js +119 -21
- package/package.json +1 -1
- package/shared/demo-slices/Understanding Eventsourcing/additem/slice.json +176 -0
- package/shared/demo-slices/Understanding Eventsourcing/archiveitem/slice.json +209 -0
- package/shared/demo-slices/Understanding Eventsourcing/cartitems/slice.json +236 -0
- package/shared/demo-slices/Understanding Eventsourcing/cartpublicationfailed/slice.json +65 -0
- package/shared/demo-slices/Understanding Eventsourcing/cartpublished/slice.json +65 -0
- package/shared/demo-slices/Understanding Eventsourcing/cartswithproducts/slice.json +105 -0
- package/shared/demo-slices/Understanding Eventsourcing/changedprices/slice.json +91 -0
- package/shared/demo-slices/Understanding Eventsourcing/changeinventory/slice.json +191 -0
- package/shared/demo-slices/Understanding Eventsourcing/changeprice/slice.json +220 -0
- package/shared/demo-slices/Understanding Eventsourcing/clearcart/slice.json +219 -0
- package/shared/demo-slices/Understanding Eventsourcing/config.json +2631 -0
- package/shared/demo-slices/Understanding Eventsourcing/context.json +3 -0
- package/shared/demo-slices/Understanding Eventsourcing/index.json +132 -0
- package/shared/demo-slices/Understanding Eventsourcing/inventories/slice.json +132 -0
- package/shared/demo-slices/Understanding Eventsourcing/itemadded/slice.json +137 -0
- package/shared/demo-slices/Understanding Eventsourcing/publishcart/slice.json +230 -0
- package/shared/demo-slices/Understanding Eventsourcing/removeitem/slice.json +239 -0
- package/shared/demo-slices/Understanding Eventsourcing/submitcart/slice.json +199 -0
- package/shared/demo-slices/Understanding Eventsourcing/submittedcartdata/slice.json +90 -0
- package/shared/demo-slices/current_context.json +3 -0
- package/stacks/modeling-kit/templates/kit/CLAUDE-STANDALONE.md +8 -6
- package/stacks/modeling-kit/templates/kit/CLAUDE.md +12 -7
package/README.md
CHANGED
|
@@ -38,6 +38,16 @@ npx @eventmodelers/cli init --stack node
|
|
|
38
38
|
|
|
39
39
|
Answer the credential prompts once — the stack's scaffold, skills, and agent loop are all installed in this one step.
|
|
40
40
|
|
|
41
|
+
**Trying it out before you have a board of your own:**
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx @eventmodelers/cli init --stack node --demo
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`--demo` additionally writes a ready-made model into the kit's `.slices/` — the **Understanding Eventsourcing** context, a 16-slice shopping cart covering every slice type (state change, state view, automation, translation). It's ordinary fetched slice data in exactly the shape `fetch` writes, so the build skills, `activate-context`, `set-slice-status`, and the agent loop all work against it immediately, with no board connected. Build one with `/build-state-change` in Claude Code, or start `run` and let the agent work the queue.
|
|
48
|
+
|
|
49
|
+
Nothing downstream treats it specially: `fetch --context <name>` replaces it with your own board whenever you're ready. `--demo` is skipped (with a message) if `.slices/` already holds slices, so it can never overwrite fetched work.
|
|
50
|
+
|
|
41
51
|
**Already initialized — you just want the agent to start working the board:**
|
|
42
52
|
|
|
43
53
|
```bash
|
|
@@ -71,7 +81,8 @@ your-project/
|
|
|
71
81
|
│ ├── ralph-claude.js ← realtime agent + task loop
|
|
72
82
|
│ ├── ralph-ollama.js ← same, via local Ollama
|
|
73
83
|
│ ├── ralph.sh ← bash-only loop (no realtime)
|
|
74
|
-
│
|
|
84
|
+
│ ├── lib/ ← stack-specific agent prompts + helpers
|
|
85
|
+
│ └── .slices/ ← board slices, written by `fetch`/`listen` (or pre-seeded by `init --demo`)
|
|
75
86
|
├── .claude/
|
|
76
87
|
│ └── skills/ ← eventmodelers skills for Claude Code
|
|
77
88
|
├── src/ … (or the stack's own layout)
|
|
@@ -111,6 +122,7 @@ Which skills install depends on the chosen stack — see `stacks/<name>/template
|
|
|
111
122
|
|
|
112
123
|
```bash
|
|
113
124
|
npx @eventmodelers/cli init --stack <name> # scaffold a stack + install + configure (alias: install)
|
|
125
|
+
npx @eventmodelers/cli init --stack <name> --demo # same, plus a ready-made demo model in the kit's .slices/ to build against
|
|
114
126
|
npx @eventmodelers/cli re-init # refresh an already-installed kit's scripts/skills only — never touches the root scaffold
|
|
115
127
|
npx @eventmodelers/cli run # start the agent loop (ralph-claude.js) from the installed kit dir
|
|
116
128
|
npx @eventmodelers/cli run --ollama # same, via local Ollama (ralph-ollama.js)
|
|
@@ -130,7 +142,7 @@ npx @eventmodelers/cli config # print the fully resolved c
|
|
|
130
142
|
|
|
131
143
|
`run` is a thin dispatcher — it just finds the installed kit dir (whatever it's named for the stack) and execs the runner file already sitting in it. The agent loop's actual logic stays in the scaffolded `<kit-dir>/`, not in this package, since you (and the agent itself, via `AGENT.md`) may customize those files per project.
|
|
132
144
|
|
|
133
|
-
`fetch` calls `slicedata?contextName=<name>` for the required `--context` (full slice detail — commands/events/readmodels/screens/processors/specifications/comments), and writes `.slices/<context>/<slice>/slice.json`, `index.json`, and `context.json`. It does not fetch screen images (those only arrive via `listen`'s push, see Power users). Unlike every other command, `fetch` also works with no kit installed at all — it only needs credentials, not kit-specific files. If credentials are missing, it prompts the same way `init-config` does. `--slice-id`/`--slice-title` still fetch and persist the whole context, then just print the one slice you asked about.
|
|
145
|
+
`fetch` calls `slicedata?contextName=<name>` for the required `--context` (full slice detail — commands/events/readmodels/screens/processors/specifications/comments), and writes `.slices/<context>/<slice>/slice.json`, `index.json`, and `context.json`. It does not fetch screen images (those only arrive via `listen`'s push, see Power users). Unlike every other command, `fetch` also works with no kit installed at all — it only needs credentials, not kit-specific files. If credentials are missing, it prompts the same way `init-config` does. `--slice-id`/`--slice-title` still fetch and persist the whole context, then just print the one slice you asked about. `init --demo` seeds that same `.slices/` layout from a bundled example context instead of from a board, for trying the kit out before connecting one.
|
|
134
146
|
|
|
135
147
|
---
|
|
136
148
|
|
|
@@ -284,10 +296,10 @@ windows if the defaults don't suit your board:
|
|
|
284
296
|
|
|
285
297
|
| Env var | Default | What it controls |
|
|
286
298
|
|---|---|---|
|
|
287
|
-
| `EVENTMODELERS_STANDALONE_DEBOUNCE_MS` | `
|
|
299
|
+
| `EVENTMODELERS_STANDALONE_DEBOUNCE_MS` | `2500` | quiet period before buffered board changes turn into a turn — long enough to coalesce one gesture (a placement, a drag) into a single turn |
|
|
288
300
|
| `EVENTMODELERS_STANDALONE_MAX_WAIT_MS` | `90000` | cap on that quiet period, so a board being edited continuously still gets a turn |
|
|
289
|
-
| `EVENTMODELERS_STANDALONE_ECHO_WINDOW_MS` | `
|
|
290
|
-
| `EVENTMODELERS_STANDALONE_MIN_INTERVAL_MS` | `60000` | floor between two self-directed turns |
|
|
301
|
+
| `EVENTMODELERS_STANDALONE_ECHO_WINDOW_MS` | `0` (off) | after a turn, how long an *unattributed* incoming change is labelled as probably the agent's own echo. Off because every event carries `agent_id`/`user_id`, which answers the same question exactly and costs no delay; set it only on a backend whose writes arrive unattributed (the run log names the origin of every change) |
|
|
302
|
+
| `EVENTMODELERS_STANDALONE_MIN_INTERVAL_MS` | `60000` | floor between two self-directed turns — a runaway-loop guard, so a change written from a browser session skips it (a person is not a loop; another agent's write still waits) |
|
|
291
303
|
| `EVENTMODELERS_STANDALONE_BACKOFF_CAP_MS` | `900000` | ceiling that floor doubles up to while turns keep answering `NOOP` |
|
|
292
304
|
| `EVENTMODELERS_STANDALONE_IDLE_MS` | `900000` | with nothing happening at all, how long before the agent reviews the model anyway (`0` disables it) |
|
|
293
305
|
|
|
@@ -541,6 +553,8 @@ npx @eventmodelers/cli uninstall --modeling-kit # remove .agent-modeling-ki
|
|
|
541
553
|
|
|
542
554
|
Each stack lives under `stacks/<name>/templates/` with `.claude/` (skills), `root/` (spread into the project root), and either `build-kit/` (backend stacks) or `kit/` (modeling-only) for the agent runner. Files identical across all backend stacks live once in `shared/build-kit/` and get layered in automatically — only put stack-specific overrides under `stacks/<name>/templates/build-kit/`. Skills with no stack-specific content (`connect`, `learn-eventmodelers-api`, `update-slice-status`, `request-feedback`) work the same way via `shared/skills/` — a new stack gets them for free without copying anything; add a skill there only once it needs a stack-specific fork.
|
|
543
555
|
|
|
556
|
+
The demo model `init --demo` installs is shared the same way, in `shared/demo-slices/` — a verbatim `fetch --format json` tree (`current_context.json` plus `<context>/{context,index,config}.json` and `<slice>/slice.json`), copied as-is into the kit's `.slices/`. It's stack-agnostic board data, so a new stack gets `--demo` for free. To replace or extend it, `fetch` a context into an empty directory and copy the result in, then update `DEMO_CONTEXT_NAME`/`DEMO_SLICE_COUNT` in `cli.js` (used only for the line `init` prints).
|
|
557
|
+
|
|
544
558
|
Once your `init --build-kit` scaffold (see above) works against a real backend, promote it to a first-class stack:
|
|
545
559
|
|
|
546
560
|
1. Copy `.build-kit/` → `stacks/<name>/templates/build-kit/`, `.claude/skills/build-*` → `stacks/<name>/templates/.claude/skills/`, and whatever `root/` scaffold you built → `stacks/<name>/templates/root/`.
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## v1.0.72
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
- `init --demo` seeds the kit's `.slices/` with a ready-made model — the "Understanding Eventsourcing" context, a 16-slice shopping cart covering every slice type — so the `build-*` skills, `activate-context`, `set-slice-status`, and the agent loop all have something real to work on before the project is connected to a board. It is a verbatim `fetch --format json` tree, so nothing downstream has a demo-only path and a later `fetch --context <name>` simply replaces it. Skipped with a message when `.slices/` already holds fetched slices, so it can never overwrite real board state. Works with every install mode (`--stack`, `--modeling`, `--build-kit`, `--bridge`, `--git`); modeling-kit gets it at the project root, matching where `fetch` writes for that kit.
|
|
5
|
+
|
|
1
6
|
## v1.0.56
|
|
2
7
|
|
|
3
8
|
### Features
|
package/cli.js
CHANGED
|
@@ -176,6 +176,11 @@ const BLANK_BUILD_KIT = {
|
|
|
176
176
|
|
|
177
177
|
const KIT_DIR_NAMES = [...new Set([...Object.values(STACKS), MODELING_KIT, BRIDGE_KIT, BLANK_BUILD_KIT].map((s) => s.kitDirName))];
|
|
178
178
|
|
|
179
|
+
// What `init --demo` installs, for the messages it prints. Kept in step with
|
|
180
|
+
// shared/demo-slices/ (context.json's name, and the slice folders beside it).
|
|
181
|
+
const DEMO_CONTEXT_NAME = 'Understanding Eventsourcing';
|
|
182
|
+
const DEMO_SLICE_COUNT = 16;
|
|
183
|
+
|
|
179
184
|
// Same principle Playwright MCP uses per harness: one shared server, but each coding
|
|
180
185
|
// agent has its own registration mechanism. Automate the ones with a real, verified
|
|
181
186
|
// CLI install command; for the rest, print manual steps instead of guessing at an
|
|
@@ -1009,6 +1014,14 @@ async function installStack(stackKey, stackCfg, options = {}) {
|
|
|
1009
1014
|
}
|
|
1010
1015
|
}
|
|
1011
1016
|
|
|
1017
|
+
// --- 3c. Opt-in demo model (`init --demo`) ---
|
|
1018
|
+
// After the kit dir exists (the .slices/ tree nests inside it for every kit but
|
|
1019
|
+
// modeling-kit) and before npm install/credentials, so the "demo installed" line
|
|
1020
|
+
// lands with the rest of the file copying rather than after a credential prompt.
|
|
1021
|
+
if (options.demo) {
|
|
1022
|
+
installDemoSlices({ kitDir, targetDir, stackCfg });
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1012
1025
|
// --- 4. Install kit dependencies ---
|
|
1013
1026
|
// modeling-kit's package.json has no dependencies at all — it exists purely for its
|
|
1014
1027
|
// `"type": "module"`, so lib/config.js can be ESM-imported. Running npm for that buys
|
|
@@ -1281,6 +1294,46 @@ async function configureMcp(options = {}) {
|
|
|
1281
1294
|
// standalone `init-hooks` command so all three copy/chmod/git-config identically
|
|
1282
1295
|
// instead of drifting apart — callers are responsible for checking `hooksSrc`
|
|
1283
1296
|
// exists first, since what "no template for this stack" means differs per caller.
|
|
1297
|
+
// `init --demo` — drop a ready-made .slices/ tree into the install so the build
|
|
1298
|
+
// skills (and `activate-context`/`slice-status`/the agent loop) have something real
|
|
1299
|
+
// to work on before the project is ever connected to a board. The tree under
|
|
1300
|
+
// shared/demo-slices/ is a verbatim `fetch --format json` output for the
|
|
1301
|
+
// "Understanding Eventsourcing" context (a 16-slice shopping-cart model, every slice
|
|
1302
|
+
// type represented), so it is byte-identical in shape to what a real fetch writes —
|
|
1303
|
+
// a later `fetch` just overwrites it, and nothing downstream needs a demo-only path.
|
|
1304
|
+
//
|
|
1305
|
+
// The destination mirrors `fetch`'s own resolution exactly (see the SLICES_DIR comment
|
|
1306
|
+
// there): nested under the kit dir for every kit whose code-export.mjs hardcodes
|
|
1307
|
+
// `.slices/` next to itself, and at the project root for modeling-kit, which has no
|
|
1308
|
+
// code-export.mjs and no skill reading a nested copy.
|
|
1309
|
+
function installDemoSlices({ kitDir, targetDir, stackCfg }) {
|
|
1310
|
+
const slicesDir = stackCfg.kitDirName === MODELING_KIT.kitDirName
|
|
1311
|
+
? join(targetDir, '.slices')
|
|
1312
|
+
: join(kitDir, '.slices');
|
|
1313
|
+
const rel = relative(targetDir, slicesDir) || '.slices';
|
|
1314
|
+
|
|
1315
|
+
// An existing .slices/ is fetched board state — the user's real model. The copy
|
|
1316
|
+
// below merges rather than replaces, so installing over it would leave a half-demo,
|
|
1317
|
+
// half-real tree with a current_context.json pointing at the wrong one. Refuse
|
|
1318
|
+
// instead. Deliberately not overridable by --force: that flag means "don't re-ask
|
|
1319
|
+
// about credentials", never "discard fetched work".
|
|
1320
|
+
if (existsSync(slicesDir) && readdirSync(slicesDir).length > 0) {
|
|
1321
|
+
console.log(` ℹ️ --demo skipped — ${rel}/ already has slices in it (delete it first if you really want the demo model)`);
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
const demoSrc = join(__dirname, 'shared', 'demo-slices');
|
|
1326
|
+
if (!existsSync(demoSrc)) {
|
|
1327
|
+
console.log(' ℹ️ --demo was given but this CLI build ships no shared/demo-slices/ — nothing to install');
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
console.log('📦 Installing the demo model...');
|
|
1332
|
+
copyDirContents(demoSrc, slicesDir);
|
|
1333
|
+
console.log(` ✓ Demo context "${DEMO_CONTEXT_NAME}" (${DEMO_SLICE_COUNT} slices) is active in ${rel}/`);
|
|
1334
|
+
console.log(' ℹ️ It is ordinary fetched slice data — `fetch --context <name>` replaces it with your own board whenever you are ready');
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1284
1337
|
function configureHooks({ hooksSrc, targetDir }) {
|
|
1285
1338
|
copyDirContents(hooksSrc, join(targetDir, '.githooks'));
|
|
1286
1339
|
const preCommitHook = join(targetDir, '.githooks', 'pre-commit');
|
|
@@ -1890,11 +1943,17 @@ async function runModeling(kitDir, projectDir, { verbose = false, standalone = f
|
|
|
1890
1943
|
}
|
|
1891
1944
|
|
|
1892
1945
|
// A standalone session is long-lived and spends most of its life waiting, so the setup
|
|
1893
|
-
// every turn needs — read CLAUDE.md, run /connect,
|
|
1894
|
-
// startup instead of being paid by whoever happens to send the first prompt. By the
|
|
1895
|
-
// a real turn arrives the credentials are resolved and the
|
|
1896
|
-
//
|
|
1897
|
-
//
|
|
1946
|
+
// every turn needs — read CLAUDE.md, run /connect, find out which chapters exist — is done
|
|
1947
|
+
// once at startup instead of being paid by whoever happens to send the first prompt. By the
|
|
1948
|
+
// time a real turn arrives the credentials are resolved and the turn is straight into the
|
|
1949
|
+
// work. It reads only: nothing is placed, no prompt status is touched (there is no prompt_id
|
|
1950
|
+
// here), no subagent is dispatched.
|
|
1951
|
+
//
|
|
1952
|
+
// What it deliberately does *not* do is read the board. Reading every chapter up front cost a
|
|
1953
|
+
// minute and a dollar before anyone had asked for anything, on a board where a turn typically
|
|
1954
|
+
// touches one chapter — and it front-loaded the context every later turn then carries. Chapters
|
|
1955
|
+
// are read lazily instead: the first turn with business in one fetches its outline and keeps it
|
|
1956
|
+
// for the rest of the session, so the cost is paid once and only for chapters that see work.
|
|
1898
1957
|
const WARM_UP_TASK =
|
|
1899
1958
|
'This is the session warm-up, before any prompt or board change — nobody has asked for anything yet, and ' +
|
|
1900
1959
|
'there is nothing to sanitize, no prompt_id and no progress entry. Do exactly this and then stop: ' +
|
|
@@ -1902,11 +1961,13 @@ async function runModeling(kitDir, projectDir, { verbose = false, standalone = f
|
|
|
1902
1961
|
'one-time reads for this session — do NOT read .agent-modeling-kit/CLAUDE-STANDALONE.md, that one still ' +
|
|
1903
1962
|
'waits for the first self-directed turn; (2) invoke /connect with the credentials above and ' +
|
|
1904
1963
|
`board=${cfg.boardId} — this is the session's one-time connect, so no later turn runs it again; ` +
|
|
1905
|
-
'(3)
|
|
1906
|
-
'
|
|
1907
|
-
'
|
|
1908
|
-
'
|
|
1909
|
-
'
|
|
1964
|
+
'(3) learn which chapters exist, and nothing beyond that: one get_chapter_bounds call returns every ' +
|
|
1965
|
+
'chapter\'s id and title. Do NOT read any chapter\'s contents here — no get_board_outline, no ' +
|
|
1966
|
+
'per-chapter get_nodes, and skip the board read /connect Step 5 would otherwise have you do. A chapter ' +
|
|
1967
|
+
'is read on the first turn that actually has business in it, and kept for the rest of the session ' +
|
|
1968
|
+
'from then on. Change nothing: no nodes, no comments, no slice statuses, no subagents. Reply ' +
|
|
1969
|
+
'<promise>READY</promise> with the chapter list — titles and how many; say nothing about what is in ' +
|
|
1970
|
+
'them, you have not looked.';
|
|
1910
1971
|
|
|
1911
1972
|
function buildWarmUpTurn() {
|
|
1912
1973
|
const header = ['SESSION_START', `board_id=${cfg.boardId}`, `organization_id=${cfg.organizationId}`].join(' ');
|
|
@@ -1918,7 +1979,7 @@ async function runModeling(kitDir, projectDir, { verbose = false, standalone = f
|
|
|
1918
1979
|
function warmUpSession() {
|
|
1919
1980
|
if (warmUp) return warmUp;
|
|
1920
1981
|
if (!standalone) return (warmUp = Promise.resolve());
|
|
1921
|
-
log('warm-up: connecting and
|
|
1982
|
+
log('warm-up: connecting and listing chapters before the first turn (chapters are read on first use)');
|
|
1922
1983
|
warmingUp = true;
|
|
1923
1984
|
warmUp = sendTurn(buildWarmUpTurn())
|
|
1924
1985
|
.then((result) => log(`warm-up done — ${oneLine(result, 200) || 'session ready'}`))
|
|
@@ -2050,7 +2111,15 @@ async function runModeling(kitDir, projectDir, { verbose = false, standalone = f
|
|
|
2050
2111
|
// org prompt queue, so the non-standalone case joins it too and simply throws every
|
|
2051
2112
|
// event away (see onBoardEvent). One code path either way — and whatever the backend
|
|
2052
2113
|
// later adds to these payloads lands here without a client change.
|
|
2053
|
-
|
|
2114
|
+
//
|
|
2115
|
+
// The edge events are deliberately *not* in this list. An edge is almost never a change
|
|
2116
|
+
// on its own: placing an element auto-connects it to its neighbours, so `edge:added`
|
|
2117
|
+
// arrives as the tail of a `node:created` this loop already woke up for — the same
|
|
2118
|
+
// gesture counted twice, and counted onto `(board)` rather than onto a node, since an
|
|
2119
|
+
// edge payload names no single node to go look at. Wiring an existing chain by hand says
|
|
2120
|
+
// nothing about the model's content either. Subscribing to them bought a second turn per
|
|
2121
|
+
// placement and nothing else, so board changes here mean node changes.
|
|
2122
|
+
const BOARD_CHANGE_EVENTS = ['node:created', 'node:changed', 'node:deleted', 'board:cleared'];
|
|
2054
2123
|
|
|
2055
2124
|
// Four knobs. They govern *when* a self-directed turn fires — never whether an event is
|
|
2056
2125
|
// remembered: everything that arrives is buffered (see onBoardEvent), so a burst that
|
|
@@ -2068,10 +2137,17 @@ async function runModeling(kitDir, projectDir, { verbose = false, standalone = f
|
|
|
2068
2137
|
// ECHO_WINDOW — how long after a turn its own writes are expected back; an
|
|
2069
2138
|
// *unattributed* change in that window is labelled a possible echo, and
|
|
2070
2139
|
// the next turn waits it out so a write and its echo don't each get one.
|
|
2140
|
+
// Off by default: it predates the `agent_id` above, which answers the same
|
|
2141
|
+
// question exactly and for free, and every turn paid its delay to cover a
|
|
2142
|
+
// residue of unattributed writes that a stamping backend never produces.
|
|
2143
|
+
// Set it (ms) on a backend where the logs below do show unattributed
|
|
2144
|
+
// changes.
|
|
2071
2145
|
// MIN_INTERVAL — a floor between self-directed turns, so a mistake upstream can't
|
|
2072
2146
|
// become a self-feeding loop burning tokens unattended. Doubles per
|
|
2073
2147
|
// consecutive NOOP up to BACKOFF_CAP, and resets as soon as a turn
|
|
2074
|
-
// actually does something.
|
|
2148
|
+
// actually does something. A person's edit is exempt (see
|
|
2149
|
+
// dispatchStandaloneTurn): a human cannot be the loop, and waiting a
|
|
2150
|
+
// minute before reacting to them is the whole latency complaint.
|
|
2075
2151
|
// IDLE — with nothing at all happening on the board, how long before the agent
|
|
2076
2152
|
// looks the model over anyway (a BOARD_REVIEW turn). 0 disables it, and
|
|
2077
2153
|
// it answers to the same MIN_INTERVAL backoff, so a board with nothing
|
|
@@ -2080,18 +2156,22 @@ async function runModeling(kitDir, projectDir, { verbose = false, standalone = f
|
|
|
2080
2156
|
const raw = Number(process.env[name]);
|
|
2081
2157
|
return Number.isFinite(raw) && raw >= 0 ? raw : fallback;
|
|
2082
2158
|
};
|
|
2083
|
-
const STANDALONE_DEBOUNCE_MS = envMs('EVENTMODELERS_STANDALONE_DEBOUNCE_MS',
|
|
2159
|
+
const STANDALONE_DEBOUNCE_MS = envMs('EVENTMODELERS_STANDALONE_DEBOUNCE_MS', 2_500);
|
|
2084
2160
|
const STANDALONE_MAX_WAIT_MS = envMs('EVENTMODELERS_STANDALONE_MAX_WAIT_MS', 90_000);
|
|
2085
|
-
const STANDALONE_ECHO_WINDOW_MS = envMs('EVENTMODELERS_STANDALONE_ECHO_WINDOW_MS',
|
|
2161
|
+
const STANDALONE_ECHO_WINDOW_MS = envMs('EVENTMODELERS_STANDALONE_ECHO_WINDOW_MS', 0);
|
|
2086
2162
|
const STANDALONE_MIN_INTERVAL_MS = envMs('EVENTMODELERS_STANDALONE_MIN_INTERVAL_MS', 60_000);
|
|
2087
2163
|
const STANDALONE_BACKOFF_CAP_MS = envMs('EVENTMODELERS_STANDALONE_BACKOFF_CAP_MS', 15 * 60_000);
|
|
2088
2164
|
const STANDALONE_IDLE_MS = envMs('EVENTMODELERS_STANDALONE_IDLE_MS', 15 * 60_000);
|
|
2089
2165
|
|
|
2090
|
-
// node_id (or '(board)') -> { types: Set<string>, count, own, other, maybe } for
|
|
2166
|
+
// node_id (or '(board)') -> { types: Set<string>, count, own, other, maybe, person } for
|
|
2091
2167
|
// everything seen since the last self-directed turn, each event counted into exactly one
|
|
2092
2168
|
// origin bucket: `own` = attributed to this agent's own id, `other` = attributed to a human
|
|
2093
2169
|
// or another agent, `maybe` = carries no attribution at all and landed inside the echo
|
|
2094
2170
|
// window, so it *might* be this agent's. Only `maybe` is a guess.
|
|
2171
|
+
// `person` counts, alongside the bucket, the subset of `other` written from a browser
|
|
2172
|
+
// session rather than by another agent. It is what lets a human's edit skip the
|
|
2173
|
+
// MIN_INTERVAL floor: a person cannot be this agent's feedback loop, whereas two agents on
|
|
2174
|
+
// one board can ping-pong, so another agent's write keeps waiting its turn.
|
|
2095
2175
|
const observed = new Map();
|
|
2096
2176
|
let observedCount = 0;
|
|
2097
2177
|
let seqLo = null;
|
|
@@ -2144,10 +2224,12 @@ async function runModeling(kitDir, projectDir, { verbose = false, standalone = f
|
|
|
2144
2224
|
? 'maybe'
|
|
2145
2225
|
: 'other';
|
|
2146
2226
|
const nodeId = payload?.node_id ?? '(board)';
|
|
2147
|
-
const entry = observed.get(nodeId) ?? { types: new Set(), count: 0, own: 0, other: 0, maybe: 0 };
|
|
2227
|
+
const entry = observed.get(nodeId) ?? { types: new Set(), count: 0, own: 0, other: 0, maybe: 0, person: 0 };
|
|
2148
2228
|
entry.types.add(type);
|
|
2149
2229
|
entry.count += 1;
|
|
2150
2230
|
entry[origin] += 1;
|
|
2231
|
+
// A browser session id and no agent id: a human at the canvas.
|
|
2232
|
+
if (writerUser && !writerAgent) entry.person += 1;
|
|
2151
2233
|
observed.set(nodeId, entry);
|
|
2152
2234
|
observedCount += 1;
|
|
2153
2235
|
if (!firstObservedAt) firstObservedAt = Date.now();
|
|
@@ -2220,9 +2302,11 @@ async function runModeling(kitDir, projectDir, { verbose = false, standalone = f
|
|
|
2220
2302
|
'best target for them, not a reason to wait, and the board was already quiet before this turn was ' +
|
|
2221
2303
|
'handed to you. Only board-wide sweeps and structural moves (renames, deletions, re-shaping, slice ' +
|
|
2222
2304
|
'statuses) get a comment first instead of being done. An unanswered question you posted earlier parks ' +
|
|
2223
|
-
'that one sweep, never the fill-in work. Read
|
|
2224
|
-
'get_nodes,
|
|
2225
|
-
'
|
|
2305
|
+
'that one sweep, never the fill-in work. Read what this turn needs and no more: every nodeId above in one ' +
|
|
2306
|
+
'get_nodes, plus one get_board_outline for each chapter they land in that you have not already read this ' +
|
|
2307
|
+
'session — a chapter you already hold is not fetched again, you carry it forward and apply this turn\'s ' +
|
|
2308
|
+
'changes to your copy. A full-meta read only on the nodes you conclude you will actually touch. ' +
|
|
2309
|
+
'You do the analysis: look at every entry above, decide what ' +
|
|
2226
2310
|
'actually needs doing, and then work in parallel rather than serially — dispatch one Agent per piece of ' +
|
|
2227
2311
|
'work that needs doing, all in a single message, merging pieces that share a slice or chain so no two ' +
|
|
2228
2312
|
`agents write to the same area. ${AGENT_BUDGET} Read .agent-modeling-kit/CLAUDE-STANDALONE.md now (once ` +
|
|
@@ -2306,12 +2390,20 @@ async function runModeling(kitDir, projectDir, { verbose = false, standalone = f
|
|
|
2306
2390
|
else armStandaloneTurn(nextDelayMs());
|
|
2307
2391
|
return;
|
|
2308
2392
|
}
|
|
2393
|
+
// The floor is a runaway-loop guard, and a person is not a loop. Making a human wait out
|
|
2394
|
+
// MIN_INTERVAL before their edit is even looked at is most of the delay they feel, and it
|
|
2395
|
+
// guards nothing: the loop it exists to stop is this agent (or another one) reacting to a
|
|
2396
|
+
// write and writing again, which `person` excludes by construction.
|
|
2397
|
+
const byPerson = !idle && [...observed.values()].some((entry) => entry.person > 0);
|
|
2309
2398
|
const waitLeft = minIntervalMs() - (Date.now() - lastStandaloneAt);
|
|
2310
|
-
if (lastStandaloneAt && waitLeft > 0) {
|
|
2399
|
+
if (lastStandaloneAt && waitLeft > 0 && !byPerson) {
|
|
2311
2400
|
if (idle) armIdleReview();
|
|
2312
2401
|
else armStandaloneTurn(waitLeft);
|
|
2313
2402
|
return;
|
|
2314
2403
|
}
|
|
2404
|
+
if (byPerson && lastStandaloneAt && waitLeft > 0) {
|
|
2405
|
+
log(`standalone floor skipped: a person edited the board (${Math.round(waitLeft / 1000)}s of min-interval left)`);
|
|
2406
|
+
}
|
|
2315
2407
|
const text = idle ? buildIdleReviewTurn() : buildStandaloneTurn();
|
|
2316
2408
|
if (idle) {
|
|
2317
2409
|
log(`standalone review turn: board quiet for ${Math.round(STANDALONE_IDLE_MS / 1000)}s`);
|
|
@@ -2533,6 +2625,7 @@ credentialFlags(program
|
|
|
2533
2625
|
.option('--hook <command>', 'Persist a default shell command hook for `bridge` to run per batch of slice changes instead of Claude/Ollama (e.g. commit + push .slices/ for a CI pipeline to pick up) — only meaningful with --bridge. Can also be set per-run with `bridge --hook`.')
|
|
2534
2626
|
.option('--build-kit', 'Install a blank build-kit scaffold (.build-kit/ + .claude/skills/build-*/SKILL.md placeholders, all TODO-marked) for a stack not built into this CLI yet — no fixed backend. Mutually exclusive with --stack/--modeling/--bridge.')
|
|
2535
2627
|
.option('--hooks', 'Install the slice commit-scope guard (.githooks/pre-commit, running .build-kit/lib/check-commit-scope.cjs) and wire it up via `git config core.hooksPath .githooks` — only meaningful with --stack (build-kit stacks). Off by default.')
|
|
2628
|
+
.option('--demo', 'Install a ready-made demo model into the kit\'s .slices/ — the "Understanding Eventsourcing" context (16 shopping-cart slices covering every slice type), in exactly the shape `fetch` writes, so the build skills and the agent loop have something real to work on before this project is connected to a board. Skipped if .slices/ already holds fetched slices. Off by default.')
|
|
2536
2629
|
.option('--global', 'Install skills into ~/.claude/skills/ instead of the project — available in every project')
|
|
2537
2630
|
.option('-f, --force', 'Re-prompt for credentials even if a config already has everything required — overwrites the existing config.json')
|
|
2538
2631
|
.option(...AGENT_NAME_OPTION))
|
|
@@ -2554,6 +2647,7 @@ credentialFlags(program
|
|
|
2554
2647
|
global: opts.global,
|
|
2555
2648
|
force: opts.force,
|
|
2556
2649
|
credentialOverrides: { ...credentialOverridesFromOpts(opts), ...identityOverridesFromOpts(opts) },
|
|
2650
|
+
demo: opts.demo,
|
|
2557
2651
|
});
|
|
2558
2652
|
return;
|
|
2559
2653
|
}
|
|
@@ -2565,6 +2659,7 @@ credentialFlags(program
|
|
|
2565
2659
|
global: opts.global,
|
|
2566
2660
|
force: opts.force,
|
|
2567
2661
|
credentialOverrides: { ...credentialOverridesFromOpts(opts), ...identityOverridesFromOpts(opts) },
|
|
2662
|
+
demo: opts.demo,
|
|
2568
2663
|
});
|
|
2569
2664
|
return;
|
|
2570
2665
|
}
|
|
@@ -2584,6 +2679,7 @@ credentialFlags(program
|
|
|
2584
2679
|
global: opts.global,
|
|
2585
2680
|
force: opts.force,
|
|
2586
2681
|
credentialOverrides: { ...credentialOverridesFromOpts(opts), ...identityOverridesFromOpts(opts) },
|
|
2682
|
+
demo: opts.demo,
|
|
2587
2683
|
target: opts.target,
|
|
2588
2684
|
});
|
|
2589
2685
|
// Deliberately NOT under .bridge-kit/.eventmodelers/ — that whole name is
|
|
@@ -2622,6 +2718,7 @@ credentialFlags(program
|
|
|
2622
2718
|
global: opts.global,
|
|
2623
2719
|
force: opts.force,
|
|
2624
2720
|
credentialOverrides: { ...credentialOverridesFromOpts(opts), ...identityOverridesFromOpts(opts) },
|
|
2721
|
+
demo: opts.demo,
|
|
2625
2722
|
templatesSource: join(clonedDir, 'templates'),
|
|
2626
2723
|
hooks: opts.hooks,
|
|
2627
2724
|
});
|
|
@@ -2635,6 +2732,7 @@ credentialFlags(program
|
|
|
2635
2732
|
global: opts.global,
|
|
2636
2733
|
force: opts.force,
|
|
2637
2734
|
credentialOverrides: { ...credentialOverridesFromOpts(opts), ...identityOverridesFromOpts(opts) },
|
|
2735
|
+
demo: opts.demo,
|
|
2638
2736
|
hooks: opts.hooks,
|
|
2639
2737
|
});
|
|
2640
2738
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventmodelers/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.73",
|
|
4
4
|
"description": "Eventmodelers CLI — real-time Claude agent + skills for Claude Code, for any stack (Node, Supabase, Axon, Cratis, OpenCQRS, UmaDB, Kurrent, or modeling-only)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "6829844f-fbb5-41ab-b948-fdef54c7e9c1",
|
|
3
|
+
"status": "Planned",
|
|
4
|
+
"title": "Add Item",
|
|
5
|
+
"context": "Understanding Eventsourcing",
|
|
6
|
+
"sliceType": "STATE_CHANGE",
|
|
7
|
+
"commands": [
|
|
8
|
+
{
|
|
9
|
+
"id": "75ed140d-12c0-44f9-bf81-c2fa4886cf9d",
|
|
10
|
+
"tags": [],
|
|
11
|
+
"lane": "Interaction",
|
|
12
|
+
"modelContext": "Understanding Eventsourcing",
|
|
13
|
+
"slice": "Add Item",
|
|
14
|
+
"title": "Add Item",
|
|
15
|
+
"fields": [
|
|
16
|
+
{
|
|
17
|
+
"name": "aggregateId",
|
|
18
|
+
"type": "UUID",
|
|
19
|
+
"example": "",
|
|
20
|
+
"mapping": "",
|
|
21
|
+
"optional": false,
|
|
22
|
+
"subfields": [],
|
|
23
|
+
"cardinality": "Single",
|
|
24
|
+
"idAttribute": false
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "description",
|
|
28
|
+
"type": "String",
|
|
29
|
+
"example": "",
|
|
30
|
+
"mapping": "",
|
|
31
|
+
"optional": false,
|
|
32
|
+
"subfields": [],
|
|
33
|
+
"cardinality": "Single",
|
|
34
|
+
"idAttribute": false
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "image",
|
|
38
|
+
"type": "String",
|
|
39
|
+
"example": "",
|
|
40
|
+
"mapping": "",
|
|
41
|
+
"optional": false,
|
|
42
|
+
"subfields": [],
|
|
43
|
+
"cardinality": "Single",
|
|
44
|
+
"idAttribute": false
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "price",
|
|
48
|
+
"type": "Double",
|
|
49
|
+
"example": "",
|
|
50
|
+
"mapping": "",
|
|
51
|
+
"optional": false,
|
|
52
|
+
"subfields": [],
|
|
53
|
+
"cardinality": "Single",
|
|
54
|
+
"idAttribute": false
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "itemId",
|
|
58
|
+
"type": "UUID",
|
|
59
|
+
"example": "",
|
|
60
|
+
"mapping": "",
|
|
61
|
+
"optional": false,
|
|
62
|
+
"subfields": [],
|
|
63
|
+
"cardinality": "Single",
|
|
64
|
+
"idAttribute": false
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "productId",
|
|
68
|
+
"type": "UUID",
|
|
69
|
+
"example": "",
|
|
70
|
+
"mapping": "",
|
|
71
|
+
"optional": false,
|
|
72
|
+
"subfields": [],
|
|
73
|
+
"cardinality": "Single",
|
|
74
|
+
"idAttribute": false
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
"type": "COMMAND",
|
|
78
|
+
"description": "",
|
|
79
|
+
"aggregate": "default",
|
|
80
|
+
"aggregateDependencies": [],
|
|
81
|
+
"dependencies": [
|
|
82
|
+
{
|
|
83
|
+
"id": "a39b1e41-7b38-42b1-8ad3-c9cc18ca2f7c",
|
|
84
|
+
"type": "OUTBOUND",
|
|
85
|
+
"title": "Cart Created",
|
|
86
|
+
"elementType": "EVENT"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"id": "544d0a8c-809c-4670-a9d9-aa8259f43c46",
|
|
90
|
+
"type": "OUTBOUND",
|
|
91
|
+
"title": "Item Added",
|
|
92
|
+
"elementType": "EVENT"
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
"apiEndpoint": "",
|
|
96
|
+
"createsAggregate": false,
|
|
97
|
+
"triggers": [],
|
|
98
|
+
"elementCopy": false,
|
|
99
|
+
"linkedId": "75ed140d-12c0-44f9-bf81-c2fa4886cf9d",
|
|
100
|
+
"sketched": false,
|
|
101
|
+
"prototype": {
|
|
102
|
+
"activeByDefault": false
|
|
103
|
+
},
|
|
104
|
+
"comments": []
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"events": [
|
|
108
|
+
{
|
|
109
|
+
"id": "a39b1e41-7b38-42b1-8ad3-c9cc18ca2f7c",
|
|
110
|
+
"tags": [],
|
|
111
|
+
"lane": "Events",
|
|
112
|
+
"modelContext": "Understanding Eventsourcing",
|
|
113
|
+
"slice": "Add Item",
|
|
114
|
+
"title": "Cart Created",
|
|
115
|
+
"fields": [
|
|
116
|
+
{
|
|
117
|
+
"name": "aggregateId",
|
|
118
|
+
"type": "UUID",
|
|
119
|
+
"example": "",
|
|
120
|
+
"mapping": "",
|
|
121
|
+
"optional": false,
|
|
122
|
+
"subfields": [],
|
|
123
|
+
"cardinality": "Single",
|
|
124
|
+
"idAttribute": false
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"type": "EVENT",
|
|
128
|
+
"description": "",
|
|
129
|
+
"aggregate": "default",
|
|
130
|
+
"aggregateDependencies": [],
|
|
131
|
+
"dependencies": [
|
|
132
|
+
{
|
|
133
|
+
"id": "22511305-2296-43ba-b8e8-d786d53cd25f",
|
|
134
|
+
"type": "OUTBOUND",
|
|
135
|
+
"title": "Carts with Products",
|
|
136
|
+
"elementType": "READMODEL"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "631c5aa8-0f9e-4a8f-b7f6-91174cae2b82",
|
|
140
|
+
"type": "OUTBOUND",
|
|
141
|
+
"title": "cart items",
|
|
142
|
+
"elementType": "READMODEL"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "75ed140d-12c0-44f9-bf81-c2fa4886cf9d",
|
|
146
|
+
"type": "INBOUND",
|
|
147
|
+
"title": "Add Item",
|
|
148
|
+
"elementType": "COMMAND"
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
"apiEndpoint": "",
|
|
152
|
+
"createsAggregate": false,
|
|
153
|
+
"triggers": [],
|
|
154
|
+
"elementCopy": false,
|
|
155
|
+
"linkedId": "a39b1e41-7b38-42b1-8ad3-c9cc18ca2f7c",
|
|
156
|
+
"sketched": false,
|
|
157
|
+
"prototype": {
|
|
158
|
+
"activeByDefault": false
|
|
159
|
+
},
|
|
160
|
+
"comments": []
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"readmodels": [],
|
|
164
|
+
"screens": [],
|
|
165
|
+
"screenImages": [],
|
|
166
|
+
"screenLayouts": [],
|
|
167
|
+
"processors": [],
|
|
168
|
+
"tables": [],
|
|
169
|
+
"specifications": [],
|
|
170
|
+
"storylines": [],
|
|
171
|
+
"chapter": "Understanding Eventsourcing",
|
|
172
|
+
"codeGen": {},
|
|
173
|
+
"notes": [],
|
|
174
|
+
"comments": [],
|
|
175
|
+
"aggregates": []
|
|
176
|
+
}
|