@adecore/agents-react 0.38.0 → 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 (51) hide show
  1. package/dist/agents/AgentModelLabel.d.ts +10 -0
  2. package/dist/agents/AgentModelLabel.js +97 -0
  3. package/dist/chat/ui/Composer.js +385 -360
  4. package/dist/chat/ui/Pickers.d.ts +2 -1
  5. package/dist/chat/ui/Pickers.js +126 -123
  6. package/dist/chat/ui/PromptEditor.d.ts +19 -0
  7. package/dist/chat/ui/PromptEditor.js +115 -0
  8. package/dist/chat/ui/Timeline.d.ts +2 -1
  9. package/dist/chat/ui/Timeline.js +13 -1
  10. package/dist/chat/ui/composer/ComposerControls.d.ts +3 -0
  11. package/dist/chat/ui/composer/ComposerControls.js +235 -38
  12. package/dist/chat/ui/composer/key-handler.d.ts +1 -1
  13. package/dist/chat/ui/composer/key-handler.js +3 -11
  14. package/dist/chat/ui/composer/prompt-picks.d.ts +4 -0
  15. package/dist/chat/ui/composer/prompt-picks.js +14 -0
  16. package/dist/chat/ui/composer/use-composer-menus.d.ts +4 -49
  17. package/dist/chat/ui/composer/use-composer-menus.js +65 -519
  18. package/dist/chat/ui/composer/use-prompt-menus.d.ts +73 -0
  19. package/dist/chat/ui/composer/use-prompt-menus.js +536 -0
  20. package/dist/chat/ui/index.d.ts +3 -0
  21. package/dist/chat/ui/index.js +2 -0
  22. package/dist/host-hooks.d.ts +2 -1
  23. package/dist/host-hooks.js +6 -0
  24. package/dist/host.d.ts +17 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/locales/en/agent-chat.d.ts +1 -0
  27. package/dist/locales/en/agent-chat.js +1 -0
  28. package/dist/locales/nl/agent-chat.d.ts +1 -0
  29. package/dist/locales/nl/agent-chat.js +1 -0
  30. package/dist/providers/index.d.ts +1 -0
  31. package/dist/providers/index.js +1 -0
  32. package/dist/theme.css +3 -0
  33. package/package.json +8 -8
  34. package/src/agents/AgentModelLabel.tsx +40 -0
  35. package/src/chat/ui/Composer.tsx +12 -3
  36. package/src/chat/ui/Pickers.tsx +4 -1
  37. package/src/chat/ui/PromptEditor.tsx +130 -0
  38. package/src/chat/ui/Timeline.tsx +22 -1
  39. package/src/chat/ui/composer/ComposerControls.tsx +65 -15
  40. package/src/chat/ui/composer/key-handler.ts +3 -9
  41. package/src/chat/ui/composer/prompt-picks.ts +17 -0
  42. package/src/chat/ui/composer/use-composer-menus.ts +18 -275
  43. package/src/chat/ui/composer/use-prompt-menus.ts +341 -0
  44. package/src/chat/ui/index.ts +3 -0
  45. package/src/host-hooks.ts +9 -1
  46. package/src/host.ts +27 -1
  47. package/src/index.ts +2 -0
  48. package/src/locales/en/agent-chat.ts +1 -0
  49. package/src/locales/nl/agent-chat.ts +1 -0
  50. package/src/providers/index.ts +1 -0
  51. 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
+ }