@genesislcap/ai-assistant 15.43.0 → 15.44.0

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 (30) hide show
  1. package/dist/custom-elements.json +265 -206
  2. package/dist/dts/genesis/config.d.ts +28 -1
  3. package/dist/dts/genesis/config.d.ts.map +1 -1
  4. package/dist/dts/genesis/consumes.d.ts.map +1 -1
  5. package/dist/dts/genesis/index.d.ts +2 -1
  6. package/dist/dts/genesis/index.d.ts.map +1 -1
  7. package/dist/dts/genesis/register-genesis-assistant.d.ts.map +1 -1
  8. package/dist/dts/genesis/review-model.d.ts +22 -1
  9. package/dist/dts/genesis/review-model.d.ts.map +1 -1
  10. package/dist/dts/genesis/types.d.ts +32 -0
  11. package/dist/dts/genesis/types.d.ts.map +1 -1
  12. package/dist/dts/genesis/write-review/write-review.d.ts +7 -0
  13. package/dist/dts/genesis/write-review/write-review.d.ts.map +1 -1
  14. package/dist/dts/genesis/write-review/write-review.template.d.ts.map +1 -1
  15. package/dist/dts/genesis/write-tools.d.ts.map +1 -1
  16. package/dist/esm/genesis/config.js +108 -7
  17. package/dist/esm/genesis/consumes.js +8 -1
  18. package/dist/esm/genesis/index.js +1 -0
  19. package/dist/esm/genesis/register-genesis-assistant.js +7 -0
  20. package/dist/esm/genesis/review-model.js +37 -7
  21. package/dist/esm/genesis/write-review/write-review.js +11 -1
  22. package/dist/esm/genesis/write-review/write-review.template.js +9 -1
  23. package/dist/esm/genesis/write-tools.js +35 -11
  24. package/dist/genesis-consumes.cjs +8 -1
  25. package/dist/genesis-consumes.cjs.map +2 -2
  26. package/dist/genesis-consumes.mjs +8 -1
  27. package/dist/genesis-consumes.mjs.map +2 -2
  28. package/docs/genesis.md +49 -1
  29. package/package.json +18 -18
  30. package/scripts/smoke-genesis-consumes-node.mjs +1 -1
package/docs/genesis.md CHANGED
@@ -104,6 +104,7 @@ that table, unless asked), then the extensions' prompt.
104
104
  | `context` | Required. Becomes the tool description, so write it for the model. |
105
105
  | `op` | Events only: `insert`, `modify`, `delete` or `custom`. |
106
106
  | `maxRows` | Requests only: a whole number from 1 to 1000. Defaults to 50. |
107
+ | `customCode` | Insert, modify and delete events only: the event's handler runs custom code. See [Custom code](#custom-code). |
107
108
 
108
109
  A rule about the config **as a whole** — `enabled`, `vendor`, `tier`, `systemPrompt`, and
109
110
  `resources` being a list — blocks the assistant. A rule about **one resource** leaves that resource
@@ -129,7 +130,7 @@ import { GENESIS_AI_CONSUMES } from '@genesislcap/ai-assistant/genesis/consumes'
129
130
  GENESIS_AI_CONSUMES;
130
131
  // {
131
132
  // kinds: ['request', 'event'],
132
- // resourceFields: ['name', 'kind', 'op', 'context', 'maxRows'],
133
+ // resourceFields: ['name', 'kind', 'op', 'context', 'maxRows', 'customCode'],
133
134
  // vendors: ['anthropic', 'gemini'],
134
135
  // tiers: ['low', 'high', 'reasoning'],
135
136
  // }
@@ -330,6 +331,53 @@ every chat view, and all three rules with it: a denial holds until the tools are
330
331
  change requests count across every message (so the fourth ends revisions for good), and a resend
331
332
  is compared with the last proposal asked about in any message. The first such call logs a warning.
332
333
 
334
+ ### Custom code
335
+
336
+ A generated CRUD event writes the row the review shows. An event whose handler runs **custom code**
337
+ can do more: the row it saves is built in its code, and the code can write to other tables too.
338
+ The generator marks such an event with `customCode`:
339
+
340
+ ```json
341
+ {
342
+ "name": "EVENT_ORDER_INSERT",
343
+ "kind": "event",
344
+ "op": "insert",
345
+ "context": "Place an order. Custom code matches it against resting orders.",
346
+ "customCode": { "alsoWrites": ["TRADE", "ORDER_FILL", "AXE"], "listComplete": false }
347
+ }
348
+ ```
349
+
350
+ `alsoWrites` names the other tables the generator found the code writes to, in the order the code
351
+ writes them. `listComplete` is `true` only when the generator could prove those are all of them.
352
+
353
+ Every review of such an event shows one line directly under its header, above the table, and the
354
+ table is described by it (`aria-describedby`). An insert or modify says "save the values shown", a
355
+ delete says "remove the row shown":
356
+
357
+ | `alsoWrites` | `listComplete` | The line |
358
+ | ------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
359
+ | empty | `true` | This action runs custom code, so it can do more than save the values shown. |
360
+ | empty | `false` | This action runs custom code, so it can do more than save the values shown, and it can also write to other records. |
361
+ | named | `true` | This action runs custom code, so it can do more than save the values shown. When this app was generated, that code could also write to TRADE and AXE. |
362
+ | named | `false` | This action runs custom code, so it can do more than save the values shown. When this app was generated, that code could also write to TRADE, AXE and other records. |
363
+
364
+ The named tables are what the code wrote to **when the app was generated**. The app's code can
365
+ change after that, and the config does not change with it, so regenerating the app refreshes the
366
+ list. The line stays on a review once it is answered and when the chat is reloaded from history.
367
+ It is not repeated in the answer's summary.
368
+
369
+ `customCode` means something only on an insert, modify or delete event. Anywhere else the field
370
+ is ignored, the resource is kept, and the console says so. A malformed value keeps the valid table names,
371
+ in order and once each, and is read as **not complete**, so the review says the code can also
372
+ write to other records. The resource is kept and the console says what was wrong. A value that
373
+ cannot be read never shows the form that says the code writes nothing else. Neither warning is
374
+ logged for a resource an app extension replaced: it gets no review, and its own warning says it
375
+ was left out.
376
+
377
+ `customCodeOf`, exported from `@genesislcap/ai-assistant/genesis`, is the one reader of the field.
378
+ Registration uses it, and so does `createGenesisWriteTools` when it is called directly, since
379
+ that factory does not validate its resources.
380
+
333
381
  ### A modify needs somewhere to read its rows from
334
382
 
335
383
  A generated CRUD modify **replaces** the record, so a payload carrying only the fields the model
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/ai-assistant",
3
3
  "description": "Genesis AI Assistant micro-frontend",
4
- "version": "15.43.0",
4
+ "version": "15.44.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/ai-assistant.d.ts",
@@ -92,32 +92,32 @@
92
92
  }
93
93
  },
94
94
  "devDependencies": {
95
- "@genesislcap/foundation-comms": "15.43.0",
96
- "@genesislcap/foundation-testing": "15.43.0",
97
- "@genesislcap/genx": "15.43.0",
98
- "@genesislcap/rollup-builder": "15.43.0",
99
- "@genesislcap/ts-builder": "15.43.0",
100
- "@genesislcap/uvu-playwright-builder": "15.43.0",
101
- "@genesislcap/vite-builder": "15.43.0",
102
- "@genesislcap/webpack-builder": "15.43.0",
95
+ "@genesislcap/foundation-comms": "15.44.0",
96
+ "@genesislcap/foundation-testing": "15.44.0",
97
+ "@genesislcap/genx": "15.44.0",
98
+ "@genesislcap/rollup-builder": "15.44.0",
99
+ "@genesislcap/ts-builder": "15.44.0",
100
+ "@genesislcap/uvu-playwright-builder": "15.44.0",
101
+ "@genesislcap/vite-builder": "15.44.0",
102
+ "@genesislcap/webpack-builder": "15.44.0",
103
103
  "@types/dompurify": "^3.0.5",
104
104
  "@types/marked": "^5.0.2",
105
105
  "esbuild": "0.25.12"
106
106
  },
107
107
  "dependencies": {
108
- "@genesislcap/foundation-ai": "15.43.0",
109
- "@genesislcap/foundation-logger": "15.43.0",
110
- "@genesislcap/foundation-notifications": "15.43.0",
111
- "@genesislcap/foundation-redux": "15.43.0",
112
- "@genesislcap/foundation-ui": "15.43.0",
113
- "@genesislcap/foundation-utils": "15.43.0",
114
- "@genesislcap/rapid-design-system": "15.43.0",
115
- "@genesislcap/web-core": "15.43.0",
108
+ "@genesislcap/foundation-ai": "15.44.0",
109
+ "@genesislcap/foundation-logger": "15.44.0",
110
+ "@genesislcap/foundation-notifications": "15.44.0",
111
+ "@genesislcap/foundation-redux": "15.44.0",
112
+ "@genesislcap/foundation-ui": "15.44.0",
113
+ "@genesislcap/foundation-utils": "15.44.0",
114
+ "@genesislcap/rapid-design-system": "15.44.0",
115
+ "@genesislcap/web-core": "15.44.0",
116
116
  "dompurify": "^3.3.1",
117
117
  "marked": "^17.0.3"
118
118
  },
119
119
  "peerDependencies": {
120
- "@genesislcap/foundation-comms": "^15.43.0"
120
+ "@genesislcap/foundation-comms": "^15.44.0"
121
121
  },
122
122
  "peerDependenciesMeta": {
123
123
  "@genesislcap/foundation-comms": {
@@ -21,7 +21,7 @@ const require = createRequire(import.meta.url);
21
21
 
22
22
  const EXPECTED = {
23
23
  kinds: ['request', 'event'],
24
- resourceFields: ['name', 'kind', 'op', 'context', 'maxRows'],
24
+ resourceFields: ['name', 'kind', 'op', 'context', 'maxRows', 'customCode'],
25
25
  vendors: ['anthropic', 'gemini'],
26
26
  tiers: ['low', 'high', 'reasoning'],
27
27
  };