@adecore/agents-react 0.41.1 → 0.43.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.
- package/dist/chat/actions.js +4 -0
- package/dist/chat/logic/lightbox.d.ts +31 -0
- package/dist/chat/logic/lightbox.js +61 -0
- package/dist/chat/logic/timeline.d.ts +1 -0
- package/dist/chat/logic/timeline.js +3 -0
- package/dist/chat/ui/AnsiOutput.d.ts +3 -2
- package/dist/chat/ui/AnsiOutput.js +26 -22
- package/dist/chat/ui/ImageView.d.ts +3 -0
- package/dist/chat/ui/ImageView.js +761 -437
- package/dist/chat/ui/intelligent-ui/renderers/content.js +4 -2
- package/dist/chat/ui/rows/MessageRows.js +10 -8
- package/dist/chat/ui/rows/Rows.js +42 -39
- package/dist/chat/ui/rows/WorkRows.d.ts +4 -2
- package/dist/chat/ui/rows/WorkRows.js +580 -211
- package/dist/chat/ui/rows/WorkflowRow.js +43 -41
- package/dist/host.d.ts +1 -0
- package/dist/locales/en/agent-chat.d.ts +9 -0
- package/dist/locales/en/agent-chat.js +11 -2
- package/dist/locales/nl/agent-chat.d.ts +9 -0
- package/dist/locales/nl/agent-chat.js +11 -2
- package/package.json +8 -8
- package/src/chat/actions.ts +1 -0
- package/src/chat/logic/lightbox.ts +88 -0
- package/src/chat/logic/timeline.ts +13 -2
- package/src/chat/ui/AnsiOutput.tsx +13 -2
- package/src/chat/ui/ImageView.tsx +255 -63
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +4 -2
- package/src/chat/ui/rows/MessageRows.tsx +10 -8
- package/src/chat/ui/rows/Rows.tsx +9 -1
- package/src/chat/ui/rows/WorkRows.tsx +127 -27
- package/src/chat/ui/rows/WorkflowRow.tsx +1 -1
- package/src/host.ts +2 -0
- package/src/locales/en/agent-chat.ts +11 -2
- package/src/locales/nl/agent-chat.ts +11 -2
package/dist/chat/actions.js
CHANGED
|
@@ -61,6 +61,10 @@ export function transportActions(transport) {
|
|
|
61
61
|
chatId,
|
|
62
62
|
turnId
|
|
63
63
|
})).diff,
|
|
64
|
+
toolOutput: async (chatId, itemId) => (await transport.request('chat.toolOutput', {
|
|
65
|
+
chatId,
|
|
66
|
+
itemId
|
|
67
|
+
})).output,
|
|
64
68
|
stopSubagent: async (chatId, toolUseId) => {
|
|
65
69
|
await transport.request('chat.stopSubagent', {
|
|
66
70
|
chatId,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const MIN_SCALE = 1;
|
|
2
|
+
export declare const MAX_SCALE = 8;
|
|
3
|
+
export declare const BUTTON_STEP = 1.5;
|
|
4
|
+
export interface View {
|
|
5
|
+
readonly scale: number;
|
|
6
|
+
readonly x: number;
|
|
7
|
+
readonly y: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const START: View;
|
|
10
|
+
export interface Size {
|
|
11
|
+
readonly width: number;
|
|
12
|
+
readonly height: number;
|
|
13
|
+
}
|
|
14
|
+
export interface Bounds {
|
|
15
|
+
readonly image: Size;
|
|
16
|
+
readonly frame: Size;
|
|
17
|
+
}
|
|
18
|
+
export interface Point {
|
|
19
|
+
readonly x: number;
|
|
20
|
+
readonly y: number;
|
|
21
|
+
}
|
|
22
|
+
export interface Wheel {
|
|
23
|
+
readonly deltaX: number;
|
|
24
|
+
readonly deltaY: number;
|
|
25
|
+
readonly ctrlKey: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function clamped(view: View, bounds: Bounds): View;
|
|
28
|
+
export declare function zoomed(view: View, factor: number, point: Point, bounds: Bounds): View;
|
|
29
|
+
export declare function panned(view: View, deltaX: number, deltaY: number, bounds: Bounds): View;
|
|
30
|
+
export declare function wheeled(view: View, wheel: Wheel, point: Point, bounds: Bounds): View;
|
|
31
|
+
export declare function stepped(index: number, count: number, step: -1 | 1): number | null;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const MIN_SCALE = 1;
|
|
2
|
+
export const MAX_SCALE = 8;
|
|
3
|
+
export const BUTTON_STEP = 1.5;
|
|
4
|
+
// A trackpad pinch arrives as small ctrl-wheel deltas; a mouse notch with Ctrl is clamped so it does not jump past the detail.
|
|
5
|
+
const PINCH_SPEED = 0.01;
|
|
6
|
+
const PINCH_LIMIT = 50;
|
|
7
|
+
export const START = {
|
|
8
|
+
scale: 1,
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0
|
|
11
|
+
};
|
|
12
|
+
/* Keeps an edge of the picture from leaving its side of the stage, so a flick of two fingers never loses it. */
|
|
13
|
+
export function clamped(view, bounds) {
|
|
14
|
+
const maxX = Math.max(0, (bounds.image.width * view.scale - bounds.frame.width) / 2);
|
|
15
|
+
const maxY = Math.max(0, (bounds.image.height * view.scale - bounds.frame.height) / 2);
|
|
16
|
+
return {
|
|
17
|
+
scale: view.scale,
|
|
18
|
+
x: Math.min(maxX, Math.max(-maxX, view.x)),
|
|
19
|
+
y: Math.min(maxY, Math.max(-maxY, view.y))
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/*
|
|
23
|
+
* Zooms around a point, which is what makes a pinch over a detail feel like a magnifier instead of
|
|
24
|
+
* a slider. The pixel under the fingers stays where it is while everything else moves away from it.
|
|
25
|
+
* `x` and `y` are offsets from the middle of the stage, so a scale of 1 is always centered.
|
|
26
|
+
*/
|
|
27
|
+
export function zoomed(view, factor, point, bounds) {
|
|
28
|
+
const scale = Math.min(MAX_SCALE, Math.max(MIN_SCALE, view.scale * factor));
|
|
29
|
+
if (scale === MIN_SCALE) {
|
|
30
|
+
return START;
|
|
31
|
+
}
|
|
32
|
+
const ratio = scale / view.scale;
|
|
33
|
+
return clamped({
|
|
34
|
+
scale,
|
|
35
|
+
x: point.x - (point.x - view.x) * ratio,
|
|
36
|
+
y: point.y - (point.y - view.y) * ratio
|
|
37
|
+
}, bounds);
|
|
38
|
+
}
|
|
39
|
+
export function panned(view, deltaX, deltaY, bounds) {
|
|
40
|
+
if (view.scale <= MIN_SCALE) {
|
|
41
|
+
return view;
|
|
42
|
+
}
|
|
43
|
+
return clamped({
|
|
44
|
+
scale: view.scale,
|
|
45
|
+
x: view.x + deltaX,
|
|
46
|
+
y: view.y + deltaY
|
|
47
|
+
}, bounds);
|
|
48
|
+
}
|
|
49
|
+
/* A pinch zooms (Chromium reports it as a wheel with Ctrl held) and two fingers pan the zoomed picture. */
|
|
50
|
+
export function wheeled(view, wheel, point, bounds) {
|
|
51
|
+
if (wheel.ctrlKey) {
|
|
52
|
+
const delta = Math.min(PINCH_LIMIT, Math.max(-PINCH_LIMIT, wheel.deltaY));
|
|
53
|
+
return zoomed(view, Math.exp(-delta * PINCH_SPEED), point, bounds);
|
|
54
|
+
}
|
|
55
|
+
return panned(view, -wheel.deltaX, -wheel.deltaY, bounds);
|
|
56
|
+
}
|
|
57
|
+
/* The image a step away, or null at either end: the row does not wrap around. */
|
|
58
|
+
export function stepped(index, count, step) {
|
|
59
|
+
const next = index + step;
|
|
60
|
+
return next < 0 || next >= count ? null : next;
|
|
61
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export declare function AnsiOutput({ text, limit, tailLines }: {
|
|
1
|
+
export declare function AnsiOutput({ text, limit, tailLines, marksOmitted }: {
|
|
2
2
|
text: string;
|
|
3
|
-
limit?: number;
|
|
3
|
+
limit?: number | undefined;
|
|
4
4
|
tailLines?: number;
|
|
5
|
+
marksOmitted?: boolean;
|
|
5
6
|
}): import("react").JSX.Element;
|
|
@@ -1,61 +1,65 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { parseAnsi } from '../logic/ansi.js';
|
|
4
|
+
/* `marksOmitted` off leaves out the count of what the limit cut, for a text that is itself only a beginning. */
|
|
4
5
|
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
5
6
|
export function AnsiOutput(t0) {
|
|
6
|
-
const $ = _c(
|
|
7
|
+
const $ = _c(12);
|
|
7
8
|
const {
|
|
8
9
|
text,
|
|
9
10
|
limit,
|
|
10
|
-
tailLines
|
|
11
|
+
tailLines,
|
|
12
|
+
marksOmitted: t1
|
|
11
13
|
} = t0;
|
|
14
|
+
const marksOmitted = t1 === undefined ? true : t1;
|
|
12
15
|
const {
|
|
13
16
|
t
|
|
14
17
|
} = useTranslation("agent-chat");
|
|
15
18
|
let omitted;
|
|
16
|
-
let
|
|
19
|
+
let t2;
|
|
17
20
|
if ($[0] !== limit || $[1] !== tailLines || $[2] !== text) {
|
|
18
21
|
const {
|
|
19
22
|
tokens,
|
|
20
|
-
omitted:
|
|
23
|
+
omitted: t3
|
|
21
24
|
} = parseAnsi(text, {
|
|
22
25
|
limit,
|
|
23
26
|
tailLines
|
|
24
27
|
});
|
|
25
|
-
omitted =
|
|
26
|
-
|
|
28
|
+
omitted = t3;
|
|
29
|
+
t2 = tokens.map(_temp);
|
|
27
30
|
$[0] = limit;
|
|
28
31
|
$[1] = tailLines;
|
|
29
32
|
$[2] = text;
|
|
30
33
|
$[3] = omitted;
|
|
31
|
-
$[4] =
|
|
34
|
+
$[4] = t2;
|
|
32
35
|
} else {
|
|
33
36
|
omitted = $[3];
|
|
34
|
-
|
|
37
|
+
t2 = $[4];
|
|
35
38
|
}
|
|
36
|
-
let
|
|
37
|
-
if ($[5] !==
|
|
38
|
-
|
|
39
|
+
let t3;
|
|
40
|
+
if ($[5] !== marksOmitted || $[6] !== omitted || $[7] !== t) {
|
|
41
|
+
t3 = marksOmitted && omitted > 0 && `\n${t("work.moreCharacters", {
|
|
39
42
|
count: omitted
|
|
40
43
|
})}`;
|
|
41
|
-
$[5] =
|
|
42
|
-
$[6] =
|
|
43
|
-
$[7] =
|
|
44
|
+
$[5] = marksOmitted;
|
|
45
|
+
$[6] = omitted;
|
|
46
|
+
$[7] = t;
|
|
47
|
+
$[8] = t3;
|
|
44
48
|
} else {
|
|
45
|
-
|
|
49
|
+
t3 = $[8];
|
|
46
50
|
}
|
|
47
|
-
let
|
|
48
|
-
if ($[
|
|
49
|
-
|
|
50
|
-
children: [
|
|
51
|
+
let t4;
|
|
52
|
+
if ($[9] !== t2 || $[10] !== t3) {
|
|
53
|
+
t4 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
54
|
+
children: [t2, t3]
|
|
51
55
|
});
|
|
52
|
-
$[8] = t1;
|
|
53
56
|
$[9] = t2;
|
|
54
57
|
$[10] = t3;
|
|
58
|
+
$[11] = t4;
|
|
55
59
|
} else {
|
|
56
|
-
|
|
60
|
+
t4 = $[11];
|
|
57
61
|
}
|
|
58
|
-
return
|
|
62
|
+
return t4;
|
|
59
63
|
}
|
|
60
64
|
function _temp(token, index) {
|
|
61
65
|
return /*#__PURE__*/_jsx("span", {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { ResourceUrl } from '../../host.js';
|
|
3
|
+
export declare function ImageGroup({ children }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
3
6
|
export interface ImageThumbProps {
|
|
4
7
|
source: ResourceUrl;
|
|
5
8
|
alt: string;
|