@eventmodelers/cli 1.0.135 → 1.0.136

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/LICENSE ADDED
@@ -0,0 +1,408 @@
1
+ Attribution-NonCommercial 4.0 International
2
+
3
+ =======================================================================
4
+
5
+ Creative Commons Corporation ("Creative Commons") is not a law firm and
6
+ does not provide legal services or legal advice. Distribution of
7
+ Creative Commons public licenses does not create a lawyer-client or
8
+ other relationship. Creative Commons makes its licenses and related
9
+ information available on an "as-is" basis. Creative Commons gives no
10
+ warranties regarding its licenses, any material licensed under their
11
+ terms and conditions, or any related information. Creative Commons
12
+ disclaims all liability for damages resulting from their use to the
13
+ fullest extent possible.
14
+
15
+ Using Creative Commons Public Licenses
16
+
17
+ Creative Commons public licenses provide a standard set of terms and
18
+ conditions that creators and other rights holders may use to share
19
+ original works of authorship and other material subject to copyright
20
+ and certain other rights specified in the public license below. The
21
+ following considerations are for informational purposes only, are not
22
+ exhaustive, and do not form part of our licenses.
23
+
24
+ Considerations for licensors: Our public licenses are
25
+ intended for use by those authorized to give the public
26
+ permission to use material in ways otherwise restricted by
27
+ copyright and certain other rights. Our licenses are
28
+ irrevocable. Licensors should read and understand the terms
29
+ and conditions of the license they choose before applying it.
30
+ Licensors should also secure all rights necessary before
31
+ applying our licenses so that the public can reuse the
32
+ material as expected. Licensors should clearly mark any
33
+ material not subject to the license. This includes other CC-
34
+ licensed material, or material used under an exception or
35
+ limitation to copyright. More considerations for licensors:
36
+ wiki.creativecommons.org/Considerations_for_licensors
37
+
38
+ Considerations for the public: By using one of our public
39
+ licenses, a licensor grants the public permission to use the
40
+ licensed material under specified terms and conditions. If
41
+ the licensor's permission is not necessary for any reason--for
42
+ example, because of any applicable exception or limitation to
43
+ copyright--then that use is not regulated by the license. Our
44
+ licenses grant only permissions under copyright and certain
45
+ other rights that a licensor has authority to grant. Use of
46
+ the licensed material may still be restricted for other
47
+ reasons, including because others have copyright or other
48
+ rights in the material. A licensor may make special requests,
49
+ such as asking that all changes be marked or described.
50
+ Although not required by our licenses, you are encouraged to
51
+ respect those requests where reasonable. More considerations
52
+ for the public:
53
+ wiki.creativecommons.org/Considerations_for_licensees
54
+
55
+ =======================================================================
56
+
57
+ Creative Commons Attribution-NonCommercial 4.0 International Public
58
+ License
59
+
60
+ By exercising the Licensed Rights (defined below), You accept and agree
61
+ to be bound by the terms and conditions of this Creative Commons
62
+ Attribution-NonCommercial 4.0 International Public License ("Public
63
+ License"). To the extent this Public License may be interpreted as a
64
+ contract, You are granted the Licensed Rights in consideration of Your
65
+ acceptance of these terms and conditions, and the Licensor grants You
66
+ such rights in consideration of benefits the Licensor receives from
67
+ making the Licensed Material available under these terms and
68
+ conditions.
69
+
70
+
71
+ Section 1 -- Definitions.
72
+
73
+ a. Adapted Material means material subject to Copyright and Similar
74
+ Rights that is derived from or based upon the Licensed Material
75
+ and in which the Licensed Material is translated, altered,
76
+ arranged, transformed, or otherwise modified in a manner requiring
77
+ permission under the Copyright and Similar Rights held by the
78
+ Licensor. For purposes of this Public License, where the Licensed
79
+ Material is a musical work, performance, or sound recording,
80
+ Adapted Material is always produced where the Licensed Material is
81
+ synched in timed relation with a moving image.
82
+
83
+ b. Adapter's License means the license You apply to Your Copyright
84
+ and Similar Rights in Your contributions to Adapted Material in
85
+ accordance with the terms and conditions of this Public License.
86
+
87
+ c. Copyright and Similar Rights means copyright and/or similar rights
88
+ closely related to copyright including, without limitation,
89
+ performance, broadcast, sound recording, and Sui Generis Database
90
+ Rights, without regard to how the rights are labeled or
91
+ categorized. For purposes of this Public License, the rights
92
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
93
+ Rights.
94
+ d. Effective Technological Measures means those measures that, in the
95
+ absence of proper authority, may not be circumvented under laws
96
+ fulfilling obligations under Article 11 of the WIPO Copyright
97
+ Treaty adopted on December 20, 1996, and/or similar international
98
+ agreements.
99
+
100
+ e. Exceptions and Limitations means fair use, fair dealing, and/or
101
+ any other exception or limitation to Copyright and Similar Rights
102
+ that applies to Your use of the Licensed Material.
103
+
104
+ f. Licensed Material means the artistic or literary work, database,
105
+ or other material to which the Licensor applied this Public
106
+ License.
107
+
108
+ g. Licensed Rights means the rights granted to You subject to the
109
+ terms and conditions of this Public License, which are limited to
110
+ all Copyright and Similar Rights that apply to Your use of the
111
+ Licensed Material and that the Licensor has authority to license.
112
+
113
+ h. Licensor means the individual(s) or entity(ies) granting rights
114
+ under this Public License.
115
+
116
+ i. NonCommercial means not primarily intended for or directed towards
117
+ commercial advantage or monetary compensation. For purposes of
118
+ this Public License, the exchange of the Licensed Material for
119
+ other material subject to Copyright and Similar Rights by digital
120
+ file-sharing or similar means is NonCommercial provided there is
121
+ no payment of monetary compensation in connection with the
122
+ exchange.
123
+
124
+ j. Share means to provide material to the public by any means or
125
+ process that requires permission under the Licensed Rights, such
126
+ as reproduction, public display, public performance, distribution,
127
+ dissemination, communication, or importation, and to make material
128
+ available to the public including in ways that members of the
129
+ public may access the material from a place and at a time
130
+ individually chosen by them.
131
+
132
+ k. Sui Generis Database Rights means rights other than copyright
133
+ resulting from Directive 96/9/EC of the European Parliament and of
134
+ the Council of 11 March 1996 on the legal protection of databases,
135
+ as amended and/or succeeded, as well as other essentially
136
+ equivalent rights anywhere in the world.
137
+
138
+ l. You means the individual or entity exercising the Licensed Rights
139
+ under this Public License. Your has a corresponding meaning.
140
+
141
+
142
+ Section 2 -- Scope.
143
+
144
+ a. License grant.
145
+
146
+ 1. Subject to the terms and conditions of this Public License,
147
+ the Licensor hereby grants You a worldwide, royalty-free,
148
+ non-sublicensable, non-exclusive, irrevocable license to
149
+ exercise the Licensed Rights in the Licensed Material to:
150
+
151
+ a. reproduce and Share the Licensed Material, in whole or
152
+ in part, for NonCommercial purposes only; and
153
+
154
+ b. produce, reproduce, and Share Adapted Material for
155
+ NonCommercial purposes only.
156
+
157
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
158
+ Exceptions and Limitations apply to Your use, this Public
159
+ License does not apply, and You do not need to comply with
160
+ its terms and conditions.
161
+
162
+ 3. Term. The term of this Public License is specified in Section
163
+ 6(a).
164
+
165
+ 4. Media and formats; technical modifications allowed. The
166
+ Licensor authorizes You to exercise the Licensed Rights in
167
+ all media and formats whether now known or hereafter created,
168
+ and to make technical modifications necessary to do so. The
169
+ Licensor waives and/or agrees not to assert any right or
170
+ authority to forbid You from making technical modifications
171
+ necessary to exercise the Licensed Rights, including
172
+ technical modifications necessary to circumvent Effective
173
+ Technological Measures. For purposes of this Public License,
174
+ simply making modifications authorized by this Section 2(a)
175
+ (4) never produces Adapted Material.
176
+
177
+ 5. Downstream recipients.
178
+
179
+ a. Offer from the Licensor -- Licensed Material. Every
180
+ recipient of the Licensed Material automatically
181
+ receives an offer from the Licensor to exercise the
182
+ Licensed Rights under the terms and conditions of this
183
+ Public License.
184
+
185
+ b. No downstream restrictions. You may not offer or impose
186
+ any additional or different terms or conditions on, or
187
+ apply any Effective Technological Measures to, the
188
+ Licensed Material if doing so restricts exercise of the
189
+ Licensed Rights by any recipient of the Licensed
190
+ Material.
191
+
192
+ 6. No endorsement. Nothing in this Public License constitutes or
193
+ may be construed as permission to assert or imply that You
194
+ are, or that Your use of the Licensed Material is, connected
195
+ with, or sponsored, endorsed, or granted official status by,
196
+ the Licensor or others designated to receive attribution as
197
+ provided in Section 3(a)(1)(A)(i).
198
+
199
+ b. Other rights.
200
+
201
+ 1. Moral rights, such as the right of integrity, are not
202
+ licensed under this Public License, nor are publicity,
203
+ privacy, and/or other similar personality rights; however, to
204
+ the extent possible, the Licensor waives and/or agrees not to
205
+ assert any such rights held by the Licensor to the limited
206
+ extent necessary to allow You to exercise the Licensed
207
+ Rights, but not otherwise.
208
+
209
+ 2. Patent and trademark rights are not licensed under this
210
+ Public License.
211
+
212
+ 3. To the extent possible, the Licensor waives any right to
213
+ collect royalties from You for the exercise of the Licensed
214
+ Rights, whether directly or through a collecting society
215
+ under any voluntary or waivable statutory or compulsory
216
+ licensing scheme. In all other cases the Licensor expressly
217
+ reserves any right to collect such royalties, including when
218
+ the Licensed Material is used other than for NonCommercial
219
+ purposes.
220
+
221
+
222
+ Section 3 -- License Conditions.
223
+
224
+ Your exercise of the Licensed Rights is expressly made subject to the
225
+ following conditions.
226
+
227
+ a. Attribution.
228
+
229
+ 1. If You Share the Licensed Material (including in modified
230
+ form), You must:
231
+
232
+ a. retain the following if it is supplied by the Licensor
233
+ with the Licensed Material:
234
+
235
+ i. identification of the creator(s) of the Licensed
236
+ Material and any others designated to receive
237
+ attribution, in any reasonable manner requested by
238
+ the Licensor (including by pseudonym if
239
+ designated);
240
+
241
+ ii. a copyright notice;
242
+
243
+ iii. a notice that refers to this Public License;
244
+
245
+ iv. a notice that refers to the disclaimer of
246
+ warranties;
247
+
248
+ v. a URI or hyperlink to the Licensed Material to the
249
+ extent reasonably practicable;
250
+
251
+ b. indicate if You modified the Licensed Material and
252
+ retain an indication of any previous modifications; and
253
+
254
+ c. indicate the Licensed Material is licensed under this
255
+ Public License, and include the text of, or the URI or
256
+ hyperlink to, this Public License.
257
+
258
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
259
+ reasonable manner based on the medium, means, and context in
260
+ which You Share the Licensed Material. For example, it may be
261
+ reasonable to satisfy the conditions by providing a URI or
262
+ hyperlink to a resource that includes the required
263
+ information.
264
+
265
+ 3. If requested by the Licensor, You must remove any of the
266
+ information required by Section 3(a)(1)(A) to the extent
267
+ reasonably practicable.
268
+
269
+ 4. If You Share Adapted Material You produce, the Adapter's
270
+ License You apply must not prevent recipients of the Adapted
271
+ Material from complying with this Public License.
272
+
273
+
274
+ Section 4 -- Sui Generis Database Rights.
275
+
276
+ Where the Licensed Rights include Sui Generis Database Rights that
277
+ apply to Your use of the Licensed Material:
278
+
279
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
280
+ to extract, reuse, reproduce, and Share all or a substantial
281
+ portion of the contents of the database for NonCommercial purposes
282
+ only;
283
+
284
+ b. if You include all or a substantial portion of the database
285
+ contents in a database in which You have Sui Generis Database
286
+ Rights, then the database in which You have Sui Generis Database
287
+ Rights (but not its individual contents) is Adapted Material; and
288
+
289
+ c. You must comply with the conditions in Section 3(a) if You Share
290
+ all or a substantial portion of the contents of the database.
291
+
292
+ For the avoidance of doubt, this Section 4 supplements and does not
293
+ replace Your obligations under this Public License where the Licensed
294
+ Rights include other Copyright and Similar Rights.
295
+
296
+
297
+ Section 5 -- Disclaimer of Warranties and Limitation of Liability.
298
+
299
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
300
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
301
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
302
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
303
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
304
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
305
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
306
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
307
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
308
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
309
+
310
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
311
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
312
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
313
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
314
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
315
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
316
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
317
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
318
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
319
+
320
+ c. The disclaimer of warranties and limitation of liability provided
321
+ above shall be interpreted in a manner that, to the extent
322
+ possible, most closely approximates an absolute disclaimer and
323
+ waiver of all liability.
324
+
325
+
326
+ Section 6 -- Term and Termination.
327
+
328
+ a. This Public License applies for the term of the Copyright and
329
+ Similar Rights licensed here. However, if You fail to comply with
330
+ this Public License, then Your rights under this Public License
331
+ terminate automatically.
332
+
333
+ b. Where Your right to use the Licensed Material has terminated under
334
+ Section 6(a), it reinstates:
335
+
336
+ 1. automatically as of the date the violation is cured, provided
337
+ it is cured within 30 days of Your discovery of the
338
+ violation; or
339
+
340
+ 2. upon express reinstatement by the Licensor.
341
+
342
+ For the avoidance of doubt, this Section 6(b) does not affect any
343
+ right the Licensor may have to seek remedies for Your violations
344
+ of this Public License.
345
+
346
+ c. For the avoidance of doubt, the Licensor may also offer the
347
+ Licensed Material under separate terms or conditions or stop
348
+ distributing the Licensed Material at any time; however, doing so
349
+ will not terminate this Public License.
350
+
351
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
352
+ License.
353
+
354
+
355
+ Section 7 -- Other Terms and Conditions.
356
+
357
+ a. The Licensor shall not be bound by any additional or different
358
+ terms or conditions communicated by You unless expressly agreed.
359
+
360
+ b. Any arrangements, understandings, or agreements regarding the
361
+ Licensed Material not stated herein are separate from and
362
+ independent of the terms and conditions of this Public License.
363
+
364
+
365
+ Section 8 -- Interpretation.
366
+
367
+ a. For the avoidance of doubt, this Public License does not, and
368
+ shall not be interpreted to, reduce, limit, restrict, or impose
369
+ conditions on any use of the Licensed Material that could lawfully
370
+ be made without permission under this Public License.
371
+
372
+ b. To the extent possible, if any provision of this Public License is
373
+ deemed unenforceable, it shall be automatically reformed to the
374
+ minimum extent necessary to make it enforceable. If the provision
375
+ cannot be reformed, it shall be severed from this Public License
376
+ without affecting the enforceability of the remaining terms and
377
+ conditions.
378
+
379
+ c. No term or condition of this Public License will be waived and no
380
+ failure to comply consented to unless expressly agreed to by the
381
+ Licensor.
382
+
383
+ d. Nothing in this Public License constitutes or may be interpreted
384
+ as a limitation upon, or waiver of, any privileges and immunities
385
+ that apply to the Licensor or You, including from the legal
386
+ processes of any jurisdiction or authority.
387
+
388
+ =======================================================================
389
+
390
+ Creative Commons is not a party to its public
391
+ licenses. Notwithstanding, Creative Commons may elect to apply one of
392
+ its public licenses to material it publishes and in those instances
393
+ will be considered the “Licensor.” The text of the Creative Commons
394
+ public licenses is dedicated to the public domain under the CC0 Public
395
+ Domain Dedication. Except for the limited purpose of indicating that
396
+ material is shared under a Creative Commons public license or as
397
+ otherwise permitted by the Creative Commons policies published at
398
+ creativecommons.org/policies, Creative Commons does not authorize the
399
+ use of the trademark "Creative Commons" or any other trademark or logo
400
+ of Creative Commons without its prior written consent including,
401
+ without limitation, in connection with any unauthorized modifications
402
+ to any of its public licenses or any other arrangements,
403
+ understandings, or agreements concerning use of licensed material. For
404
+ the avoidance of doubt, this paragraph does not form part of the
405
+ public licenses.
406
+
407
+ Creative Commons may be contacted at creativecommons.org.
408
+
package/README.md CHANGED
@@ -108,7 +108,9 @@ Use skills in Claude Code with `/skill-name`:
108
108
  | `/wdyt` | Business analyst review of your event model |
109
109
  | `/walkthrough` | Slice-by-slice player through a feature, or through every slice a planned feature needs (existing, to adjust, new) |
110
110
  | `/data-journey` | Where one piece of information (e.g. the customer email) originates, is stored, transformed, used and sent out — as a table in the chat |
111
+ | `/domain-story` | Retells chapters as Domain Storytelling — actors, work objects and numbered activities, drawn as a graph per chapter in the chat |
111
112
  | `/stressor-analysis` | Residuality-theory stress test of one chapter: wide stressors and their residues, a stressor × element matrix that exposes hidden coupling, redesigns proposed as new slices |
113
+ | `/build-snippet-type` | Build a custom chat snippet type with the person — a card with their own fields and buttons — preview it in the chat, create it after a yes |
112
114
  | `/storyboard` | Build a full visual storyboard |
113
115
  | `/html-screen` | Design individual real HTML/CSS screens (default) |
114
116
  | `/storyboard-screen` | Design individual wireframe/sketch screens (explicit request only) |
@@ -787,4 +789,7 @@ To check an image locally before tagging: `docker build -f docker/<name>/Dockerf
787
789
 
788
790
  | Contributor | Contribution |
789
791
  |-------------|-------------|
790
- | [Yordis Pietro](https://github.com/TrogonStack/trogonai) | All `eventmodeling-*` skills |
792
+ | [Yordis Pietro](https://github.com/TrogonStack/trogonai) | All `eventmodeling-*` skills |
793
+ ## License
794
+
795
+ Licensed under [Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)](https://creativecommons.org/licenses/by-nc/4.0/) — see [LICENSE](LICENSE).
package/cli.js CHANGED
@@ -22,6 +22,8 @@ import { runFetch, FetchAuthError } from './lib/fetch.js';
22
22
  import { createModelingLocalAiRunner } from './lib/modeling-local-ai.js';
23
23
  import { run as runSpecKittyAdapter } from './lib/adapters/spec-kitty-adapter.js';
24
24
  import { latestPublishedVersion, updateHints } from './lib/update-check.js';
25
+ import { guardSnippetReply } from './lib/snippet-guard.js';
26
+ import { modelingPermissions } from './lib/agent-permissions.js';
25
27
  // Not a root-level adapter like spec-kitty-adapter.js above: this is the one canonical
26
28
  // copy that every useShared:true stack also gets copied into its installed kit (see
27
29
  // copyDirContents in installStack) for ralph.js to import standalone — see
@@ -1950,7 +1952,7 @@ async function ensureGlobalKit(baseUrl) {
1950
1952
  // untargeted is handed straight back to the queue for another agent to take. It says
1951
1953
  // nothing about the standalone lane — a self-directed turn is nobody's task, so an
1952
1954
  // exclusive standalone agent still works the board on its own initiative.
1953
- async function runModeling(kitDir, projectDir, { codeDir = null, verbose = false, standalone = false, exclusive = false, worker = false, overrides = null, maxAgents = DEFAULT_MAX_AGENTS, identity = {}, localAi = null, exec = null, model = null } = {}) {
1955
+ async function runModeling(kitDir, projectDir, { codeDir = null, verbose = false, standalone = false, exclusive = false, worker = false, overrides = null, maxAgents = DEFAULT_MAX_AGENTS, identity = {}, localAi = null, exec = null, model = null, skipPermissions = false } = {}) {
1954
1956
  // --worker: only prompts — no chat, and no board-change turns (it has nowhere to propose).
1955
1957
  const chat = !worker;
1956
1958
  const configLibPath = join(kitDir, 'lib', 'config.js');
@@ -2103,7 +2105,23 @@ async function runModeling(kitDir, projectDir, { codeDir = null, verbose = false
2103
2105
  return withSessionHeader(`${fields}${context}\n\n${p.prompt}`);
2104
2106
  }
2105
2107
 
2106
- const claudeArgs = ['--dangerously-skip-permissions', '-p', '--input-format', 'stream-json', '--output-format', 'stream-json', '--verbose'];
2108
+ // Locked down, not --dangerously-skip-permissions: this agent takes chat messages and snippet clicks from any
2109
+ // collaborator on the board. Anything not explicitly allowed is refused without asking; the only MCP server is the
2110
+ // platform's; Bash runs only the allowlisted commands, curl only to cfg.baseUrl (lib/agent-permissions.js,
2111
+ // lib/bash-guard.js). The operator's own --dangerously-skip-permissions restores the old approve-everything mode.
2112
+ const permissions = skipPermissions
2113
+ ? { args: ['--dangerously-skip-permissions'] }
2114
+ : modelingPermissions({
2115
+ baseUrl: cfg.baseUrl,
2116
+ projectDir,
2117
+ codeDir,
2118
+ tmpDir: tmpdir(),
2119
+ hookCommand: `"${process.execPath}" "${fileURLToPath(new URL('./lib/bash-guard-hook.js', import.meta.url))}"`,
2120
+ });
2121
+ if (skipPermissions) {
2122
+ console.warn('⚠️ --dangerously-skip-permissions: every tool call this agent makes is approved — any shell command, curl to anywhere, any file you can read or write. Anyone who can chat with it on this board can make it do that.\n');
2123
+ }
2124
+ const claudeArgs = ['-p', '--input-format', 'stream-json', '--output-format', 'stream-json', '--verbose', ...permissions.args];
2107
2125
  if (cfg.model) claudeArgs.push('--model', cfg.model);
2108
2126
  // The global install runs in ~/.eventmodelers/kit, away from the code base the person started
2109
2127
  // the agent in — hand that directory over so code-reading skills (detect-model-drift)
@@ -2111,6 +2129,17 @@ async function runModeling(kitDir, projectDir, { codeDir = null, verbose = false
2111
2129
  if (codeDir) claudeArgs.push('--add-dir', codeDir);
2112
2130
  const claudeEnv = {
2113
2131
  ...process.env,
2132
+ // What the skills' curl fallback writes as $BASE_URL / $ORG_ID / $BOARD_ID. Set here, not inherited: the Bash guard
2133
+ // treats $BASE_URL as the platform, so a BASE_URL from the operator's own shell must never reach the agent. The
2134
+ // guard's own env is left out entirely with --dangerously-skip-permissions, which runs with the environment as before.
2135
+ ...(skipPermissions ? {} : {
2136
+ ...permissions.env,
2137
+ BASE_URL: cfg.baseUrl,
2138
+ ORG_ID: cfg.organizationId,
2139
+ BOARD_ID: cfg.boardId,
2140
+ // The skills' curl headers say "x-token: $TOKEN"; the guard lets the token expand only inside a curl -H value.
2141
+ TOKEN: cfg.token,
2142
+ }),
2114
2143
  ...(codeDir ? { EVENTMODELERS_CODE_DIR: codeDir } : {}),
2115
2144
  ...(cfg.anthropicBaseUrl ? { ANTHROPIC_BASE_URL: cfg.anthropicBaseUrl } : {}),
2116
2145
  EVENTMODELERS_TOKEN: cfg.token,
@@ -2422,10 +2451,13 @@ async function runModeling(kitDir, projectDir, { codeDir = null, verbose = false
2422
2451
  Array.isArray(m.attachments) && m.attachments.length ? `attachments=${JSON.stringify(m.attachments)}` : null,
2423
2452
  cachedFiles.length ? `attachment_files=${JSON.stringify(cachedFiles)}` : null,
2424
2453
  ].filter(Boolean).join(' ');
2425
- const context = m.context && typeof m.context === 'object' && Object.keys(m.context).length
2426
- ? `\ncontext=${JSON.stringify(m.context)}`
2454
+ // A custom snippet type's `then` is a collaborator's text, not the person's or ours: it leaves the context JSON
2455
+ // and follows the message in a fenced block with the rule for it (lib/snippet-guard.js).
2456
+ const guarded = guardSnippetReply(m.context, randomUUID().slice(0, 8));
2457
+ const context = guarded.context && typeof guarded.context === 'object' && Object.keys(guarded.context).length
2458
+ ? `\ncontext=${JSON.stringify(guarded.context)}`
2427
2459
  : '';
2428
- return withSessionHeader(`${fields}${context}\n\n${m.text}`);
2460
+ return withSessionHeader(`${fields}${context}\n\n${m.text}${guarded.block ? `\n\n${guarded.block}` : ''}`);
2429
2461
  }
2430
2462
 
2431
2463
  // The backend rejects a chat message over this many characters (CHAT_TEXT_TOO_LONG).
@@ -3648,6 +3680,7 @@ credentialFlags(program
3648
3680
  .option('--exclusive', 'Work only the prompts addressed to this agent\'s id — the board\'s "preferred agent" (the star in the prompts panel) — and hand every untargeted prompt straight back to the queue for another agent to take. Without it an agent also works everything nobody addressed to anyone, which is what you want for a single agent and exactly what you do not want for a dedicated one (a board with a general agent plus a specialist, or an agent a supervisor drives by id). Pair it with --id so the same agent is addressable across restarts — --global/--standalone otherwise mint a fresh id per run, and prompts addressed to the previous run\'s id are never claimed. Leaves --standalone alone: a self-directed turn is nobody\'s prompt, so an exclusive standalone agent still works the board on its own initiative.')
3649
3681
  .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.')
3650
3682
  .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)')
3683
+ .option('--dangerously-skip-permissions', 'Run the modeling agent\'s Claude process with --dangerously-skip-permissions, as before the lockdown: every tool call is approved — any shell command, curl to anywhere, any file the user can read or write, every MCP server the machine configures. Off by default because the agent takes chat messages and snippet clicks from any collaborator on the board; pass it only for a board whose collaborators you trust with your shell. Default Claude runner of --modeling/--standalone/--worker/--global only — not with --agent, --exec or --local-ai, which bring their own permission flags.')
3651
3684
  .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.')
3652
3685
  .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 restarts — a supervisor that already knows the id, or a board where it is the starred "preferred agent". Per-run only: nothing is written to disk.')
3653
3686
  .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.')
@@ -3760,6 +3793,10 @@ credentialFlags(program
3760
3793
  console.error(`❌ --force asks for credentials again, which --non-interactive/--print rule out — pick one.`);
3761
3794
  process.exit(1);
3762
3795
  }
3796
+ if (opts.dangerouslySkipPermissions && (opts.exec || modelingLocalAi !== null)) {
3797
+ console.error('❌ --dangerously-skip-permissions only applies to the default Claude runner — --agent/--exec bring their own permission flags (put them in the command), and --local-ai has no shell or file tools to approve.');
3798
+ process.exit(1);
3799
+ }
3763
3800
  if (opts.local) {
3764
3801
  console.error(`❌ ${picked} has no local-only mode — it is always driven by the org-wide realtime prompt queue, so --local has no use for it.`);
3765
3802
  process.exit(1);
@@ -3824,7 +3861,7 @@ credentialFlags(program
3824
3861
  const runnerLabel = modelingLocalAi ? 'local model' : opts.exec ? 'one agent process per turn' : 'warm Claude process';
3825
3862
  await new Promise((res) => process.stdout.write(`▶ Starting modeling loop (${runnerLabel}) for ${shown && !shown.startsWith('..') ? shown : kitDir}...\n\n`, res));
3826
3863
  try {
3827
- await runModeling(kitDir, projectDir, { codeDir, verbose: !!opts.verbose, standalone: !!opts.standalone, exclusive: !!opts.exclusive, worker: !!opts.worker, overrides, maxAgents, identity, localAi: modelingLocalAi, exec: opts.exec ?? null, model: !opts.exec && modelingLocalAi === null ? model : null });
3864
+ await runModeling(kitDir, projectDir, { codeDir, verbose: !!opts.verbose, standalone: !!opts.standalone, exclusive: !!opts.exclusive, worker: !!opts.worker, overrides, maxAgents, identity, localAi: modelingLocalAi, exec: opts.exec ?? null, model: !opts.exec && modelingLocalAi === null ? model : null, skipPermissions: !!opts.dangerouslySkipPermissions });
3828
3865
  } catch (err) {
3829
3866
  console.error('[modeling] Fatal:', err);
3830
3867
  process.exit(1);
@@ -0,0 +1,72 @@
1
+ // How the modeling agent's Claude process is locked down. It takes chat messages and snippet clicks from any
2
+ // collaborator on the board, so it does not run with --dangerously-skip-permissions (which approves every tool call,
3
+ // rm and curl-to-anywhere included). Instead:
4
+ //
5
+ // - --permission-mode dontAsk: a tool call that is not explicitly allowed is refused on the spot — nobody is asked
6
+ // (with stream-json a permission prompt would go to this CLI, which never answers, and the turn would hang).
7
+ // - --strict-mcp-config + --mcp-config: the eventmodelers server is the only MCP server, whatever else the machine's
8
+ // user or project settings configure; mcp__eventmodelers allows all of its tools.
9
+ // - Bash goes through lib/bash-guard-hook.js (a PreToolUse hook): it allows only the commands on lib/bash-guard.js's
10
+ // list — curl only to the platform — and denies the rest. There is no Bash allow rule, so a command the hook does
11
+ // not explicitly allow is refused by dontAsk.
12
+ // - Files: reading and editing in the kit directory (the working directory) and the temp directories; reading the
13
+ // code directory (--add-dir). Never the files holding the token, never .claude/ or .mcp.json (an agent rewriting
14
+ // its own permissions or hooks would outlive the turn), never .env files. No WebFetch / WebSearch.
15
+
16
+ import { realpathSync } from 'fs';
17
+
18
+ const realOrSame = (path) => { try { return realpathSync(path); } catch { return path; } };
19
+ // Claude Code permission rules write an absolute path with a leading // (a single / is relative to the settings file).
20
+ const abs = (path) => `/${path}`;
21
+
22
+ /**
23
+ * The claude arguments and environment for a locked-down modeling agent.
24
+ * { baseUrl, projectDir, codeDir?, tmpDir, hookCommand } → { args: string[], env: Record<string, string> }
25
+ */
26
+ export function modelingPermissions({ baseUrl, projectDir, codeDir, tmpDir, hookCommand }) {
27
+ const tempDirs = [...new Set(['/tmp', '/private/tmp', tmpDir, realOrSame(tmpDir)].filter(Boolean))];
28
+ const roots = [...new Set([projectDir, realOrSame(projectDir), codeDir, codeDir && realOrSame(codeDir), ...tempDirs].filter(Boolean))];
29
+
30
+ const allowed = [
31
+ 'mcp__eventmodelers',
32
+ 'Skill', 'Agent', 'Task', 'TodoWrite', 'ToolSearch',
33
+ // Edit rules cover every file-editing tool (Write included) — Claude ignores Write(path) rules.
34
+ 'Edit(./**)',
35
+ ...tempDirs.flatMap((dir) => [`Read(${abs(dir)}/**)`, `Edit(${abs(dir)}/**)`]),
36
+ ];
37
+ const secretReads = ['./.claude/settings.local.json', './.claude/settings.json', './.eventmodelers/**', './**/.eventmodelers/**', './**/.env', './**/.env.*'];
38
+ const disallowed = [
39
+ 'WebFetch', 'WebSearch',
40
+ ...secretReads.map((p) => `Read(${p})`),
41
+ ...(codeDir ? [`Read(${abs(codeDir)}/**/.env)`, `Read(${abs(codeDir)}/**/.env.*)`] : []),
42
+ 'Edit(./.claude/**)', 'Edit(./.mcp.json)', 'Edit(./.eventmodelers/**)', 'Edit(./**/.eventmodelers/**)',
43
+ ];
44
+
45
+ const mcpConfig = {
46
+ mcpServers: {
47
+ eventmodelers: {
48
+ type: 'http',
49
+ url: `${baseUrl}/mcp`,
50
+ // Resolved by claude from its own environment — the token never sits in an argument.
51
+ headers: { 'x-token': '${EVENTMODELERS_TOKEN}', 'x-agent-id': '${EVENTMODELERS_AGENT_ID}' },
52
+ },
53
+ },
54
+ };
55
+ const settings = {
56
+ hooks: { PreToolUse: [{ matcher: 'Bash', hooks: [{ type: 'command', command: hookCommand }] }] },
57
+ };
58
+
59
+ return {
60
+ args: [
61
+ '--permission-mode', 'dontAsk',
62
+ '--allowedTools', allowed.join(','),
63
+ '--disallowedTools', disallowed.join(','),
64
+ '--strict-mcp-config', '--mcp-config', JSON.stringify(mcpConfig),
65
+ '--settings', JSON.stringify(settings),
66
+ ],
67
+ env: {
68
+ EVENTMODELERS_GUARD_BASE_URL: baseUrl,
69
+ EVENTMODELERS_GUARD_ROOTS: JSON.stringify(roots),
70
+ },
71
+ };
72
+ }
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ // PreToolUse hook for the modeling agent's Bash tool — see lib/bash-guard.js for the rules. The CLI registers it via
3
+ // --settings and hands the policy over in the environment (EVENTMODELERS_GUARD_BASE_URL, EVENTMODELERS_GUARD_ROOTS).
4
+ // It answers "allow" for a command on the list and "deny" (with the reason, which the agent sees) for anything else.
5
+ // It fails closed: an unreadable input, a missing policy or a crash is a deny — a hook that errors would otherwise let
6
+ // the call through to the permission rules.
7
+
8
+ import { checkBashCommand } from './bash-guard.js';
9
+
10
+ const decide = (permissionDecision, permissionDecisionReason) => {
11
+ process.stdout.write(JSON.stringify({
12
+ hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision, permissionDecisionReason },
13
+ }));
14
+ process.exit(0);
15
+ };
16
+
17
+ let input = '';
18
+ process.stdin.setEncoding('utf8');
19
+ process.stdin.on('data', (chunk) => { input += chunk; });
20
+ process.stdin.on('end', () => {
21
+ try {
22
+ const event = JSON.parse(input);
23
+ const baseUrl = process.env.EVENTMODELERS_GUARD_BASE_URL;
24
+ const roots = JSON.parse(process.env.EVENTMODELERS_GUARD_ROOTS ?? '[]');
25
+ if (!baseUrl || !Array.isArray(roots) || !roots.length) return decide('deny', 'Bash guard has no policy — refusing every command');
26
+ const result = checkBashCommand(event?.tool_input?.command, { baseUrl, roots, cwd: event?.cwd || process.cwd() });
27
+ if (result.ok) return decide('allow', 'on the modeling agent\'s command allowlist');
28
+ return decide('deny', `Refused by the agent's command allowlist: ${result.reason}. Use the eventmodelers MCP tools, or curl to ${baseUrl} only.`);
29
+ } catch (err) {
30
+ return decide('deny', `Bash guard failed (${err?.message ?? err}) — refusing the command`);
31
+ }
32
+ });