@adecore/agents-react 0.37.3 → 0.39.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 (66) hide show
  1. package/dist/agents/AgentModelLabel.d.ts +10 -0
  2. package/dist/agents/AgentModelLabel.js +97 -0
  3. package/dist/chat/logic/visual-height.d.ts +1 -0
  4. package/dist/chat/logic/visual-height.js +1 -1
  5. package/dist/chat/ui/Composer.js +385 -360
  6. package/dist/chat/ui/HostMenuItems.d.ts +4 -0
  7. package/dist/chat/ui/HostMenuItems.js +15 -0
  8. package/dist/chat/ui/Pickers.d.ts +2 -1
  9. package/dist/chat/ui/Pickers.js +126 -123
  10. package/dist/chat/ui/PromptEditor.d.ts +19 -0
  11. package/dist/chat/ui/PromptEditor.js +115 -0
  12. package/dist/chat/ui/Timeline.d.ts +2 -1
  13. package/dist/chat/ui/Timeline.js +13 -1
  14. package/dist/chat/ui/VisualFrame.d.ts +8 -0
  15. package/dist/chat/ui/VisualFrame.js +217 -115
  16. package/dist/chat/ui/composer/ComposerControls.d.ts +3 -0
  17. package/dist/chat/ui/composer/ComposerControls.js +235 -38
  18. package/dist/chat/ui/composer/key-handler.d.ts +1 -1
  19. package/dist/chat/ui/composer/key-handler.js +3 -11
  20. package/dist/chat/ui/composer/prompt-picks.d.ts +4 -0
  21. package/dist/chat/ui/composer/prompt-picks.js +14 -0
  22. package/dist/chat/ui/composer/use-composer-menus.d.ts +4 -49
  23. package/dist/chat/ui/composer/use-composer-menus.js +65 -519
  24. package/dist/chat/ui/composer/use-prompt-menus.d.ts +73 -0
  25. package/dist/chat/ui/composer/use-prompt-menus.js +536 -0
  26. package/dist/chat/ui/index.d.ts +4 -0
  27. package/dist/chat/ui/index.js +3 -0
  28. package/dist/chat/ui/rows/GeneratedImageRow.js +8 -4
  29. package/dist/chat/ui/rows/VisualRow.js +184 -142
  30. package/dist/chat/ui/rows/row-rhythm.js +6 -4
  31. package/dist/host-hooks.d.ts +2 -1
  32. package/dist/host-hooks.js +6 -0
  33. package/dist/host.d.ts +27 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/locales/en/agent-chat.d.ts +1 -0
  36. package/dist/locales/en/agent-chat.js +1 -0
  37. package/dist/locales/nl/agent-chat.d.ts +1 -0
  38. package/dist/locales/nl/agent-chat.js +1 -0
  39. package/dist/providers/index.d.ts +1 -0
  40. package/dist/providers/index.js +1 -0
  41. package/dist/theme.css +3 -0
  42. package/package.json +8 -8
  43. package/src/agents/AgentModelLabel.tsx +40 -0
  44. package/src/chat/logic/visual-height.ts +1 -1
  45. package/src/chat/ui/Composer.tsx +12 -3
  46. package/src/chat/ui/HostMenuItems.tsx +11 -0
  47. package/src/chat/ui/Pickers.tsx +4 -1
  48. package/src/chat/ui/PromptEditor.tsx +130 -0
  49. package/src/chat/ui/Timeline.tsx +22 -1
  50. package/src/chat/ui/VisualFrame.tsx +68 -21
  51. package/src/chat/ui/composer/ComposerControls.tsx +65 -15
  52. package/src/chat/ui/composer/key-handler.ts +3 -9
  53. package/src/chat/ui/composer/prompt-picks.ts +17 -0
  54. package/src/chat/ui/composer/use-composer-menus.ts +18 -275
  55. package/src/chat/ui/composer/use-prompt-menus.ts +341 -0
  56. package/src/chat/ui/index.ts +4 -0
  57. package/src/chat/ui/rows/GeneratedImageRow.tsx +9 -4
  58. package/src/chat/ui/rows/VisualRow.tsx +5 -1
  59. package/src/chat/ui/rows/row-rhythm.ts +6 -4
  60. package/src/host-hooks.ts +9 -1
  61. package/src/host.ts +45 -1
  62. package/src/index.ts +3 -0
  63. package/src/locales/en/agent-chat.ts +1 -0
  64. package/src/locales/nl/agent-chat.ts +1 -0
  65. package/src/providers/index.ts +1 -0
  66. package/src/theme.css +3 -0
@@ -0,0 +1,10 @@
1
+ import type { AgentKind } from '@adecore/agent-contracts';
2
+ interface AgentModelLabelProps {
3
+ provider: AgentKind;
4
+ model?: string;
5
+ scopeId?: string;
6
+ size?: number;
7
+ className?: string;
8
+ }
9
+ export declare function AgentModelLabel({ provider, model, scopeId, size, className }: AgentModelLabelProps): import("react").JSX.Element;
10
+ export {};
@@ -0,0 +1,97 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { useContext } from 'react';
3
+ import clsx from 'clsx';
4
+ import { ChatScopeContext } from '../scope.js';
5
+ import { useProvidersStore } from '../state/providers.js';
6
+ import { AgentIcon } from './AgentIcon.js';
7
+ import { modelName } from './model-name.js';
8
+ import { ProviderLogo } from './ProviderLogo.js';
9
+ /*
10
+ * Who answered or will answer, in one line: the CLI's mark and the model, named the way the machine's
11
+ * catalog names it, as a row of facts writes it ("made by", "runs as").
12
+ */
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ export function AgentModelLabel(t0) {
15
+ const $ = _c(19);
16
+ const {
17
+ provider,
18
+ model,
19
+ scopeId,
20
+ size: t1,
21
+ className
22
+ } = t0;
23
+ const size = t1 === undefined ? 14 : t1;
24
+ const scope = useContext(ChatScopeContext);
25
+ const id = scopeId ?? scope?.id;
26
+ let t2;
27
+ if ($[0] !== id || $[1] !== provider) {
28
+ t2 = s => id === undefined ? undefined : s.byScope[id]?.providers.find(entry => entry.kind === provider);
29
+ $[0] = id;
30
+ $[1] = provider;
31
+ $[2] = t2;
32
+ } else {
33
+ t2 = $[2];
34
+ }
35
+ const catalog = useProvidersStore(t2);
36
+ let t3;
37
+ if ($[3] !== catalog?.models || $[4] !== catalog?.name || $[5] !== model || $[6] !== provider) {
38
+ t3 = model === undefined ? catalog?.name ?? provider : modelName(model, catalog?.models);
39
+ $[3] = catalog?.models;
40
+ $[4] = catalog?.name;
41
+ $[5] = model;
42
+ $[6] = provider;
43
+ $[7] = t3;
44
+ } else {
45
+ t3 = $[7];
46
+ }
47
+ const name = t3;
48
+ let t4;
49
+ if ($[8] !== className) {
50
+ t4 = clsx("flex min-w-0 items-center gap-1.5", className);
51
+ $[8] = className;
52
+ $[9] = t4;
53
+ } else {
54
+ t4 = $[9];
55
+ }
56
+ let t5;
57
+ if ($[10] !== provider || $[11] !== size) {
58
+ t5 = provider === "claude" || provider === "codex" ? /*#__PURE__*/_jsx(ProviderLogo, {
59
+ provider: provider,
60
+ size: size
61
+ }) : /*#__PURE__*/_jsx(AgentIcon, {
62
+ kind: provider,
63
+ size: size,
64
+ className: "shrink-0"
65
+ });
66
+ $[10] = provider;
67
+ $[11] = size;
68
+ $[12] = t5;
69
+ } else {
70
+ t5 = $[12];
71
+ }
72
+ let t6;
73
+ if ($[13] !== name) {
74
+ t6 = /*#__PURE__*/_jsx("span", {
75
+ className: "truncate",
76
+ children: name
77
+ });
78
+ $[13] = name;
79
+ $[14] = t6;
80
+ } else {
81
+ t6 = $[14];
82
+ }
83
+ let t7;
84
+ if ($[15] !== t4 || $[16] !== t5 || $[17] !== t6) {
85
+ t7 = /*#__PURE__*/_jsxs("span", {
86
+ className: t4,
87
+ children: [t5, t6]
88
+ });
89
+ $[15] = t4;
90
+ $[16] = t5;
91
+ $[17] = t6;
92
+ $[18] = t7;
93
+ } else {
94
+ t7 = $[18];
95
+ }
96
+ return t7;
97
+ }
@@ -1,4 +1,5 @@
1
1
  import { type ChatVisual } from '@adecore/agent-contracts/visual';
2
+ export declare const DEFAULT_HEIGHT_PX = 240;
2
3
  export declare function clampVisualHeight(visual: Pick<ChatVisual, 'maxHeight'>, height: number): number;
3
4
  export declare function visualContentHeight(height: number): number;
4
5
  export declare function initialVisualContentHeight(visual: Pick<ChatVisual, 'id' | 'heights'>, width: number): number;
@@ -1,6 +1,6 @@
1
1
  import { VISUAL_LIMITS, visualFrameHeight } from '@adecore/agent-contracts/visual';
2
2
  /* A frame before anything measured its page: room for a chart, never taller than the page may grow. */
3
- const DEFAULT_HEIGHT_PX = 240;
3
+ export const DEFAULT_HEIGHT_PX = 240;
4
4
  /* Plenty for the visuals of a long session; the oldest goes first. */
5
5
  const REMEMBERED_HEIGHTS = 500;
6
6
  // Stay within browser layout coordinates even if a page reports a bogus finite size.