@adecore/agents-react 0.54.3 → 0.54.5

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.
@@ -12,6 +12,7 @@ import { ReferenceTrail } from './ReferenceTrail.js';
12
12
  /*
13
13
  * One token in the transcript. One that opens is a span with a button's role rather than a button,
14
14
  * since a button is a box with a baseline of its own and would not sit on the line the others sit on.
15
+ * It stays out of prose, whose margins on an image would lift a host's picture mark off the line.
15
16
  */
16
17
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
18
  export function TokenChip(t0) {
@@ -71,7 +72,7 @@ export function TokenChip(t0) {
71
72
  const t2 = onOpen !== undefined && "cursor-pointer focus-visible:outline-2 focus-visible:outline-accent";
72
73
  let t3;
73
74
  if ($[11] !== className || $[12] !== t2 || $[13] !== tone) {
74
- t3 = clsx(TOKEN_IN_MESSAGE, tone, t2, className);
75
+ t3 = clsx("not-prose", TOKEN_IN_MESSAGE, tone, t2, className);
75
76
  $[11] = className;
76
77
  $[12] = t2;
77
78
  $[13] = tone;
package/dist/host.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { isApplePlatform } from '@adecore/ui';
3
- import { createContext, createElement, useContext, useState } from 'react';
2
+ import { isApplePlatform, syncAnimations } from '@adecore/ui';
3
+ import { createContext, createElement, useContext, useLayoutEffect, useState } from 'react';
4
4
  import { PlainTextarea } from './ui/PlainTextarea.js';
5
5
  const NO_PROMPTS = [];
6
6
  const NO_CHATS = [];
@@ -98,7 +98,7 @@ const ChatHostContext = createContext(DEFAULT_HOST);
98
98
  * break the order of its hooks: a provider that gets another `host` throws, and a new `key` remounts it.
99
99
  */
100
100
  export function ChatHostProvider(t0) {
101
- const $ = _c(6);
101
+ const $ = _c(7);
102
102
  const {
103
103
  host,
104
104
  children
@@ -124,19 +124,30 @@ export function ChatHostProvider(t0) {
124
124
  throw new Error("A ChatHostProvider reads its host once: hand it the same object on every render, or a new key to mount it with another");
125
125
  }
126
126
  let t2;
127
- if ($[3] !== children || $[4] !== pinned.value) {
128
- t2 = createElement(ChatHostContext.Provider, {
127
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
128
+ t2 = [];
129
+ $[3] = t2;
130
+ } else {
131
+ t2 = $[3];
132
+ }
133
+ useLayoutEffect(_temp, t2);
134
+ let t3;
135
+ if ($[4] !== children || $[5] !== pinned.value) {
136
+ t3 = createElement(ChatHostContext.Provider, {
129
137
  value: pinned.value
130
138
  }, children);
131
- $[3] = children;
132
- $[4] = pinned.value;
133
- $[5] = t2;
139
+ $[4] = children;
140
+ $[5] = pinned.value;
141
+ $[6] = t3;
134
142
  } else {
135
- t2 = $[5];
143
+ t3 = $[6];
136
144
  }
137
- return t2;
145
+ return t3;
138
146
  }
139
147
  /* The host of the nearest `ChatHostProvider`, or the defaults outside one. */
148
+ function _temp() {
149
+ return syncAnimations(["chat-shine"]);
150
+ }
140
151
  export function useChatHost() {
141
152
  return useContext(ChatHostContext);
142
153
  }
package/dist/theme.css CHANGED
@@ -125,7 +125,7 @@
125
125
 
126
126
  /* Live tool rows shine once across; a paused animation costs nothing. A background position is
127
127
  painted on the main thread, so a smooth shine repaints the row every frame; 30 steps keep it
128
- moving at a fraction of the paints. */
128
+ moving at a fraction of the paints. Every row steps on the spinners' clock (`ChatHostProvider`). */
129
129
  .chat-live-text {
130
130
  background: linear-gradient(90deg, var(--text-muted) 0%, var(--text) 50%, var(--text-muted) 100%);
131
131
  background-size: 200% 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agents-react",
3
- "version": "0.54.3",
3
+ "version": "0.54.5",
4
4
  "description": "React agent chat threads, composers, approvals, provider accounts and usage views.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -72,12 +72,12 @@
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.54.3",
76
- "@adecore/editor": "0.54.3",
77
- "@adecore/editor-react": "0.54.3",
78
- "@adecore/intelligent-ui": "0.54.3",
79
- "@adecore/merge": "0.54.3",
80
- "@adecore/utils": "0.54.3",
75
+ "@adecore/agent-contracts": "0.54.5",
76
+ "@adecore/editor": "0.54.5",
77
+ "@adecore/editor-react": "0.54.5",
78
+ "@adecore/intelligent-ui": "0.54.5",
79
+ "@adecore/merge": "0.54.5",
80
+ "@adecore/utils": "0.54.5",
81
81
  "@codemirror/commands": "^6.11.1",
82
82
  "@codemirror/language": "^6.13.1",
83
83
  "@codemirror/state": "^6.7.6",
@@ -101,14 +101,14 @@
101
101
  "zustand": "^5.0.16"
102
102
  },
103
103
  "peerDependencies": {
104
- "@adecore/ui": "^0.54.3",
104
+ "@adecore/ui": "^0.54.5",
105
105
  "i18next": "^26.4.2",
106
106
  "react": "^19.3.0",
107
107
  "react-dom": "^19.3.0",
108
108
  "react-i18next": "^17.0.15"
109
109
  },
110
110
  "devDependencies": {
111
- "@adecore/ui": "0.54.3",
111
+ "@adecore/ui": "0.54.5",
112
112
  "@types/bun": "^1.4.4",
113
113
  "@types/react": "^19.3.0",
114
114
  "@types/react-dom": "^19.3.0",
@@ -25,6 +25,7 @@ interface TokenChipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children
25
25
  /*
26
26
  * One token in the transcript. One that opens is a span with a button's role rather than a button,
27
27
  * since a button is a box with a baseline of its own and would not sit on the line the others sit on.
28
+ * It stays out of prose, whose margins on an image would lift a host's picture mark off the line.
28
29
  */
29
30
  export function TokenChip({ kind, value, sigil, icon, label, tone, onOpen, className, ...rest }: TokenChipProps) {
30
31
  const onKeyDown = (e: KeyboardEvent<HTMLSpanElement>): void => {
@@ -37,7 +38,13 @@ export function TokenChip({ kind, value, sigil, icon, label, tone, onOpen, class
37
38
  return (
38
39
  <span
39
40
  {...rest}
40
- className={clsx(TOKEN_IN_MESSAGE, tone, onOpen !== undefined && 'cursor-pointer focus-visible:outline-2 focus-visible:outline-accent', className)}
41
+ className={clsx(
42
+ 'not-prose',
43
+ TOKEN_IN_MESSAGE,
44
+ tone,
45
+ onOpen !== undefined && 'cursor-pointer focus-visible:outline-2 focus-visible:outline-accent',
46
+ className
47
+ )}
41
48
  data-chip={kind}
42
49
  data-chip-value={value}
43
50
  data-chip-name={kind === 'reference' ? label : undefined}
package/src/host.ts CHANGED
@@ -17,11 +17,21 @@ import type {
17
17
  RuntimeMode
18
18
  } from '@adecore/agent-contracts';
19
19
  import type { EditorEngine } from '@adecore/editor';
20
- import { isApplePlatform } from '@adecore/ui';
20
+ import { isApplePlatform, syncAnimations } from '@adecore/ui';
21
21
  import type { Extension } from '@codemirror/state';
22
22
  import type { EditorView } from '@codemirror/view';
23
23
  import type { LucideIcon } from 'lucide-react';
24
- import { createContext, createElement, useContext, useState, type ComponentProps, type ComponentType, type ReactNode, type RefObject } from 'react';
24
+ import {
25
+ createContext,
26
+ createElement,
27
+ useContext,
28
+ useLayoutEffect,
29
+ useState,
30
+ type ComponentProps,
31
+ type ComponentType,
32
+ type ReactNode,
33
+ type RefObject
34
+ } from 'react';
25
35
  import type { Highlighter, ThemeRegistration } from 'shiki';
26
36
  import type { AccountRule } from './agents/accounts';
27
37
  import type { ReferableKind, Referables } from './chat/chat-references';
@@ -694,6 +704,9 @@ export function ChatHostProvider({ host, children }: { host: Partial<ChatHost>;
694
704
  throw new Error('A ChatHostProvider reads its host once: hand it the same object on every render, or a new key to mount it with another');
695
705
  }
696
706
 
707
+ // Every shining live row steps on the spinners' clock, so the paints of several rows fall in one frame.
708
+ useLayoutEffect(() => syncAnimations(['chat-shine']), []);
709
+
697
710
  return createElement(ChatHostContext.Provider, { value: pinned.value }, children);
698
711
  }
699
712
 
package/src/theme.css CHANGED
@@ -125,7 +125,7 @@
125
125
 
126
126
  /* Live tool rows shine once across; a paused animation costs nothing. A background position is
127
127
  painted on the main thread, so a smooth shine repaints the row every frame; 30 steps keep it
128
- moving at a fraction of the paints. */
128
+ moving at a fraction of the paints. Every row steps on the spinners' clock (`ChatHostProvider`). */
129
129
  .chat-live-text {
130
130
  background: linear-gradient(90deg, var(--text-muted) 0%, var(--text) 50%, var(--text-muted) 100%);
131
131
  background-size: 200% 100%;