@genesislcap/ai-assistant 15.41.0 → 15.43.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 (41) hide show
  1. package/dist/chat-driver.cjs +115 -6
  2. package/dist/chat-driver.cjs.map +3 -3
  3. package/dist/chat-driver.mjs +115 -6
  4. package/dist/chat-driver.mjs.map +3 -3
  5. package/dist/custom-elements.json +761 -713
  6. package/dist/dts/genesis/config.d.ts +51 -6
  7. package/dist/dts/genesis/config.d.ts.map +1 -1
  8. package/dist/dts/genesis/consumes.d.ts +42 -0
  9. package/dist/dts/genesis/consumes.d.ts.map +1 -0
  10. package/dist/dts/genesis/criteria.d.ts.map +1 -1
  11. package/dist/dts/genesis/event-fields.d.ts +4 -1
  12. package/dist/dts/genesis/event-fields.d.ts.map +1 -1
  13. package/dist/dts/genesis/index.d.ts +2 -1
  14. package/dist/dts/genesis/index.d.ts.map +1 -1
  15. package/dist/dts/genesis/register-genesis-assistant.d.ts +29 -4
  16. package/dist/dts/genesis/register-genesis-assistant.d.ts.map +1 -1
  17. package/dist/dts/genesis/resource-tools.d.ts.map +1 -1
  18. package/dist/dts/genesis/review-model.d.ts.map +1 -1
  19. package/dist/dts/genesis/types.d.ts +37 -5
  20. package/dist/dts/genesis/types.d.ts.map +1 -1
  21. package/dist/dts/genesis/write-payload.d.ts.map +1 -1
  22. package/dist/dts/genesis/write-tools.d.ts +26 -5
  23. package/dist/dts/genesis/write-tools.d.ts.map +1 -1
  24. package/dist/esm/genesis/config.js +105 -50
  25. package/dist/esm/genesis/consumes.js +30 -0
  26. package/dist/esm/genesis/criteria.js +28 -0
  27. package/dist/esm/genesis/event-fields.js +20 -3
  28. package/dist/esm/genesis/index.js +1 -0
  29. package/dist/esm/genesis/register-genesis-assistant.js +146 -63
  30. package/dist/esm/genesis/resource-tools.js +20 -12
  31. package/dist/esm/genesis/review-model.js +16 -3
  32. package/dist/esm/genesis/write-payload.js +47 -4
  33. package/dist/esm/genesis/write-tools.js +199 -45
  34. package/dist/genesis-consumes.cjs +35 -0
  35. package/dist/genesis-consumes.cjs.map +7 -0
  36. package/dist/genesis-consumes.mjs +11 -0
  37. package/dist/genesis-consumes.mjs.map +7 -0
  38. package/docs/genesis.md +156 -28
  39. package/package.json +29 -19
  40. package/scripts/build-genesis-consumes-node.mjs +50 -0
  41. package/scripts/smoke-genesis-consumes-node.mjs +70 -0
@@ -1,7 +1,7 @@
1
1
  import { __awaiter } from "tslib";
2
2
  import { getConnect } from '@genesislcap/foundation-comms';
3
3
  import { logger } from '../utils/logger';
4
- import { opFromName, toolNameOf } from './config';
4
+ import { capIsReadable, opFromName, toolNameOf } from './config';
5
5
  import { fieldKindOf as criteriaKindOf } from './criteria';
6
6
  import { loadEventFields } from './event-fields';
7
7
  import { GENESIS_DATA_SOURCE } from './resource-tools';
@@ -9,6 +9,7 @@ import { buildReviewModel, reviewDecisionOf, selectedRows, } from './review-mode
9
9
  import { MAX_FEEDBACK_CHARS } from './review-payload';
10
10
  import { createRequestRowSource } from './row-source';
11
11
  import { genesisTypeName } from './type-name';
12
+ import { GENESIS_EVENT_OPS } from './types';
12
13
  import { commitRows } from './write-commit';
13
14
  import { isCarryOnly, isWholeNumberType, PLATFORM_MAINTAINED, sendableFields, } from './write-payload';
14
15
  import { MAX_WRITE_ROWS, planWrite, stillCurrent, } from './write-plan';
@@ -261,6 +262,21 @@ function writeDefinition(resource, op, fields, keyable) {
261
262
  const decideOp = (resource) => {
262
263
  const named = opFromName(resource.name);
263
264
  const declared = resource.op;
265
+ // An op outside the known set is no op at all. This factory is exported and never runs the
266
+ // validator, and `'MODIFY'` or `'update'` on a name with no suffix passed every check below as
267
+ // a write op that is neither a modify nor a delete: no row read, no merge, no staleness check —
268
+ // an insert-shaped payload that a replacing handler writes over the record, every unnamed
269
+ // column empty.
270
+ // Any op that is there, falsy ones included: `''` or `false` is declared, and is not a known op.
271
+ // Read as absent, it was refused for having no op, with a reason its own name contradicted.
272
+ if (declared !== undefined &&
273
+ declared !== null &&
274
+ !GENESIS_EVENT_OPS.includes(declared)) {
275
+ return {
276
+ refused: `it is declared with op '${String(declared)}', which is not one of ` +
277
+ `${GENESIS_EVENT_OPS.join(', ')}, so there is no way to know what a write through it would do`,
278
+ };
279
+ }
264
280
  if (declared && named && declared !== named) {
265
281
  return {
266
282
  refused: `it is declared as '${declared}' and its name says '${named}'. A write built on the ` +
@@ -311,7 +327,7 @@ const joined = (items) => items.length > 1 ? `${items.slice(0, -1).join(', ')} a
311
327
  * `tools` are the events that can get a write tool by the config, sharing the key, in config
312
328
  * order: the denial's `next` names them, so it promises exactly what the lock refuses.
313
329
  */
314
- const locksOf = (resources, sourceNameOf) => {
330
+ const locksOf = (resources, decide, sourceNameOf) => {
315
331
  const keyOf = (resource) => {
316
332
  var _a;
317
333
  const decided = decideOp(resource);
@@ -322,8 +338,10 @@ const locksOf = (resources, sourceNameOf) => {
322
338
  const table = (source === null || source === void 0 ? void 0 : source.startsWith('REQ_')) ? source.slice('REQ_'.length) : undefined;
323
339
  return table ? { key: `table:${table}`, table } : { key: `event:${resource.name}` };
324
340
  };
341
+ // Decided as the tools decide it, its rowSources entry included: an event the config refuses has
342
+ // no tool, so a denial's `next` does not name it.
325
343
  const canWrite = (resource) => {
326
- const decided = decideOp(resource);
344
+ const decided = decide(resource);
327
345
  if (decided.refused)
328
346
  return false;
329
347
  return decided.op === 'insert' || !!sourceNameOf(resource, decided.op);
@@ -337,6 +355,157 @@ const locksOf = (resources, sourceNameOf) => {
337
355
  return Object.assign(Object.assign({}, lock), { tools });
338
356
  };
339
357
  };
358
+ /**
359
+ * What the config alone settles about the write tools, with no call to the app: which events there
360
+ * are, the op each one writes or why it gets no tool, and where a modify or delete reads its rows.
361
+ *
362
+ * @remarks
363
+ * Metadata read later can still withhold a tool; it can never grant one refused here.
364
+ */
365
+ function configRules(resources, options) {
366
+ var _a, _b;
367
+ const events = resources
368
+ .filter((r) => r.kind === 'event')
369
+ .sort((a, b) => a.name.localeCompare(b.name));
370
+ const requests = resources.filter((r) => r.kind === 'request');
371
+ // The requests the assistant can read: one whose cap cannot be read gets no read tool, and so is
372
+ // no row source either (see capIsReadable).
373
+ const requestNames = new Set(requests.filter(capIsReadable).map((r) => r.name));
374
+ const unreadable = new Set(requests.filter((r) => !capIsReadable(r)).map((r) => r.name));
375
+ const leftOut = new Set((_a = options.leftOut) !== null && _a !== void 0 ? _a : []);
376
+ // An entry for no event these tools were given does nothing, and whoever wrote it believes it
377
+ // does: a misspelt key most of all. Said here, once, so a direct call hears it as registration
378
+ // does (contracts C-15A.4: ignored with a warning that names it).
379
+ const { rowSources } = options;
380
+ // Not a list: its indexes would be named as events ("rowSources names 0"). Registration refuses
381
+ // one as a shape problem; a direct call gets nothing said about it, as it has no entry to judge.
382
+ if (rowSources && typeof rowSources === 'object' && !Array.isArray(rowSources)) {
383
+ const eventNames = new Set(events.map((resource) => resource.name));
384
+ const named = Object.keys(rowSources).filter((name) => !eventNames.has(name));
385
+ // An event the config has, but that was left out, is not one it "offers no event resource
386
+ // for": said so, whoever reads the console went looking for an event that is there.
387
+ const dropped = named.filter((name) => leftOut.has(name));
388
+ const unknown = named.filter((name) => !leftOut.has(name));
389
+ if (dropped.length) {
390
+ const said = dropped.length === 1
391
+ ? 'was left out (the warning that names it says why), so it has no effect'
392
+ : 'were left out (the warnings that name them say why), so they have no effect';
393
+ logger.warn(`Genesis assistant: rowSources names ${dropped.join(', ')}, which ${said}.`);
394
+ }
395
+ if (unknown.length) {
396
+ logger.warn(`Genesis assistant: rowSources names ${unknown.join(', ')}, which the AI config offers ` +
397
+ 'no event resource for, so it has no effect.');
398
+ }
399
+ }
400
+ /**
401
+ * Why a rowSources entry costs this event its write tool, or nothing when it has no entry or
402
+ * the entry names the `REQ_<T>` derived from its own name. Said when the tool is withheld and by
403
+ * the handler, for every op: the rule is about the entry, not about whether the op reads rows.
404
+ *
405
+ * @remarks
406
+ * rowSources used to name any request resource the app exposed. But a write's pre-image has to
407
+ * be the root record as it stands. A view can return a joined table's column under a name the
408
+ * event also has (a STATUS from a joined ORDER), which passes the name-only coverage check and
409
+ * writes the joined table's value into the root record. And a dataserver query is read from a
410
+ * cache that can lag the very change the staleness check exists to catch. So an entry naming
411
+ * anything else is refused, not honoured and not quietly replaced by the default: whoever
412
+ * wrote it meant a different source, and a warning naming what they gave and what is accepted
413
+ * is the thing to find (contracts C-15A.4).
414
+ */
415
+ const rowSourceRefusal = (eventName) => {
416
+ const { rowSources } = options;
417
+ if (!rowSources || !Object.prototype.hasOwnProperty.call(rowSources, eventName)) {
418
+ return undefined;
419
+ }
420
+ const given = rowSources[eventName];
421
+ const expected = readResourceFor(eventName);
422
+ // An event with no table in its name accepts no entry at all — not even an `undefined` one,
423
+ // which `given === expected` would otherwise read as agreeing with the missing derived name.
424
+ if (expected !== undefined && given === expected)
425
+ return undefined;
426
+ return (`rowSources gives ${String(given)} for it, and ` +
427
+ (expected
428
+ ? `only ${expected}, its table's own request resource, is accepted`
429
+ : 'none is accepted, as its name does not end in _INSERT, _MODIFY or _DELETE') +
430
+ '. A view or a query is never a pre-image');
431
+ };
432
+ /**
433
+ * The op a write through this event does, or why it gets no tool: its own op rules first, then
434
+ * its rowSources entry. One decision for both the definition and the handler, so they cannot
435
+ * disagree about which events may write.
436
+ */
437
+ const decide = (resource) => {
438
+ const decided = decideOp(resource);
439
+ const byRowSources = rowSourceRefusal(resource.name);
440
+ if (!byRowSources)
441
+ return decided;
442
+ // Both reasons when both hold: the op's alone would leave a wrong rowSources entry unsaid,
443
+ // to come back as a refusal the day the op is fixed.
444
+ return { refused: decided.refused ? `${decided.refused}; and ${byRowSources}` : byRowSources };
445
+ };
446
+ /**
447
+ * Why a modify or delete has no row source: said when its tool is withheld and by its handler.
448
+ * `forConsole` points at the warning that names a left-out resource, which only the console has:
449
+ * the model reading the handler's reply has no console to look in.
450
+ */
451
+ const whyNoSource = (eventName, forConsole = false) => {
452
+ const derived = readResourceFor(eventName);
453
+ if (derived && unreadable.has(derived)) {
454
+ return (`its table's own request resource, ${derived}, has no read tool, as its maxRows is not ` +
455
+ 'a number, and a write reads its rows only through a resource the assistant can read');
456
+ }
457
+ if (derived && leftOut.has(derived)) {
458
+ return (`its table's own request resource, ${derived}, is in the AI config but was left out, so ` +
459
+ 'there is nothing to read its rows from' +
460
+ (forConsole ? '. The warning that names it says why' : ''));
461
+ }
462
+ return derived
463
+ ? `the app exposes no request resource to read its rows from. Add ${derived} to the AI config`
464
+ : 'its name does not end in _MODIFY or _DELETE, so there is no table to read its rows from';
465
+ };
466
+ /**
467
+ * The request resource a modify or delete reads its rows through, or none, in which case it
468
+ * gets no tool.
469
+ *
470
+ * @remarks
471
+ * The DECIDED op, not `resource.op`: a resource whose op comes from its name would otherwise be
472
+ * told it needs a row source and handed none. Only the table's own request resource, and only
473
+ * when the assistant can already read it: that keeps the write path from becoming a read
474
+ * side-channel for columns no read tool may return. rowSources is never read here: an entry
475
+ * naming anything else costs the event its tool before a source is asked for (see
476
+ * rowSourceRefusal).
477
+ */
478
+ const readsFrom = (resource, op) => {
479
+ if (op !== 'modify' && op !== 'delete')
480
+ return undefined;
481
+ const name = readResourceFor(resource.name);
482
+ return name && requestNames.has(name) ? name : undefined;
483
+ };
484
+ /**
485
+ * The events the config lets write: not refused by `decide`, and a modify or delete with a row
486
+ * source. Metadata read later can still withhold a tool from one of them, never grant one.
487
+ */
488
+ const writable = events
489
+ .filter((resource) => {
490
+ const decided = decide(resource);
491
+ return !decided.refused && (decided.op === 'insert' || !!readsFrom(resource, decided.op));
492
+ })
493
+ .map((resource) => resource.name);
494
+ // What the config alone refuses is known now, so it is said now, once: a console checked right
495
+ // after registration showed nothing until the tools were first listed (contracts C-15A.4(b)).
496
+ // Registration builds these tools only after its last blocking check, so nothing here is said
497
+ // of an assistant that does not run.
498
+ // A modify or delete with no row source is decided here too, from the config alone.
499
+ for (const resource of events) {
500
+ const decided = decide(resource);
501
+ const noSource = !decided.refused && decided.op !== 'insert' && !readsFrom(resource, decided.op);
502
+ if (decided.refused || noSource) {
503
+ logger.warn(`Genesis assistant: ${resource.name} has no write tool because ` +
504
+ `${(_b = decided.refused) !== null && _b !== void 0 ? _b : whyNoSource(resource.name, true)}.`);
505
+ }
506
+ }
507
+ return { events, decide, whyNoSource, readsFrom, writable };
508
+ }
340
509
  /**
341
510
  * Builds the assistant's write tools from an app's event resources.
342
511
  *
@@ -344,10 +513,7 @@ const locksOf = (resources, sourceNameOf) => {
344
513
  */
345
514
  export function createGenesisWriteTools(resources, options = {}) {
346
515
  var _a;
347
- const events = resources
348
- .filter((r) => r.kind === 'event')
349
- .sort((a, b) => a.name.localeCompare(b.name));
350
- const requestNames = new Set(resources.filter((r) => r.kind === 'request').map((r) => r.name));
516
+ const { events, decide, whyNoSource, readsFrom, writable } = configRules(resources, options);
351
517
  const resolveConnect = () => {
352
518
  var _a;
353
519
  try {
@@ -358,31 +524,14 @@ export function createGenesisWriteTools(resources, options = {}) {
358
524
  }
359
525
  };
360
526
  const sources = new Map();
361
- /** The name of the request resource a modify or delete reads through, or none. */
362
- const sourceNameOf = (resource, op) => {
363
- var _a;
364
- // The DECIDED op, not `resource.op`: a resource whose op comes from its name would
365
- // otherwise be told it needs a row source and handed none.
366
- if (op !== 'modify' && op !== 'delete')
367
- return undefined;
368
- const configured = (_a = options.rowSources) === null || _a === void 0 ? void 0 : _a[resource.name];
369
- const derived = readResourceFor(resource.name);
370
- // Gated for the OVERRIDE as well as the derived name. A modify reads through a resource the
371
- // assistant can already read — that is the rule the docs state, and it is what keeps the
372
- // write path from becoming a read side-channel for columns no read tool may return. An
373
- // unchecked override would let a config typo widen that silently, and the pre-image it
374
- // fetched would land in the driver's persisted history.
375
- const name = configured !== null && configured !== void 0 ? configured : derived;
376
- return name && requestNames.has(name) ? name : undefined;
377
- };
378
- const lockOf = locksOf(resources, sourceNameOf);
527
+ const lockOf = locksOf(resources, decide, readsFrom);
379
528
  /**
380
529
  * The resource a modify or delete reads through, or nothing — in which case the event gets no
381
530
  * tool. A modify with no row to read cannot be built: under replace semantics the fields
382
531
  * nobody named would be written as null.
383
532
  */
384
533
  const sourceFor = (resource, op, connect) => {
385
- const name = sourceNameOf(resource, op);
534
+ const name = readsFrom(resource, op);
386
535
  if (!name)
387
536
  return undefined;
388
537
  let source = sources.get(resource.name);
@@ -448,13 +597,13 @@ export function createGenesisWriteTools(resources, options = {}) {
448
597
  yield Promise.all(events
449
598
  .filter((resource) => !settled.has(resource.name) && !skipped.has(resource.name))
450
599
  .map((resource) => __awaiter(this, void 0, void 0, function* () {
451
- var _a;
452
600
  // What op this is has to be settled before anything else is decided by it. The
453
601
  // config validator checks it too, but only the registration path reaches that.
454
- const decided = decideOp(resource);
602
+ const decided = decide(resource);
603
+ // Settled for good: its op and its rowSources entry are the config's, not this moment's.
604
+ // Already said, when these tools were built (see configRules).
455
605
  if (decided.refused) {
456
606
  skipped.add(resource.name);
457
- logger.warn(`Genesis assistant: ${resource.name} has no write tool because ${decided.refused}.`);
458
607
  return;
459
608
  }
460
609
  const source = sourceFor(resource, decided.op, connect);
@@ -462,17 +611,9 @@ export function createGenesisWriteTools(resources, options = {}) {
462
611
  if (needsRow && !source) {
463
612
  // Settled for good: the app exposes no resource to read this event's rows
464
613
  // through, which is a property of the config rather than of this moment, so
465
- // asking again on the next turn would give the same answer.
614
+ // asking again on the next turn would give the same answer. Already said, when
615
+ // these tools were built (see configRules).
466
616
  skipped.add(resource.name);
467
- const named = (_a = options.rowSources) === null || _a === void 0 ? void 0 : _a[resource.name];
468
- logger.warn(`Genesis assistant: ${resource.name} has no write tool because ` +
469
- (named
470
- ? `rowSources names ${named}, which is not a request resource in this app's ` +
471
- 'AI config. A write reads its rows through a resource the assistant can ' +
472
- 'already read.'
473
- : 'the app exposes no request resource to read its rows from. Add ' +
474
- `${readResourceFor(resource.name)} to the AI config, or name one in ` +
475
- 'rowSources.'));
476
617
  return;
477
618
  }
478
619
  const fields = yield loadFields(resource, connect);
@@ -510,7 +651,8 @@ export function createGenesisWriteTools(resources, options = {}) {
510
651
  logger.warn(`Genesis assistant: ${resource.name} has no write tool because ` +
511
652
  `${source.resource} does not return ${covered.missing.join(', ')}. A ` +
512
653
  'generated modify replaces the record, so a column it cannot read would be ' +
513
- 'written null. Point rowSources at a resource that returns every field.');
654
+ "written null. Its table's own request resource has to return every field " +
655
+ 'the event writes.');
514
656
  return;
515
657
  }
516
658
  }
@@ -550,6 +692,8 @@ export function createGenesisWriteTools(resources, options = {}) {
550
692
  return runWrite(resource, args, context, {
551
693
  connect: resolveConnect(),
552
694
  sourceFor,
695
+ whyNoSource,
696
+ decide,
553
697
  loadFields,
554
698
  coverage,
555
699
  timeouts: options.timeouts,
@@ -559,7 +703,7 @@ export function createGenesisWriteTools(resources, options = {}) {
559
703
  });
560
704
  });
561
705
  }
562
- return { toolDefinitions, toolHandlers };
706
+ return { toolDefinitions, toolHandlers, writableEvents: writable };
563
707
  }
564
708
  /**
565
709
  * The line for a row that was sent, with anything the plan must also say about it — a blank the
@@ -624,7 +768,7 @@ function runWrite(resource, args, context, deps) {
624
768
  });
625
769
  // Settled here as well as when the tool was defined: this factory is exported, so a host can
626
770
  // hold the handlers without ever calling toolDefinitions().
627
- const decided = decideOp(resource);
771
+ const decided = deps.decide(resource);
628
772
  if (decided.refused) {
629
773
  return fail('rejected', `${resource.name} has no write tool because ${decided.refused}.`);
630
774
  }
@@ -650,7 +794,7 @@ function runWrite(resource, args, context, deps) {
650
794
  }
651
795
  const source = deps.sourceFor(resource, op, connect);
652
796
  if ((op === 'modify' || op === 'delete') && !source) {
653
- return fail('rejected', `${resource.name} has no resource to read its rows from.`);
797
+ return fail('rejected', `${resource.name} cannot be written: ${deps.whyNoSource(resource.name)}. Nothing was sent.`);
654
798
  }
655
799
  if (source && op === 'modify') {
656
800
  // Checked here as well as when the tool was defined, because this factory is exported: a
@@ -677,6 +821,11 @@ function runWrite(resource, args, context, deps) {
677
821
  const shownFields = [...sendableFields(fields, op)];
678
822
  if (op === 'delete' && source) {
679
823
  const described = yield source.describes();
824
+ // `?? []` is for the type, and never decides anything. A row has a pre-image to render only if
825
+ // its read succeeded, a read succeeds only after the source's metadata has loaded, and the
826
+ // source keeps a successful load (row-source.ts) — so by here `described` is there whenever a
827
+ // row carries a pre-image. With no row read there is nothing extra to show. (Reviewed twice by
828
+ // the behaviour-defaults sweep; written down so it is not raised a third time.)
680
829
  for (const [name, type] of described !== null && described !== void 0 ? described : []) {
681
830
  // The platform's own columns stay out, as review-model already keeps them out of the
682
831
  // columns a row brings: a delete showing RECORD_ID and TIMESTAMP would be the same table
@@ -778,8 +927,13 @@ function runWrite(resource, args, context, deps) {
778
927
  deps.turns.deny(context.turnSignal, lock.key, resource.name);
779
928
  if (read.decision === 'changes_requested')
780
929
  turn.changeRequests += 1;
781
- // Only the proposal just asked about is remembered: any other answer clears it.
782
- turn.lastAsked = read.decision === 'changes_requested' ? proposal : undefined;
930
+ // Only the proposal just asked about is remembered, until another ANSWER replaces it. A timeout
931
+ // is not an answer: the user said nothing, so the change they asked for still stands, and a
932
+ // resend of the proposal they asked to change is still refused. Cleared on a timeout, it opened
933
+ // a fresh review of exactly that proposal, one Approve from being written.
934
+ if (read.decision !== 'timed_out') {
935
+ turn.lastAsked = read.decision === 'changes_requested' ? proposal : undefined;
936
+ }
783
937
  if (read.decision !== 'approved') {
784
938
  return declinedResult(resource.name, plan.rows, read, turn.changeRequests, deps.feedbackKey, lock);
785
939
  }
@@ -0,0 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/genesis/consumes.ts
20
+ var consumes_exports = {};
21
+ __export(consumes_exports, {
22
+ GENESIS_AI_CONSUMES: () => GENESIS_AI_CONSUMES
23
+ });
24
+ module.exports = __toCommonJS(consumes_exports);
25
+ var GENESIS_AI_CONSUMES = Object.freeze({
26
+ kinds: Object.freeze(["request", "event"]),
27
+ resourceFields: Object.freeze(["name", "kind", "op", "context", "maxRows"]),
28
+ vendors: Object.freeze(["anthropic", "gemini"]),
29
+ tiers: Object.freeze(["low", "high", "reasoning"])
30
+ });
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ GENESIS_AI_CONSUMES
34
+ });
35
+ //# sourceMappingURL=genesis-consumes.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/genesis/consumes.ts"],
4
+ "sourcesContent": ["/**\n * What this version of the assistant reads from a generated AI config\n * (`@genesislcap/ai-assistant/genesis/consumes`).\n *\n * @remarks\n * Its own entry point, loadable in bare Node, because the seed's CI reads it in a Node step and\n * `./genesis` cannot be: that entry is bundler-target ESM, and its closure registers custom\n * elements, which need a DOM. So this module imports nothing at run time. A type from `./types`\n * is all it may take, and a test holds it to that. The Node build bundles it to\n * `dist/genesis-consumes.mjs` and `.cjs`, and a smoke test loads both without a DOM.\n *\n * @packageDocumentation\n * @beta\n */\nimport type { GenesisAiConsumes } from './types';\n\nexport type { GenesisAiConsumes } from './types';\n\n/**\n * What this version of the assistant reads from a generated AI config: the resource kinds it\n * accepts, the resource fields its validator or a tool reads, and the `vendor` and `tier` values\n * it accepts.\n *\n * @remarks\n * The generator must not emit what the installed assistant does not read, or a new kind is left out\n * and a new field ignored \u2014 and an older assistant used to block entirely on a kind it did not know.\n * Nothing in the generator can say which version will run its output. So the app's seed declares\n * what it expects, and the seed's CI checks that declaration against this constant, exported from\n * the version it installs. That makes this the single statement of what an assistant consumes, and\n * it carries no version number because it needs none.\n *\n * A test holds it to the code: its kinds are the ones validation accepts, and its fields are the\n * ones read. A change that teaches the validator a kind, or a tool a field, updates it in the same\n * commit.\n *\n * A resource this version does not read is only left out, but an unknown `vendor` or `tier` still\n * blocks the whole assistant, so those are here too. They are written out rather than imported\n * from foundation-ai, which this entry must not load; a test holds them equal to its\n * `AI_TIER_VENDORS` and `AI_TIER_IDS`, which the validator checks against.\n *\n * @beta\n */\nexport const GENESIS_AI_CONSUMES: GenesisAiConsumes = Object.freeze({\n kinds: Object.freeze(['request', 'event'] as const),\n resourceFields: Object.freeze(['name', 'kind', 'op', 'context', 'maxRows'] as const),\n vendors: Object.freeze(['anthropic', 'gemini'] as const),\n tiers: Object.freeze(['low', 'high', 'reasoning'] as const),\n});\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0CO,IAAM,sBAAyC,OAAO,OAAO;AAAA,EAClE,OAAO,OAAO,OAAO,CAAC,WAAW,OAAO,CAAU;AAAA,EAClD,gBAAgB,OAAO,OAAO,CAAC,QAAQ,QAAQ,MAAM,WAAW,SAAS,CAAU;AAAA,EACnF,SAAS,OAAO,OAAO,CAAC,aAAa,QAAQ,CAAU;AAAA,EACvD,OAAO,OAAO,OAAO,CAAC,OAAO,QAAQ,WAAW,CAAU;AAC5D,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,11 @@
1
+ // src/genesis/consumes.ts
2
+ var GENESIS_AI_CONSUMES = Object.freeze({
3
+ kinds: Object.freeze(["request", "event"]),
4
+ resourceFields: Object.freeze(["name", "kind", "op", "context", "maxRows"]),
5
+ vendors: Object.freeze(["anthropic", "gemini"]),
6
+ tiers: Object.freeze(["low", "high", "reasoning"])
7
+ });
8
+ export {
9
+ GENESIS_AI_CONSUMES
10
+ };
11
+ //# sourceMappingURL=genesis-consumes.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/genesis/consumes.ts"],
4
+ "sourcesContent": ["/**\n * What this version of the assistant reads from a generated AI config\n * (`@genesislcap/ai-assistant/genesis/consumes`).\n *\n * @remarks\n * Its own entry point, loadable in bare Node, because the seed's CI reads it in a Node step and\n * `./genesis` cannot be: that entry is bundler-target ESM, and its closure registers custom\n * elements, which need a DOM. So this module imports nothing at run time. A type from `./types`\n * is all it may take, and a test holds it to that. The Node build bundles it to\n * `dist/genesis-consumes.mjs` and `.cjs`, and a smoke test loads both without a DOM.\n *\n * @packageDocumentation\n * @beta\n */\nimport type { GenesisAiConsumes } from './types';\n\nexport type { GenesisAiConsumes } from './types';\n\n/**\n * What this version of the assistant reads from a generated AI config: the resource kinds it\n * accepts, the resource fields its validator or a tool reads, and the `vendor` and `tier` values\n * it accepts.\n *\n * @remarks\n * The generator must not emit what the installed assistant does not read, or a new kind is left out\n * and a new field ignored \u2014 and an older assistant used to block entirely on a kind it did not know.\n * Nothing in the generator can say which version will run its output. So the app's seed declares\n * what it expects, and the seed's CI checks that declaration against this constant, exported from\n * the version it installs. That makes this the single statement of what an assistant consumes, and\n * it carries no version number because it needs none.\n *\n * A test holds it to the code: its kinds are the ones validation accepts, and its fields are the\n * ones read. A change that teaches the validator a kind, or a tool a field, updates it in the same\n * commit.\n *\n * A resource this version does not read is only left out, but an unknown `vendor` or `tier` still\n * blocks the whole assistant, so those are here too. They are written out rather than imported\n * from foundation-ai, which this entry must not load; a test holds them equal to its\n * `AI_TIER_VENDORS` and `AI_TIER_IDS`, which the validator checks against.\n *\n * @beta\n */\nexport const GENESIS_AI_CONSUMES: GenesisAiConsumes = Object.freeze({\n kinds: Object.freeze(['request', 'event'] as const),\n resourceFields: Object.freeze(['name', 'kind', 'op', 'context', 'maxRows'] as const),\n vendors: Object.freeze(['anthropic', 'gemini'] as const),\n tiers: Object.freeze(['low', 'high', 'reasoning'] as const),\n});\n"],
5
+ "mappings": ";AA0CO,IAAM,sBAAyC,OAAO,OAAO;AAAA,EAClE,OAAO,OAAO,OAAO,CAAC,WAAW,OAAO,CAAU;AAAA,EAClD,gBAAgB,OAAO,OAAO,CAAC,QAAQ,QAAQ,MAAM,WAAW,SAAS,CAAU;AAAA,EACnF,SAAS,OAAO,OAAO,CAAC,aAAa,QAAQ,CAAU;AAAA,EACvD,OAAO,OAAO,OAAO,CAAC,OAAO,QAAQ,WAAW,CAAU;AAC5D,CAAC;",
6
+ "names": []
7
+ }