@datalayer/agent-runtimes 1.3.83 → 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 (49) 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 +9 -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 +190 -11
  18. package/lib/loop/apps/checks.d.ts +6 -0
  19. package/lib/loop/apps/checks.js +170 -1
  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.js +2 -0
  40. package/lib/loop/plugins/chat/ChatView.js +10 -2
  41. package/lib/protocols/BrowserAgentAdapter.d.ts +8 -6
  42. package/lib/protocols/BrowserAgentAdapter.js +13 -10
  43. package/lib/runtimes/browser/protocol.d.ts +1 -1
  44. package/lib/specs/apps.js +149 -0
  45. package/lib/specs/appspecSchema.js +439 -2
  46. package/lib/specs/uiPlugins.js +6 -1
  47. package/lib/types/agentspecs.d.ts +130 -1
  48. package/package.json +1 -1
  49. package/scripts/codegen/generate_apps.py +16 -0
@@ -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 {
@@ -537,6 +590,25 @@ export interface AppVoiceSpec {
537
590
  language: string;
538
591
  where: 'auto' | 'device' | 'server';
539
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
+ }
540
612
  /** What the user of an application sees. */
541
613
  export interface AppInterfaceSpec {
542
614
  layout: AppLayout;
@@ -550,11 +622,33 @@ export interface AppInterfaceSpec {
550
622
  commands: AppCommandSpec[];
551
623
  /** Mode switches in the composer, the option picked going with every run (P-19). */
552
624
  modes: AppModeSpec[];
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[];
553
630
  /**
554
631
  * What a person may set: the JSON Schema of a form (C-16), drawn beside the
555
632
  * conversation and on a deployment's Ship card; none when unsaid.
556
633
  */
557
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;
558
652
  /** The components of the catalog the surface may use. */
559
653
  components: string[];
560
654
  surface?: AppSurfaceSpec;
@@ -581,6 +675,12 @@ export interface AppInterfaceSpec {
581
675
  export interface AppTestCaseSpec {
582
676
  ask: string;
583
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;
584
684
  }
585
685
  /**
586
686
  * What was verified, and how, each in a sentence a person reads (LOOP E-14):
@@ -612,11 +712,38 @@ export interface AppRecordSpec {
612
712
  */
613
713
  suggestTests: boolean;
614
714
  }
615
- /** 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. */
616
727
  export interface AppChecksSpec {
617
728
  guards: string[];
618
729
  gates: string[];
619
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[];
620
747
  }
621
748
  /** A function of the host page the application's agent may call (LOOP D-10). */
622
749
  export interface AppHostFunctionSpec {
@@ -711,6 +838,8 @@ export interface AppSpec {
711
838
  skills: string[];
712
839
  /** Backend tools (agentspecs/backend-tools) it adds to its agent's. */
713
840
  backendTools: string[];
841
+ /** Tools of its own, written in its code (LOOP P-06); absent when it has none. */
842
+ tools?: AppToolSpec[];
714
843
  /** The Frames it works under. */
715
844
  context: string[];
716
845
  /** The documents and datasets it answers from. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/agent-runtimes",
3
- "version": "1.3.83",
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"))