@datalayer/agent-runtimes 1.3.82 โ†’ 1.3.84

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 (52) hide show
  1. package/lib/chat/base/ChatBase.js +16 -0
  2. package/lib/chat/base/loopElement.d.ts +53 -0
  3. package/lib/chat/base/loopElement.js +78 -0
  4. package/lib/chat/base/loopWindow.d.ts +31 -0
  5. package/lib/chat/base/loopWindow.js +74 -0
  6. package/lib/components/a2ui/datalayer/FileUpload.d.ts +10 -2
  7. package/lib/components/a2ui/datalayer/FileUpload.js +10 -7
  8. package/lib/components/a2ui/datalayer/Form.d.ts +2 -0
  9. package/lib/components/a2ui/datalayer/Form.js +26 -2
  10. package/lib/components/a2ui/datalayer/formWidgets.d.ts +19 -0
  11. package/lib/components/a2ui/datalayer/formWidgets.js +51 -0
  12. package/lib/loop/apps/AppComposer.d.ts +39 -4
  13. package/lib/loop/apps/AppComposer.js +191 -19
  14. package/lib/loop/apps/AppRenderer.d.ts +20 -3
  15. package/lib/loop/apps/AppRenderer.js +58 -27
  16. package/lib/loop/apps/appspec.d.ts +2 -0
  17. package/lib/loop/apps/appspec.js +196 -39
  18. package/lib/loop/apps/checks.d.ts +6 -0
  19. package/lib/loop/apps/checks.js +187 -8
  20. package/lib/loop/apps/composer.d.ts +21 -10
  21. package/lib/loop/apps/composer.js +41 -8
  22. package/lib/loop/apps/language.d.ts +68 -0
  23. package/lib/loop/apps/language.js +275 -0
  24. package/lib/loop/apps/settingsInputs.d.ts +29 -0
  25. package/lib/loop/apps/settingsInputs.js +147 -0
  26. package/lib/loop/apps/uploads.d.ts +43 -0
  27. package/lib/loop/apps/uploads.js +66 -0
  28. package/lib/loop/core/index.d.ts +14 -1
  29. package/lib/loop/embed/AppEmbed.d.ts +14 -0
  30. package/lib/loop/embed/AppEmbed.js +64 -2
  31. package/lib/loop/embed/element.js +23 -0
  32. package/lib/loop/embed/embedSession.d.ts +14 -0
  33. package/lib/loop/embed/embedSession.js +34 -0
  34. package/lib/loop/embed/hostBridge.d.ts +22 -1
  35. package/lib/loop/plugins/app-elements/AppElements.d.ts +27 -0
  36. package/lib/loop/plugins/app-elements/AppElements.js +76 -0
  37. package/lib/loop/plugins/app-elements/index.d.ts +20 -0
  38. package/lib/loop/plugins/app-elements/index.js +43 -0
  39. package/lib/loop/plugins/app-page/appPageModel.d.ts +14 -5
  40. package/lib/loop/plugins/app-page/appPageModel.js +82 -88
  41. package/lib/loop/plugins/chat/ChatView.js +10 -2
  42. package/lib/protocols/BrowserAgentAdapter.d.ts +8 -6
  43. package/lib/protocols/BrowserAgentAdapter.js +13 -10
  44. package/lib/runtimes/browser/protocol.d.ts +1 -1
  45. package/lib/specs/agents/agents.js +6 -3
  46. package/lib/specs/apps.js +337 -176
  47. package/lib/specs/appspecSchema.js +455 -88
  48. package/lib/specs/cogs.js +3 -2
  49. package/lib/specs/uiPlugins.js +6 -1
  50. package/lib/types/agentspecs.d.ts +167 -11
  51. package/package.json +1 -1
  52. package/scripts/codegen/generate_apps.py +16 -1
@@ -949,7 +949,7 @@ export const A2UI_UI_PLUGIN_0_0_1 = {
949
949
  category: 'input',
950
950
  emoji: '๐Ÿงพ',
951
951
  description: 'Several fields asked at once, from a JSON Schema, checked as they are filled and again when they arrive (drawn with @datalayer/primer-rjsf).',
952
- version: '1.0.0',
952
+ version: '1.1.0',
953
953
  standard: false,
954
954
  properties: {
955
955
  type: 'object',
@@ -965,6 +965,11 @@ export const A2UI_UI_PLUGIN_0_0_1 = {
965
965
  title: 'Fields',
966
966
  description: 'The JSON Schema of what is asked: its fields, their types, what is required.',
967
967
  },
968
+ ui: {
969
+ type: 'object',
970
+ title: 'How its fields are drawn',
971
+ description: "By field name, the ui: options @datalayer/primer-rjsf reads (a uiSchema): ui:widget one of select, radio, range, updown, switch, checkbox, text, textarea, date, checkboxes, tags; each field's own widget when unsaid.",
972
+ },
968
973
  submit_label: {
969
974
  type: 'string',
970
975
  title: 'Send button',
@@ -446,6 +446,59 @@ export interface AppPermissionsSpec {
446
446
  export interface AppStarterSpec {
447
447
  label: string;
448
448
  message: string;
449
+ /**
450
+ * The heading it is offered under (LOOP P-20): the starters of one
451
+ * category together, those without one first. Absent when unsaid.
452
+ */
453
+ category?: string;
454
+ }
455
+ /**
456
+ * One of several assistants in one application (LOOP P-20): picked before
457
+ * the conversation starts โ€” the first unless another is โ€” and kept to its
458
+ * end. Its instructions are told in every run, its model run in place of the
459
+ * application's (a mode's wins over it), its starters offered in place of
460
+ * the application's.
461
+ */
462
+ export interface AppProfileSpec {
463
+ id: string;
464
+ label: string;
465
+ description: string;
466
+ instructions: string;
467
+ model: string | null;
468
+ starters: AppStarterSpec[];
469
+ }
470
+ /**
471
+ * What a person reads of an application in another language (LOOP P-26):
472
+ * each part keyed by what names it in the spec โ€” a starter by its label, a
473
+ * category by its words, a setting by its field, a command by its name, a
474
+ * mode and a profile by their ids. Every key present; empty is untranslated.
475
+ */
476
+ export interface AppTranslationSpec {
477
+ name: string;
478
+ description: string;
479
+ welcome: string;
480
+ starters: Record<string, {
481
+ label: string;
482
+ message: string;
483
+ }>;
484
+ categories: Record<string, string>;
485
+ settings: Record<string, {
486
+ title: string;
487
+ description: string;
488
+ options: Record<string, string>;
489
+ }>;
490
+ commands: Record<string, string>;
491
+ modes: Record<string, {
492
+ label: string;
493
+ options: Record<string, {
494
+ label: string;
495
+ description: string;
496
+ }>;
497
+ }>;
498
+ profiles: Record<string, {
499
+ label: string;
500
+ description: string;
501
+ }>;
449
502
  }
450
503
  /** A slash command the user picks in the composer (LOOP P-19). */
451
504
  export interface AppCommandSpec {
@@ -485,15 +538,33 @@ export interface AppModeEffect {
485
538
  /** The model an option chosen names; the application's when unsaid. */
486
539
  model?: string;
487
540
  }
488
- export interface AppSettingSpec {
489
- id: string;
490
- type: 'select' | 'text' | 'toggle' | 'slider' | 'number';
491
- label: string;
492
- options: string[];
493
- default?: string | boolean | number;
494
- min?: number;
495
- max?: number;
496
- }
541
+ /**
542
+ * One field of a form (LOOP C-16): its JSON Schema โ€” a `type`, the `title` a
543
+ * person reads, its `default`, and what it takes (`enum`, `minimum`,
544
+ * `maximum`โ€ฆ).
545
+ */
546
+ export type AppFormField = {
547
+ type?: string;
548
+ title?: string;
549
+ description?: string;
550
+ default?: unknown;
551
+ enum?: unknown[];
552
+ minimum?: number;
553
+ maximum?: number;
554
+ [keyword: string]: unknown;
555
+ };
556
+ /**
557
+ * The JSON Schema of a form (LOOP C-16): an object of named fields, drawn with
558
+ * `@datalayer/primer-rjsf` and checked by the runtime against the same schema.
559
+ * An application's settings are one (`interface.settings`), as a Form block's
560
+ * schema is.
561
+ */
562
+ export type AppFormSchema = {
563
+ type: 'object';
564
+ properties: Record<string, AppFormField>;
565
+ required?: string[];
566
+ [keyword: string]: unknown;
567
+ };
497
568
  /** The component tree a user meets, over the approved catalog (A2UI). */
498
569
  export interface AppSurfaceSpec {
499
570
  protocol: string;
@@ -519,6 +590,25 @@ export interface AppVoiceSpec {
519
590
  language: string;
520
591
  where: 'auto' | 'device' | 'server';
521
592
  }
593
+ /**
594
+ * A kind of file a person may send, and how large (LOOP P-21): a media type
595
+ * (`application/pdf`), a family (`image/*`, `audio/*`) or an extension
596
+ * (`.csv`), lowercase.
597
+ */
598
+ export interface AppUploadKindSpec {
599
+ type: string;
600
+ /** The largest file of this kind, in megabytes; 10 unless said, 25 at most. */
601
+ maxMb: number;
602
+ }
603
+ /**
604
+ * What a person may send in the composer without being asked (LOOP P-21):
605
+ * the kinds it takes, each with its largest size, and how many at once.
606
+ */
607
+ export interface AppUploadsSpec {
608
+ kinds: AppUploadKindSpec[];
609
+ /** The most files sent with one message; 5 unless said. */
610
+ maxFiles: number;
611
+ }
522
612
  /** What the user of an application sees. */
523
613
  export interface AppInterfaceSpec {
524
614
  layout: AppLayout;
@@ -532,7 +622,33 @@ export interface AppInterfaceSpec {
532
622
  commands: AppCommandSpec[];
533
623
  /** Mode switches in the composer, the option picked going with every run (P-19). */
534
624
  modes: AppModeSpec[];
535
- settings: AppSettingSpec[];
625
+ /**
626
+ * Several assistants in one application (P-20): two at least, or none.
627
+ * Absent from a spec made before profiles.
628
+ */
629
+ profiles?: AppProfileSpec[];
630
+ /**
631
+ * What a person may set: the JSON Schema of a form (C-16), drawn beside the
632
+ * conversation and on a deployment's Ship card; none when unsaid.
633
+ */
634
+ settings?: AppFormSchema;
635
+ /**
636
+ * How the settings' fields are drawn (P-20): a uiSchema as
637
+ * `@datalayer/primer-rjsf` reads it, by field name โ€” `ui:widget` one of
638
+ * `select`, `radio`, `range`, `updown`, `switch`, `checkbox`, `text`,
639
+ * `textarea`, `date`, `checkboxes`, `tags`. Each field's own when unsaid.
640
+ */
641
+ settingsUi?: Record<string, unknown>;
642
+ /** The language its own words are in, BCP 47 (P-26); `en` when absent. */
643
+ language?: string;
644
+ /** Its words in other languages, by BCP 47 tag (P-26). */
645
+ translations?: Record<string, AppTranslationSpec>;
646
+ /**
647
+ * What a person may send in the composer without being asked (P-21): none
648
+ * when unsaid โ€” the composer offers no attachment, and the runtime refuses
649
+ * a file sent with a message.
650
+ */
651
+ uploads?: AppUploadsSpec;
536
652
  /** The components of the catalog the surface may use. */
537
653
  components: string[];
538
654
  surface?: AppSurfaceSpec;
@@ -559,6 +675,12 @@ export interface AppInterfaceSpec {
559
675
  export interface AppTestCaseSpec {
560
676
  ask: string;
561
677
  expect: string;
678
+ /**
679
+ * The function of its code that decides the case, by name (LOOP P-06:
680
+ * `@app.test`); `expect` still says it in words, and decides it without
681
+ * the file. Empty, or absent, for a case in words alone.
682
+ */
683
+ code?: string;
562
684
  }
563
685
  /**
564
686
  * What was verified, and how, each in a sentence a person reads (LOOP E-14):
@@ -590,11 +712,38 @@ export interface AppRecordSpec {
590
712
  */
591
713
  suggestTests: boolean;
592
714
  }
593
- /** Optional checks from the catalogue. */
715
+ /** Where a check of an application's code runs (LOOP P-06). */
716
+ export type AppCheckStage = 'answer' | 'tool_call';
717
+ /** A check written in an application's code (LOOP P-06: `@app.check`). */
718
+ export interface AppCodeCheckSpec {
719
+ /** The function of its code that checks. */
720
+ name: string;
721
+ /** On every answer, or every tool call the rules let through. */
722
+ on: AppCheckStage;
723
+ /** What it checks, in a sentence a person reads. */
724
+ description: string;
725
+ }
726
+ /** Optional checks from the catalogue, and its code's own. */
594
727
  export interface AppChecksSpec {
595
728
  guards: string[];
596
729
  gates: string[];
597
730
  track: string;
731
+ /** Checks written in its code (LOOP P-06); absent when it has none. */
732
+ code?: AppCodeCheckSpec[];
733
+ }
734
+ /**
735
+ * A tool of an application's own, written in its code (LOOP P-06:
736
+ * `@app.tool`): its agent calls it, and the rules decide each call by what
737
+ * it `does`, or by a rule that names it by its name alone.
738
+ */
739
+ export interface AppToolSpec {
740
+ name: string;
741
+ /** What it does, for the agent. */
742
+ description: string;
743
+ /** The JSON Schema of its arguments, an object. */
744
+ parameters: Record<string, unknown>;
745
+ /** What it does, by class of action: `read`, `write`, `send`โ€ฆ */
746
+ does: string[];
598
747
  }
599
748
  /** A function of the host page the application's agent may call (LOOP D-10). */
600
749
  export interface AppHostFunctionSpec {
@@ -689,6 +838,8 @@ export interface AppSpec {
689
838
  skills: string[];
690
839
  /** Backend tools (agentspecs/backend-tools) it adds to its agent's. */
691
840
  backendTools: string[];
841
+ /** Tools of its own, written in its code (LOOP P-06); absent when it has none. */
842
+ tools?: AppToolSpec[];
692
843
  /** The Frames it works under. */
693
844
  context: string[];
694
845
  /** The documents and datasets it answers from. */
@@ -710,6 +861,11 @@ export interface AppSpec {
710
861
  /** What it names that is not enabled today, in sentences. */
711
862
  setup: string[];
712
863
  enabled: boolean;
864
+ /**
865
+ * Why it is not offered today, in a sentence its page shows: said when
866
+ * `enabled` is false, and only then (empty otherwise).
867
+ */
868
+ unavailable_because: string;
713
869
  tags: string[];
714
870
  icon?: string;
715
871
  /** Its face: one emoji, shown wherever the application appears. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/agent-runtimes",
3
- "version": "1.3.82",
3
+ "version": "1.3.84",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",
@@ -54,6 +54,7 @@ CAMEL = {
54
54
  "decision_model": "decisionModel",
55
55
  "backend_tools": "backendTools",
56
56
  "character_alone": "characterAlone",
57
+ "settings_ui": "settingsUi",
57
58
  }
58
59
 
59
60
  #: The keys whose value is carried as it is written: a component tree, weights by name.
@@ -110,6 +111,21 @@ def load_specs(specs_dir: Path) -> tuple[list[dict[str, Any]], dict[str, Any]]:
110
111
  if isinstance(rule["applies_to"], str)
111
112
  else rule["applies_to"]
112
113
  )
114
+ # A starter offered under a category names it; the others say nothing of it.
115
+ for starter in [
116
+ *spec["interface"]["starters"],
117
+ *(
118
+ item
119
+ for profile in spec["interface"]["profiles"]
120
+ for item in profile["starters"]
121
+ ),
122
+ ]:
123
+ if not starter.get("category"):
124
+ starter.pop("category", None)
125
+ # A case decided by code names it; the others say nothing of it.
126
+ for case in spec["tests"]["cases"]:
127
+ if not case.get("code"):
128
+ case.pop("code", None)
113
129
  for key in ("description", "instructions", "goal"):
114
130
  spec[key] = _flat(spec.get(key))
115
131
  spec["interface"]["welcome"] = _flat(spec["interface"].get("welcome"))
@@ -216,7 +232,6 @@ def generate_python_code(specs: list[dict[str, Any]], built: dict[str, str]) ->
216
232
  "",
217
233
  "from agent_runtimes.types import AppSpec",
218
234
  "",
219
- "",
220
235
  "# " + "=" * 76,
221
236
  "# Application Definitions",
222
237
  "# " + "=" * 76,