@adecore/agents-react 0.46.0 → 0.46.2

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.
@@ -89,6 +89,29 @@ function languageOf(className) {
89
89
  return /language-([\w-]+)/.exec(className ?? '')?.[1] ?? 'text';
90
90
  }
91
91
  const INLINE_CODE = 'rounded-sm bg-surface-sunken px-1 py-px font-mono text-code box-decoration-clone';
92
+ /* A double-click selects a word, which ends at a hyphen or a dot, so a flag or a command would be copied in parts. */
93
+ function selectWholeCode(event) {
94
+ window.getSelection()?.selectAllChildren(event.currentTarget);
95
+ }
96
+ function PlainCode(t0) {
97
+ const $ = _c(2);
98
+ const {
99
+ text
100
+ } = t0;
101
+ let t1;
102
+ if ($[0] !== text) {
103
+ t1 = /*#__PURE__*/_jsx("code", {
104
+ className: INLINE_CODE,
105
+ onDoubleClick: selectWholeCode,
106
+ children: text
107
+ });
108
+ $[0] = text;
109
+ $[1] = t1;
110
+ } else {
111
+ t1 = $[1];
112
+ }
113
+ return t1;
114
+ }
92
115
  /*
93
116
  * A path an agent wrote down. It keeps the shape of the code chip it would otherwise be, so a sentence
94
117
  * full of them does not shift; `data-file-path` is what the thread's right-click menu reads.
@@ -165,9 +188,8 @@ function InlineCode(t0) {
165
188
  if (target === null) {
166
189
  let t1;
167
190
  if ($[0] !== text) {
168
- t1 = /*#__PURE__*/_jsx("code", {
169
- className: INLINE_CODE,
170
- children: text
191
+ t1 = /*#__PURE__*/_jsx(PlainCode, {
192
+ text: text
171
193
  });
172
194
  $[0] = text;
173
195
  $[1] = t1;
@@ -486,9 +508,8 @@ function MarkdownCode(t0) {
486
508
  }
487
509
  let t2;
488
510
  if ($[8] !== plain || $[9] !== text) {
489
- t2 = plain ? /*#__PURE__*/_jsx("code", {
490
- className: INLINE_CODE,
491
- children: text
511
+ t2 = plain ? /*#__PURE__*/_jsx(PlainCode, {
512
+ text: text
492
513
  }) : /*#__PURE__*/_jsx(InlineCode, {
493
514
  text: text
494
515
  });
@@ -9,26 +9,30 @@ const MINUTE = 60_000;
9
9
  /*
10
10
  * The plan numbers per CLI, one row per account. The machine only reads an account that is signed in,
11
11
  * so an account that is on but signed out comes from the account list, where it can say why it has
12
- * no numbers. An account that is off is left out, unless the machine still reads it (a CLI's default).
13
- * A CLI the machine reads no plan of at all has no group, whatever accounts it has.
12
+ * no numbers. An account that is off is left out, also when an older machine still reads it.
13
+ * A CLI the machine reads no plan of, or that is not installed there, has no group, whatever accounts it has.
14
14
  */
15
15
  export function limitGroups(snapshot, accounts) {
16
16
  return USAGE_PROVIDERS.flatMap(kind => {
17
- if (!snapshot.providers.some(entry => entry.kind === kind)) {
17
+ const entries = snapshot.providers.filter(entry => entry.kind === kind && entry.unavailable?.reason !== 'not-installed');
18
+ if (entries.length === 0) {
18
19
  return [];
19
20
  }
20
21
  const known = accountsOfKind(accounts, kind);
21
- const read = snapshot.providers.filter(entry => entry.kind === kind).map(entry => {
22
+ const read = entries.flatMap(entry => {
22
23
  const id = limitsAccountId(entry);
23
24
  const account = known.find(each => each.id === id);
24
- return {
25
+ if (account?.account.enabled === false) {
26
+ return [];
27
+ }
28
+ return [{
25
29
  id,
26
30
  kind,
27
31
  name: account === undefined ? entry.account?.label ?? PROVIDER_LABELS[kind] : accountName(account, PROVIDER_LABELS[kind]),
28
32
  color: account === undefined ? entry.account?.color : account.account.color,
29
33
  entry,
30
34
  status: account?.status ?? null
31
- };
35
+ }];
32
36
  });
33
37
  const unread = known.filter(account => account.account.enabled !== false && !read.some(row => row.id === account.id)).map(account => ({
34
38
  id: account.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.46.0",
3
+ "version": "0.46.2",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,11 +72,11 @@
72
72
  "test:visuals": "bun --config=integration.bunfig.toml --conditions=source test ./src/chat/visual-viewport.integration.test.ts"
73
73
  },
74
74
  "dependencies": {
75
- "@adecore/agent-contracts": "0.46.0",
76
- "@adecore/editor": "0.46.0",
77
- "@adecore/editor-react": "0.46.0",
78
- "@adecore/intelligent-ui": "0.46.0",
79
- "@adecore/merge": "0.46.0",
75
+ "@adecore/agent-contracts": "0.46.2",
76
+ "@adecore/editor": "0.46.2",
77
+ "@adecore/editor-react": "0.46.2",
78
+ "@adecore/intelligent-ui": "0.46.2",
79
+ "@adecore/merge": "0.46.2",
80
80
  "@codemirror/commands": "^6.11.1",
81
81
  "@codemirror/language": "^6.13.1",
82
82
  "@codemirror/state": "^6.7.6",
@@ -100,14 +100,14 @@
100
100
  "zustand": "^5.0.16"
101
101
  },
102
102
  "peerDependencies": {
103
- "@adecore/ui": "^0.46.0",
103
+ "@adecore/ui": "^0.46.2",
104
104
  "i18next": "^26.4.2",
105
105
  "react": "^19.3.0",
106
106
  "react-dom": "^19.3.0",
107
107
  "react-i18next": "^17.0.15"
108
108
  },
109
109
  "devDependencies": {
110
- "@adecore/ui": "0.46.0",
110
+ "@adecore/ui": "0.46.2",
111
111
  "@types/bun": "^1.4.4",
112
112
  "@types/react": "^19.3.0",
113
113
  "@types/react-dom": "^19.3.0",
@@ -1,4 +1,4 @@
1
- import { createContext, memo, useContext, type ComponentProps, type ReactNode } from 'react';
1
+ import { createContext, memo, useContext, type ComponentProps, type MouseEvent, type ReactNode } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import { Zap } from 'lucide-react';
4
4
  import ReactMarkdown, { type Components, type ExtraProps, type Options } from 'react-markdown';
@@ -101,6 +101,19 @@ function languageOf(className: string | undefined): string {
101
101
 
102
102
  const INLINE_CODE = 'rounded-sm bg-surface-sunken px-1 py-px font-mono text-code box-decoration-clone';
103
103
 
104
+ /* A double-click selects a word, which ends at a hyphen or a dot, so a flag or a command would be copied in parts. */
105
+ function selectWholeCode(event: MouseEvent<HTMLElement>): void {
106
+ window.getSelection()?.selectAllChildren(event.currentTarget);
107
+ }
108
+
109
+ function PlainCode({ text }: { text: string }) {
110
+ return (
111
+ <code className={INLINE_CODE} onDoubleClick={selectWholeCode}>
112
+ {text}
113
+ </code>
114
+ );
115
+ }
116
+
104
117
  /*
105
118
  * A path an agent wrote down. It keeps the shape of the code chip it would otherwise be, so a sentence
106
119
  * full of them does not shift; `data-file-path` is what the thread's right-click menu reads.
@@ -134,7 +147,7 @@ function InlineCode({ text }: { text: string }) {
134
147
  const target = useFileLinkTarget(text);
135
148
 
136
149
  if (target === null) {
137
- return <code className={INLINE_CODE}>{text}</code>;
150
+ return <PlainCode text={text} />;
138
151
  }
139
152
 
140
153
  return (
@@ -244,7 +257,7 @@ function MarkdownCode({ className, children, plain = false }: { className?: stri
244
257
  return lang === 'mermaid' ? <Diagram code={code} /> : <CodeBlock code={code} lang={lang} />;
245
258
  }
246
259
 
247
- return plain ? <code className={INLINE_CODE}>{text}</code> : <InlineCode text={text} />;
260
+ return plain ? <PlainCode text={text} /> : <InlineCode text={text} />;
248
261
  }
249
262
 
250
263
  const components = {
@@ -38,32 +38,38 @@ export interface LimitGroup {
38
38
  /*
39
39
  * The plan numbers per CLI, one row per account. The machine only reads an account that is signed in,
40
40
  * so an account that is on but signed out comes from the account list, where it can say why it has
41
- * no numbers. An account that is off is left out, unless the machine still reads it (a CLI's default).
42
- * A CLI the machine reads no plan of at all has no group, whatever accounts it has.
41
+ * no numbers. An account that is off is left out, also when an older machine still reads it.
42
+ * A CLI the machine reads no plan of, or that is not installed there, has no group, whatever accounts it has.
43
43
  */
44
44
  export function limitGroups(snapshot: UsageLimitsSnapshot, accounts: ProviderAccounts | null): LimitGroup[] {
45
45
  return USAGE_PROVIDERS.flatMap((kind) => {
46
- if (!snapshot.providers.some((entry) => entry.kind === kind)) {
46
+ const entries = snapshot.providers.filter((entry) => entry.kind === kind && entry.unavailable?.reason !== 'not-installed');
47
+
48
+ if (entries.length === 0) {
47
49
  return [];
48
50
  }
49
51
 
50
52
  const known = accountsOfKind(accounts, kind);
51
53
 
52
- const read = snapshot.providers
53
- .filter((entry) => entry.kind === kind)
54
- .map((entry): LimitAccount => {
55
- const id = limitsAccountId(entry);
56
- const account = known.find((each) => each.id === id);
54
+ const read = entries.flatMap((entry): LimitAccount[] => {
55
+ const id = limitsAccountId(entry);
56
+ const account = known.find((each) => each.id === id);
57
+
58
+ if (account?.account.enabled === false) {
59
+ return [];
60
+ }
57
61
 
58
- return {
62
+ return [
63
+ {
59
64
  id,
60
65
  kind,
61
66
  name: account === undefined ? (entry.account?.label ?? PROVIDER_LABELS[kind]) : accountName(account, PROVIDER_LABELS[kind]),
62
67
  color: account === undefined ? entry.account?.color : account.account.color,
63
68
  entry,
64
69
  status: account?.status ?? null
65
- };
66
- });
70
+ }
71
+ ];
72
+ });
67
73
 
68
74
  const unread = known
69
75
  .filter((account) => account.account.enabled !== false && !read.some((row) => row.id === account.id))