@eventmodelers/cli 1.0.69 → 1.0.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +9 -5
  2. package/cli.js +22 -19
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -211,8 +211,10 @@ starting in one command. Resolution order for a run is `--credentials` and the i
211
211
  `--token`/`--organization-id`/`--board-id`/`--base-url` flags, then `EVENTMODELERS_*` env vars,
212
212
  then `~/.eventmodelers/boards/<board>.json`, then the usual `.eventmodelers/config.json` walk,
213
213
  and finally the account's default board. Whatever a run resolves is saved back to the
214
- per-board file (`0600`, in a `0700` directory) along with a stable agent id for the board's
215
- alive-ping. One machine can therefore drive several boards, across several accounts, at once.
214
+ per-board file (`0600`, in a `0700` directory). The agent id is *not* stored there a standalone
215
+ run mints a fresh one each time, so two ad-hoc agents on one board stay two agents (see
216
+ [Naming an agent](#naming-an-agent)). One machine can therefore drive several boards, across
217
+ several accounts, at once.
216
218
  The global kit itself holds no credentials at all — the token reaches `claude` through the
217
219
  spawned process's environment.
218
220
 
@@ -401,16 +403,18 @@ npx @eventmodelers/cli init-config --name ci-builder # name the agent this c
401
403
 
402
404
  ### Naming an agent
403
405
 
404
- Every agent identifies itself to the platform with a stable `agentId` it mints on first use (per project, or per board for `run --standalone`), and the board's live-agent view shows that bare uuid. `--name` gives it a readable one instead accepted by `init`, `re-init`, and `init-config`, saved into `config.json` as `agentName`, and sent with every heartbeat from then on:
406
+ Every agent identifies itself to the platform with an `agentId`, and the board's live-agent view shows that bare uuid. A **project install** mints one on first use and reuses it on every restart (`agentIds` in the project root's `.eventmodelers/config.json`). A **standalone/global run** mints a fresh one per run instead: nothing stops two ad-hoc agents running for one board, and since the heartbeat is keyed on `(token, agentId, agentType)`, a shared id would make the second agent replace the first — one agent visible however many are running, and their board writes indistinguishable.
407
+
408
+ `--name` gives an agent a readable label instead of the uuid — accepted by `init`, `re-init`, and `init-config`, saved into `config.json` as `agentName`, and sent with every heartbeat from then on:
405
409
 
406
410
  ```bash
407
411
  npx @eventmodelers/cli init --stack node --name ci-builder # persisted for every later run of this kit
408
412
  npx @eventmodelers/cli init-config --name martins-laptop # same, without re-installing
409
413
  npx @eventmodelers/cli run --name one-off-check # override for a single run, nothing written
410
- npx @eventmodelers/cli run --id <id> # …and a second agent of the same type, side by side
414
+ npx @eventmodelers/cli run --id <id> # pin ONE identity across restarts
411
415
  ```
412
416
 
413
- The heartbeat is keyed on `(token, agentId, agentType)`, so two agents of the same type in one project need distinct ids to both show up — that's what `run --id` is for. `run --id`/`run --name` are per-run only: the persisted `agentName` (and the minted id) stay untouched, so the next plain `run` is the same agent the platform already knows.
417
+ `run --id` is what you want when an agent has to keep the same identity every time it starts: a supervisor that already knows the id, a second agent of the same type in one *project* (which would otherwise share the project's single minted id), or an agent a board has starred as its **preferred agent** that star addresses prompts to one id, so an agent whose id changes per run loses it on restart. `run --id`/`run --name` are per-run only: nothing is written to disk.
414
418
 
415
419
  ### Env vars and `--config` (scripted/CI installs)
416
420
 
package/cli.js CHANGED
@@ -1390,7 +1390,7 @@ function ensureEnvToken(targetDir, token) {
1390
1390
  const GLOBAL_DIR = join(homedir(), '.eventmodelers');
1391
1391
  const GLOBAL_KIT_DIR = join(GLOBAL_DIR, 'kit');
1392
1392
 
1393
- // One file per board: `{token, organizationId, boardId, baseUrl, agentId}`. Credentials
1393
+ // One file per board: `{token, organizationId, boardId, baseUrl}`. Credentials
1394
1394
  // ARE per board — a token is scoped to the org that owns it — so one machine can drive
1395
1395
  // several boards across several accounts at once, each with its own. Written 0600 in a
1396
1396
  // 0700 dir: unlike a project's .eventmodelers/config.json, there is no .gitignore standing
@@ -1408,21 +1408,20 @@ function boardCredentialsPath(boardId) {
1408
1408
  function writeBoardCredentials(config) {
1409
1409
  const path = boardCredentialsPath(config.boardId);
1410
1410
  mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
1411
- // agentName rides along with agentId in both credential-bearing shapes: it is per-board
1412
- // identity, same as the id, and this file is the only config a `run --standalone` from an
1413
- // arbitrary directory ever reads — drop it here and `init-config --name` would be lost on
1414
- // the very next run.
1411
+ // agentName is stored, the agent id is not: the name is a label for whoever runs here (and
1412
+ // this file is the only config a `run --standalone` from an arbitrary directory reads, so
1413
+ // dropping it would lose `init-config --name` on the very next run), while the id is minted
1414
+ // per run now — see resolveModelingCredentials for why.
1415
1415
  const agentName = config.agentName ? { agentName: config.agentName } : {};
1416
1416
  const body = config.useBoard
1417
1417
  ? { boardId: config.boardId, useBoard: config.useBoard }
1418
1418
  : config.useGlobal
1419
- ? { boardId: config.boardId, useGlobal: true, agentId: config.agentId, ...agentName }
1419
+ ? { boardId: config.boardId, useGlobal: true, ...agentName }
1420
1420
  : {
1421
1421
  token: config.token,
1422
1422
  organizationId: config.organizationId,
1423
1423
  boardId: config.boardId,
1424
1424
  baseUrl: config.baseUrl,
1425
- agentId: config.agentId,
1426
1425
  ...agentName,
1427
1426
  };
1428
1427
  writeFileSync(path, JSON.stringify(body, null, 2), { mode: 0o600 });
@@ -1605,12 +1604,18 @@ async function resolveModelingCredentials(cwd, flags, explicitConfigPath, print)
1605
1604
  process.exit(1);
1606
1605
  }
1607
1606
 
1608
- // Distinguishes this agent from any other pinging the same board, and has to stay stable
1609
- // across runs or the platform sees a brand-new agent on every restart. Per board, since
1610
- // that is the identity the alive-ping is scoped to.
1611
- config.agentId = stored.agentId || readJsonSafe(boardCredentialsPath(config.boardId)).agentId || randomUUID();
1607
+ // A fresh identity for every standalone run, deliberately not persisted. A standalone agent
1608
+ // is started ad hoc from wherever, and nothing stops two of them running for the same board
1609
+ // with one id stored per board they upserted the same alive row (the heartbeat is keyed on
1610
+ // token + agent_id + agent_type), so the second agent replaced the first instead of joining
1611
+ // it: the board showed one agent however many were running, and their writes were
1612
+ // indistinguishable. A per-run uuid costs the identity its continuity across restarts (a
1613
+ // restarted agent is a new row, and the old one lingers until its 45s window lapses) — pass
1614
+ // `run --id <uuid>` when an agent needs to keep one identity, which is also what makes
1615
+ // "preferred agent" on the board stick to it.
1616
+ config.agentId = randomUUID();
1612
1617
  writeBoardCredentials(stored.useGlobal
1613
- ? { boardId: config.boardId, useGlobal: true, agentId: config.agentId, agentName: config.agentName }
1618
+ ? { boardId: config.boardId, useGlobal: true, agentName: config.agentName }
1614
1619
  : config);
1615
1620
 
1616
1621
  return config;
@@ -1697,9 +1702,9 @@ async function runModeling(kitDir, projectDir, verbose = false, standalone = fal
1697
1702
  console.error('❌ --modeling needs platform credentials in .eventmodelers/config.json (token + organizationId) — run `/connect` once or paste your config first.');
1698
1703
  process.exit(1);
1699
1704
  }
1700
- // The identity flags go on last: the global install's `overrides` carry the board's own
1701
- // stored agentId (already persisted by resolveModelingCredentials), which would otherwise
1702
- // win back over an explicit --id.
1705
+ // The identity flags go on last: the global install's `overrides` carry the agent id
1706
+ // resolveModelingCredentials just minted for this run, which would otherwise win back over
1707
+ // an explicit --id.
1703
1708
  const cfg = { ...(await fetchPlatformConfig(local)), ...(overrides ?? {}), ...(identity.agentId ? { agentId: identity.agentId } : {}), ...(identity.agentName ? { agentName: identity.agentName } : {}) }; // adds realtimeProvider + its provider-specific fields (supabaseUrl/supabaseAnonKey or pocketbaseUrl), + boardId if the config has a default one
1704
1709
  if (!cfg.boardId) {
1705
1710
  console.error('❌ --modeling needs a boardId — a modeling agent always runs for exactly one board. Run `/connect board=<uuid>` once, or add boardId to .eventmodelers/config.json.');
@@ -1917,6 +1922,7 @@ async function runModeling(kitDir, projectDir, verbose = false, standalone = fal
1917
1922
  }
1918
1923
 
1919
1924
  spawnProcess();
1925
+ log(`agent: ${cfg.agentName ? `${cfg.agentName} (${cfg.agentId})` : cfg.agentId}`);
1920
1926
  log(
1921
1927
  standalone
1922
1928
  ? `standalone: ON — reacting to direct prompts AND to board changes on its own initiative (max ${maxAgents} subagent(s) per self-directed turn)`
@@ -2710,9 +2716,6 @@ credentialFlags(program
2710
2716
  process.exit(1);
2711
2717
  }
2712
2718
  if (!parsed.baseUrl) parsed.baseUrl = DEFAULT_BASE_URL;
2713
- // Preserved across re-configuration: the platform keys a board's alive-ping on it, so
2714
- // regenerating it would present a long-running agent as a brand-new one.
2715
- parsed.agentId = readJsonSafe(boardCredentialsPath(parsed.boardId)).agentId || randomUUID();
2716
2719
  writeBoardCredentials(parsed);
2717
2720
  console.log('\n ✓ Saved credentials for board ' + parsed.boardId + ' to ' + boardCredentialsPath(parsed.boardId));
2718
2721
  console.log('\n Start the agent from anywhere with:\n');
@@ -2806,7 +2809,7 @@ credentialFlags(program
2806
2809
  .option('--global', 'Run the modeling agent from the global install (~/.eventmodelers/kit), initializing it on first use, and ignore any kit in this directory. This is also what --modeling/--standalone fall back to on their own when nothing is installed here — pass it explicitly to prefer the global install over a local one. Credentials come from the flags below, EVENTMODELERS_* env vars, or ~/.eventmodelers/boards/<board>.json, so nothing is written into the current directory.')
2807
2810
  .option('--local', 'Skip platform config/credential lookup entirely and run the local-only loop (no board sync, no realtime agent) — even if .eventmodelers/config.json has credentials (build-kit stacks only)')
2808
2811
  .option('--verbose', 'Log every tool call\'s full input (commands, skill args, file paths) and assistant reasoning text. Default is condensed, high-level per-step logging only.')
2809
- .option('--id <id>', 'Override the agent id this run identifies itself with on the platform, instead of the stable one minted once per project (per board for --global/--standalone) and reused on every restart. The heartbeat is keyed on (token, agent_id, agent_type), so this is what lets a second agent of the same type run side by side without the two overwriting each other\'s rowor pins one to an id a supervisor already knows. Per-run only: nothing is written to disk, so the next run without the flag is the original agent again.')
2812
+ .option('--id <id>', 'Pin the agent id this run identifies itself with on the platform. A project install otherwise mints one id per project and reuses it on every restart; --global/--standalone mints a fresh one per run, since two ad-hoc agents for one board must not share a row (the heartbeat is keyed on token + agent_id + agent_type, so the second would replace the first). Pass this when an agent has to keep ONE identity across restartsa supervisor that already knows the id, or a board where it is the starred "preferred agent". Per-run only: nothing is written to disk.')
2810
2813
  .option('--name <name>', 'A human-readable name for this agent, sent with every heartbeat so the board shows which agent is live rather than a bare uuid (e.g. "ci-builder", "martins-laptop"). Per-run only, like --id: the persistent name is `agentName` in config.json (set via `init --name` / `init-config --name`), and this overrides it for one run without writing anything.')
2811
2814
  .option('--credentials <values>', 'Credentials as the comma-separated blob from app.eventmodelers.ai/account (token=...,boardId=...,organizationId=...,baseUrl=...), the equivalent JSON, or - to read either from stdin. Saved to ~/.eventmodelers/boards/<board>.json, so it is only needed once per board, and passing it skips the first-run question. The individual flags below override single fields of it.'))
2812
2815
  .action(async (opts, command) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eventmodelers/cli",
3
- "version": "1.0.69",
3
+ "version": "1.0.70",
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": {