@celljs/ta-web 4.31.0 → 4.32.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/esm/browser/assistant/assistant-view.js +1 -1
- package/esm/browser/components/composer-box-protocol.d.ts +5 -0
- package/esm/browser/components/composer-box.js +6 -5
- package/esm/browser/components/composer.d.ts +2 -0
- package/esm/browser/components/composer.js +3 -3
- package/esm/browser/components/session-view.js +1 -1
- package/esm/browser/style/device.js +4 -2
- package/esm/browser/util/composer.d.ts +2 -2
- package/esm/browser/util/composer.js +3 -3
- package/lib/browser/assistant/assistant-view.js +1 -1
- package/lib/browser/components/composer-box-protocol.d.ts +5 -0
- package/lib/browser/components/composer-box.js +6 -5
- package/lib/browser/components/composer.d.ts +2 -0
- package/lib/browser/components/composer.js +3 -3
- package/lib/browser/components/session-view.js +1 -1
- package/lib/browser/style/device.js +4 -2
- package/lib/browser/util/composer.d.ts +2 -2
- package/lib/browser/util/composer.js +3 -3
- package/package.json +7 -7
|
@@ -316,7 +316,7 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
316
316
|
React.createElement(ConnectionBanner, null),
|
|
317
317
|
addons.above,
|
|
318
318
|
React.createElement(CallBar, { state: callState, call: call }),
|
|
319
|
-
React.createElement(Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onStopTimed: stopTimed, onError: fail, after: speaking ? React.createElement(SpeakingButton, { onStop: hush }) : undefined, voiceSends: true, recentShots: settingsState.settings.recentShots, talkPlace: "double", draft: DraftPlaces.DOUBLE, onTalkSent: () => {
|
|
319
|
+
React.createElement(Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, compacting: !!state.compacting, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onStopTimed: stopTimed, onError: fail, after: speaking ? React.createElement(SpeakingButton, { onStop: hush }) : undefined, voiceSends: true, recentShots: settingsState.settings.recentShots, talkPlace: "double", draft: DraftPlaces.DOUBLE, onTalkSent: () => {
|
|
320
320
|
aloud.current = speakTalk;
|
|
321
321
|
}, onTalkCall: Voice.canSpeak() && Voice.canListen() && !callState.active ? talkCall(call) : undefined, talkCalls: talkCalls, onListening: on => {
|
|
322
322
|
setListening(on);
|
|
@@ -48,6 +48,11 @@ export interface ComposerBoxProps {
|
|
|
48
48
|
placeholder: string;
|
|
49
49
|
/** Something runs: with nothing typed, the button stops it. */
|
|
50
50
|
working?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The conversation is being compacted: with nothing typed the button (and Esc) stops that too, as it does a run;
|
|
53
|
+
* what is typed is sent as when nothing runs.
|
|
54
|
+
*/
|
|
55
|
+
compacting?: boolean;
|
|
51
56
|
/** Stops it; the button spins from the press until `working` is false, or a promise it returns fails. */
|
|
52
57
|
onStop?(): void;
|
|
53
58
|
/** Sends; when it fails, what was sent comes back into the box. `followUp`: Alt+Enter. */
|
|
@@ -30,7 +30,7 @@ import { TalkBar, useVoiceTalk, VoiceTalkOverlay } from './voice-talk.js';
|
|
|
30
30
|
let talkFirst = false;
|
|
31
31
|
export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
32
32
|
var _a;
|
|
33
|
-
const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, emoji: takesEmoji, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onTalkCall, talkCalls = ['keep', 'call'], onListening, autoFocus, onTextChange, draft, cwd, onError, } = props;
|
|
33
|
+
const { placeholder, working = false, compacting = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, emoji: takesEmoji, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onTalkCall, talkCalls = ['keep', 'call'], onListening, autoFocus, onTextChange, draft, cwd, onError, } = props;
|
|
34
34
|
const t = useT();
|
|
35
35
|
const drafts = useTaDrafts();
|
|
36
36
|
const [text, setText] = React.useState(() => { var _a; var _b; return (_b = (draft === undefined ? undefined : (_a = drafts === null || drafts === void 0 ? void 0 : drafts.get(draft)) === null || _a === void 0 ? void 0 : _a.text)) !== null && _b !== void 0 ? _b : ''; });
|
|
@@ -56,11 +56,12 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
56
56
|
const [listening, setListening] = React.useState(false);
|
|
57
57
|
// Stop pressed: the run may take a moment to end (a tool winding down), and the press must show at once.
|
|
58
58
|
const [stopping, setStopping] = React.useState(false);
|
|
59
|
+
const busy = working || compacting;
|
|
59
60
|
React.useEffect(() => {
|
|
60
|
-
if (!
|
|
61
|
+
if (!busy) {
|
|
61
62
|
setStopping(false);
|
|
62
63
|
}
|
|
63
|
-
}, [
|
|
64
|
+
}, [busy]);
|
|
64
65
|
const stop = () => {
|
|
65
66
|
if (!onStop || stopping) {
|
|
66
67
|
return;
|
|
@@ -101,7 +102,7 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
101
102
|
: [];
|
|
102
103
|
const note = (trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'file' && onMentionQuery && !items.length ? mentions === null || mentions === void 0 ? void 0 : mentions.note : undefined;
|
|
103
104
|
const sendable = text.trim().length > 0 || attachments.length > 0;
|
|
104
|
-
const action = ComposerUtil.action(working, sendable);
|
|
105
|
+
const action = ComposerUtil.action(working, sendable, compacting);
|
|
105
106
|
// An image still being read holds the message back, rather than leaving without it.
|
|
106
107
|
const reading = !ComposerUtil.ready(attachments);
|
|
107
108
|
useFieldFit(input, text, talkMode);
|
|
@@ -323,7 +324,7 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
323
324
|
event.preventDefault();
|
|
324
325
|
send(event.altKey);
|
|
325
326
|
}
|
|
326
|
-
else if (event.key === 'Escape' &&
|
|
327
|
+
else if (event.key === 'Escape' && busy && onStop) {
|
|
327
328
|
event.preventDefault();
|
|
328
329
|
stop();
|
|
329
330
|
}
|
|
@@ -30,6 +30,8 @@ export interface ComposerProps {
|
|
|
30
30
|
/** Where `@` looks for files. */
|
|
31
31
|
workspace: Pick<TaWorkspaceServer, 'findFiles'>;
|
|
32
32
|
working: boolean;
|
|
33
|
+
/** ComposerBoxProps.compacting: the stop of the box stops compacting the conversation too. */
|
|
34
|
+
compacting?: boolean;
|
|
33
35
|
commands: TaSlashCommand[];
|
|
34
36
|
/** The directory of the session: where `@` looks for files. */
|
|
35
37
|
cwd?: string;
|
|
@@ -65,7 +65,7 @@ function useQueue(store, working) {
|
|
|
65
65
|
* and Alt+Enter queues a follow-up; Escape stops it.
|
|
66
66
|
*/
|
|
67
67
|
export const Composer = React.forwardRef(function Composer(props, ref) {
|
|
68
|
-
const { store, onSubmit, head, after, voiceSends, recentShots, talkPlace, onTalkSent, onTalkCall, talkCalls, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onStop, onStopTimed, onTyping, draft, onError, } = props;
|
|
68
|
+
const { store, onSubmit, head, after, voiceSends, recentShots, talkPlace, onTalkSent, onTalkCall, talkCalls, onListening, server, workspace, working, compacting = false, commands, cwd, actions, placeholder, above, onSending, onStop, onStopTimed, onTyping, draft, onError, } = props;
|
|
69
69
|
// A finger: the keyboard opens on focus, over the conversation, and there are no keys to name.
|
|
70
70
|
const touch = useDevice(device => device.touch);
|
|
71
71
|
const t = useT();
|
|
@@ -90,7 +90,7 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
|
|
|
90
90
|
};
|
|
91
91
|
React.useEffect(() => {
|
|
92
92
|
const clock = stopping.current;
|
|
93
|
-
if (!working && clock) {
|
|
93
|
+
if (!working && !compacting && clock) {
|
|
94
94
|
timed(clock, clock.ended(performance.now()));
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -145,7 +145,7 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
|
|
|
145
145
|
}, onError);
|
|
146
146
|
};
|
|
147
147
|
const waiting = ComposerUtil.queued(queue);
|
|
148
|
-
return (React.createElement(ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(ComposerUtil.placeholderKey(working, touch)), working: working, onStop: stop, onSend: send, commands: listed, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, recentShots: recentShots, actions: actions, head: head, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onTalkCall: onTalkCall, talkCalls: talkCalls, onListening: onListening, autoFocus: !touch, onTextChange: onTyping && (text => onTyping(!!text.trim())), draft: draft, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
|
|
148
|
+
return (React.createElement(ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(ComposerUtil.placeholderKey(working, touch)), working: working, compacting: compacting, onStop: stop, onSend: send, commands: listed, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, recentShots: recentShots, actions: actions, head: head, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onTalkCall: onTalkCall, talkCalls: talkCalls, onListening: onListening, autoFocus: !touch, onTextChange: onTyping && (text => onTyping(!!text.trim())), draft: draft, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
|
|
149
149
|
above,
|
|
150
150
|
waiting.length > 0 && React.createElement(QueuedMessages, { waiting: waiting, onTakeBack: takeBack, onRemove: remove })) }));
|
|
151
151
|
});
|
|
@@ -381,7 +381,7 @@ export function SessionView({ store, server, workspace, info, onClosed, onActivi
|
|
|
381
381
|
widgetsAt('aboveEditor'),
|
|
382
382
|
addons.above,
|
|
383
383
|
React.createElement(CallBar, { state: callState, call: call })),
|
|
384
|
-
React.createElement(Composer, { ref: composer, store: store, server: server, workspace: workspace, working: state.working, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? talkCall(call) : undefined, talkCalls: talkCalls, onError: fail }),
|
|
384
|
+
React.createElement(Composer, { ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? talkCall(call) : undefined, talkCalls: talkCalls, onError: fail }),
|
|
385
385
|
belowComposer,
|
|
386
386
|
widgetsAt('belowEditor'),
|
|
387
387
|
statuses.length > 0 && (React.createElement("div", { className: "ta-statusline" }, statuses.map(([key, text]) => (React.createElement(StatusChip, { key: key, text: text })))))))));
|
|
@@ -166,6 +166,8 @@ export const DEVICE_STYLE = `
|
|
|
166
166
|
.ta-swipe-content { position: relative; display: flow-root; border-radius: inherit; }
|
|
167
167
|
.ta-swipe-row[data-swipeable] { touch-action: pan-y; }
|
|
168
168
|
.ta-swipe-row[data-swipe-clip] { overflow: hidden; }
|
|
169
|
+
/* Moving or open, the row has no color of its own (a hover a touch left, a selection): its content carries it, and at its edges, at a fraction of a pixel, what is under it would show as a line. */
|
|
170
|
+
.ta-swipe-row[data-swipeable][data-swipe-clip] { background: none; }
|
|
169
171
|
.ta-swipe-row[data-swipeable] > .ta-swipe-content { z-index: 1; background: var(--ta-swipe-bg, var(--ta-side)); transition: transform 300ms ${DeviceMotion.SHEET_CURVE}; }
|
|
170
172
|
.ta-swipe-row[data-swiped] > .ta-swipe-content { transform: translate3d(calc(-1 * var(--ta-swipe-width)), 0, 0); }
|
|
171
173
|
.ta-swipe-row[data-swiping] > .ta-swipe-content { transition: none; }
|
|
@@ -178,11 +180,11 @@ export const DEVICE_STYLE = `
|
|
|
178
180
|
.ta-swipe-row[data-swiped] > .ta-swipe-actions > .ta-swipe-action { transform: none; }
|
|
179
181
|
.ta-swipe-row[data-swiping] > .ta-swipe-actions > .ta-swipe-action { transition: none; }
|
|
180
182
|
.ta-swipe-action.ta-danger { background: var(--ta-red); }
|
|
181
|
-
/* Each action fills what it leaves to its right as the row stretches past them (at most BEYOND_PX), under the next one; the first one what the content leaves, should their edges part by a pixel. */
|
|
183
|
+
/* Each action fills what it leaves to its right as the row stretches past them (at most BEYOND_PX), under the next one; the first one what the content leaves, should their edges part by a pixel (no wider: under the content its color would show at the content's edges). */
|
|
182
184
|
.ta-swipe-action::after, .ta-swipe-action:first-child::before { content: ''; position: absolute; top: 0; bottom: 0; width: 120px; background: inherit; }
|
|
183
185
|
/* Over its edge by a pixel: at a fraction of a pixel the two would show a seam. */
|
|
184
186
|
.ta-swipe-action::after { left: calc(100% - 1px); }
|
|
185
|
-
.ta-swipe-action:first-child::before { right: calc(100% - 1px); }
|
|
187
|
+
.ta-swipe-action:first-child::before { right: calc(100% - 1px); width: 2px; }
|
|
186
188
|
.ta-swipe-action:active { filter: brightness(0.9); }
|
|
187
189
|
/* Moved by the finger, the row is not pressed: what it shows pressed goes back to what it is under it, unless it is the one chosen. */
|
|
188
190
|
.ta-swipe-row[data-swiping] > .ta-swipe-content > :active:not([aria-current]) { background: var(--ta-swipe-bg, var(--ta-side)); }
|
|
@@ -73,8 +73,8 @@ export declare namespace ComposerUtil {
|
|
|
73
73
|
function commands<T extends {
|
|
74
74
|
name: string;
|
|
75
75
|
}>(all: T[], query: string, limit?: number): T[];
|
|
76
|
-
/** One button sends and stops: it stops while the agent works and there is nothing to send. */
|
|
77
|
-
function action(working: boolean, sendable: boolean): 'send' | 'stop';
|
|
76
|
+
/** One button sends and stops: it stops while the agent works, or the conversation is compacted, and there is nothing to send. */
|
|
77
|
+
function action(working: boolean, sendable: boolean, compacting?: boolean): 'send' | 'stop';
|
|
78
78
|
/** The empty box's words: on a finger only the short ones, which fit a phone beside the + and the buttons. */
|
|
79
79
|
function placeholderKey(working: boolean, touch: boolean): MessageId;
|
|
80
80
|
/** Why a pasted or dropped file is not taken, if it is not. */
|
|
@@ -76,9 +76,9 @@ export var ComposerUtil;
|
|
|
76
76
|
return [...starts, ...contains].slice(0, limit);
|
|
77
77
|
}
|
|
78
78
|
ComposerUtil.commands = commands;
|
|
79
|
-
/** One button sends and stops: it stops while the agent works and there is nothing to send. */
|
|
80
|
-
function action(working, sendable) {
|
|
81
|
-
return working && !sendable ? 'stop' : 'send';
|
|
79
|
+
/** One button sends and stops: it stops while the agent works, or the conversation is compacted, and there is nothing to send. */
|
|
80
|
+
function action(working, sendable, compacting = false) {
|
|
81
|
+
return (working || compacting) && !sendable ? 'stop' : 'send';
|
|
82
82
|
}
|
|
83
83
|
ComposerUtil.action = action;
|
|
84
84
|
/** The empty box's words: on a finger only the short ones, which fit a phone beside the + and the buttons. */
|
|
@@ -357,7 +357,7 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
|
|
|
357
357
|
React.createElement(connection_bar_1.ConnectionBanner, null),
|
|
358
358
|
addons.above,
|
|
359
359
|
React.createElement(voice_call_bar_1.CallBar, { state: callState, call: call }),
|
|
360
|
-
React.createElement(composer_1.Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onStopTimed: stopTimed, onError: fail, after: speaking ? React.createElement(voice_button_1.SpeakingButton, { onStop: hush }) : undefined, voiceSends: true, recentShots: settingsState.settings.recentShots, talkPlace: "double", draft: drafts_protocol_1.DraftPlaces.DOUBLE, onTalkSent: () => {
|
|
360
|
+
React.createElement(composer_1.Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, compacting: !!state.compacting, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onStopTimed: stopTimed, onError: fail, after: speaking ? React.createElement(voice_button_1.SpeakingButton, { onStop: hush }) : undefined, voiceSends: true, recentShots: settingsState.settings.recentShots, talkPlace: "double", draft: drafts_protocol_1.DraftPlaces.DOUBLE, onTalkSent: () => {
|
|
361
361
|
aloud.current = speakTalk;
|
|
362
362
|
}, onTalkCall: voice_1.Voice.canSpeak() && voice_1.Voice.canListen() && !callState.active ? (0, voice_call_bar_1.talkCall)(call) : undefined, talkCalls: talkCalls, onListening: on => {
|
|
363
363
|
setListening(on);
|
|
@@ -48,6 +48,11 @@ export interface ComposerBoxProps {
|
|
|
48
48
|
placeholder: string;
|
|
49
49
|
/** Something runs: with nothing typed, the button stops it. */
|
|
50
50
|
working?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The conversation is being compacted: with nothing typed the button (and Esc) stops that too, as it does a run;
|
|
53
|
+
* what is typed is sent as when nothing runs.
|
|
54
|
+
*/
|
|
55
|
+
compacting?: boolean;
|
|
51
56
|
/** Stops it; the button spins from the press until `working` is false, or a promise it returns fails. */
|
|
52
57
|
onStop?(): void;
|
|
53
58
|
/** Sends; when it fails, what was sent comes back into the box. `followUp`: Alt+Enter. */
|
|
@@ -66,7 +66,7 @@ const voice_talk_1 = require("./voice-talk");
|
|
|
66
66
|
let talkFirst = false;
|
|
67
67
|
exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
68
68
|
var _a;
|
|
69
|
-
const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, emoji: takesEmoji, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onTalkCall, talkCalls = ['keep', 'call'], onListening, autoFocus, onTextChange, draft, cwd, onError, } = props;
|
|
69
|
+
const { placeholder, working = false, compacting = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, emoji: takesEmoji, recentShots, actions = [], above, head, after, voiceSends, talkPlace, onTalkSent, onTalkCall, talkCalls = ['keep', 'call'], onListening, autoFocus, onTextChange, draft, cwd, onError, } = props;
|
|
70
70
|
const t = (0, use_t_1.useT)();
|
|
71
71
|
const drafts = (0, use_composer_draft_1.useTaDrafts)();
|
|
72
72
|
const [text, setText] = React.useState(() => { var _a; var _b; return (_b = (draft === undefined ? undefined : (_a = drafts === null || drafts === void 0 ? void 0 : drafts.get(draft)) === null || _a === void 0 ? void 0 : _a.text)) !== null && _b !== void 0 ? _b : ''; });
|
|
@@ -92,11 +92,12 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
92
92
|
const [listening, setListening] = React.useState(false);
|
|
93
93
|
// Stop pressed: the run may take a moment to end (a tool winding down), and the press must show at once.
|
|
94
94
|
const [stopping, setStopping] = React.useState(false);
|
|
95
|
+
const busy = working || compacting;
|
|
95
96
|
React.useEffect(() => {
|
|
96
|
-
if (!
|
|
97
|
+
if (!busy) {
|
|
97
98
|
setStopping(false);
|
|
98
99
|
}
|
|
99
|
-
}, [
|
|
100
|
+
}, [busy]);
|
|
100
101
|
const stop = () => {
|
|
101
102
|
if (!onStop || stopping) {
|
|
102
103
|
return;
|
|
@@ -137,7 +138,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
137
138
|
: [];
|
|
138
139
|
const note = (trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'file' && onMentionQuery && !items.length ? mentions === null || mentions === void 0 ? void 0 : mentions.note : undefined;
|
|
139
140
|
const sendable = text.trim().length > 0 || attachments.length > 0;
|
|
140
|
-
const action = composer_1.ComposerUtil.action(working, sendable);
|
|
141
|
+
const action = composer_1.ComposerUtil.action(working, sendable, compacting);
|
|
141
142
|
// An image still being read holds the message back, rather than leaving without it.
|
|
142
143
|
const reading = !composer_1.ComposerUtil.ready(attachments);
|
|
143
144
|
(0, composer_box_hooks_1.useFieldFit)(input, text, talkMode);
|
|
@@ -359,7 +360,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
|
|
|
359
360
|
event.preventDefault();
|
|
360
361
|
send(event.altKey);
|
|
361
362
|
}
|
|
362
|
-
else if (event.key === 'Escape' &&
|
|
363
|
+
else if (event.key === 'Escape' && busy && onStop) {
|
|
363
364
|
event.preventDefault();
|
|
364
365
|
stop();
|
|
365
366
|
}
|
|
@@ -30,6 +30,8 @@ export interface ComposerProps {
|
|
|
30
30
|
/** Where `@` looks for files. */
|
|
31
31
|
workspace: Pick<TaWorkspaceServer, 'findFiles'>;
|
|
32
32
|
working: boolean;
|
|
33
|
+
/** ComposerBoxProps.compacting: the stop of the box stops compacting the conversation too. */
|
|
34
|
+
compacting?: boolean;
|
|
33
35
|
commands: TaSlashCommand[];
|
|
34
36
|
/** The directory of the session: where `@` looks for files. */
|
|
35
37
|
cwd?: string;
|
|
@@ -102,7 +102,7 @@ function useQueue(store, working) {
|
|
|
102
102
|
* and Alt+Enter queues a follow-up; Escape stops it.
|
|
103
103
|
*/
|
|
104
104
|
exports.Composer = React.forwardRef(function Composer(props, ref) {
|
|
105
|
-
const { store, onSubmit, head, after, voiceSends, recentShots, talkPlace, onTalkSent, onTalkCall, talkCalls, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onStop, onStopTimed, onTyping, draft, onError, } = props;
|
|
105
|
+
const { store, onSubmit, head, after, voiceSends, recentShots, talkPlace, onTalkSent, onTalkCall, talkCalls, onListening, server, workspace, working, compacting = false, commands, cwd, actions, placeholder, above, onSending, onStop, onStopTimed, onTyping, draft, onError, } = props;
|
|
106
106
|
// A finger: the keyboard opens on focus, over the conversation, and there are no keys to name.
|
|
107
107
|
const touch = (0, device_1.useDevice)(device => device.touch);
|
|
108
108
|
const t = (0, use_t_1.useT)();
|
|
@@ -127,7 +127,7 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
|
|
|
127
127
|
};
|
|
128
128
|
React.useEffect(() => {
|
|
129
129
|
const clock = stopping.current;
|
|
130
|
-
if (!working && clock) {
|
|
130
|
+
if (!working && !compacting && clock) {
|
|
131
131
|
timed(clock, clock.ended(performance.now()));
|
|
132
132
|
}
|
|
133
133
|
});
|
|
@@ -182,7 +182,7 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
|
|
|
182
182
|
}, onError);
|
|
183
183
|
};
|
|
184
184
|
const waiting = composer_1.ComposerUtil.queued(queue);
|
|
185
|
-
return (React.createElement(composer_box_1.ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(composer_1.ComposerUtil.placeholderKey(working, touch)), working: working, onStop: stop, onSend: send, commands: listed, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, recentShots: recentShots, actions: actions, head: head, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onTalkCall: onTalkCall, talkCalls: talkCalls, onListening: onListening, autoFocus: !touch, onTextChange: onTyping && (text => onTyping(!!text.trim())), draft: draft, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
|
|
185
|
+
return (React.createElement(composer_box_1.ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(composer_1.ComposerUtil.placeholderKey(working, touch)), working: working, compacting: compacting, onStop: stop, onSend: send, commands: listed, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, recentShots: recentShots, actions: actions, head: head, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onTalkCall: onTalkCall, talkCalls: talkCalls, onListening: onListening, autoFocus: !touch, onTextChange: onTyping && (text => onTyping(!!text.trim())), draft: draft, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
|
|
186
186
|
above,
|
|
187
187
|
waiting.length > 0 && React.createElement(QueuedMessages, { waiting: waiting, onTakeBack: takeBack, onRemove: remove })) }));
|
|
188
188
|
});
|
|
@@ -417,7 +417,7 @@ function SessionView({ store, server, workspace, info, onClosed, onActivity, lea
|
|
|
417
417
|
widgetsAt('aboveEditor'),
|
|
418
418
|
addons.above,
|
|
419
419
|
React.createElement(voice_call_bar_1.CallBar, { state: callState, call: call })),
|
|
420
|
-
React.createElement(composer_1.Composer, { ref: composer, store: store, server: server, workspace: workspace, working: state.working, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? drafts_protocol_1.DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? (0, voice_call_bar_1.talkCall)(call) : undefined, talkCalls: talkCalls, onError: fail }),
|
|
420
|
+
React.createElement(composer_1.Composer, { ref: composer, store: store, server: server, workspace: workspace, working: state.working, compacting: !!state.compacting, commands: settings.commands, cwd: info === null || info === void 0 ? void 0 : info.cwd, actions: composerActions, recentShots: recentShots, onStopTimed: stopTimed, onTyping: onTyping, draft: (info === null || info === void 0 ? void 0 : info.sessionFile) ? drafts_protocol_1.DraftPlaces.chat(info.sessionFile) : undefined, onTalkCall: callable && !callState.active ? (0, voice_call_bar_1.talkCall)(call) : undefined, talkCalls: talkCalls, onError: fail }),
|
|
421
421
|
belowComposer,
|
|
422
422
|
widgetsAt('belowEditor'),
|
|
423
423
|
statuses.length > 0 && (React.createElement("div", { className: "ta-statusline" }, statuses.map(([key, text]) => (React.createElement(StatusChip, { key: key, text: text })))))))));
|
|
@@ -169,6 +169,8 @@ exports.DEVICE_STYLE = `
|
|
|
169
169
|
.ta-swipe-content { position: relative; display: flow-root; border-radius: inherit; }
|
|
170
170
|
.ta-swipe-row[data-swipeable] { touch-action: pan-y; }
|
|
171
171
|
.ta-swipe-row[data-swipe-clip] { overflow: hidden; }
|
|
172
|
+
/* Moving or open, the row has no color of its own (a hover a touch left, a selection): its content carries it, and at its edges, at a fraction of a pixel, what is under it would show as a line. */
|
|
173
|
+
.ta-swipe-row[data-swipeable][data-swipe-clip] { background: none; }
|
|
172
174
|
.ta-swipe-row[data-swipeable] > .ta-swipe-content { z-index: 1; background: var(--ta-swipe-bg, var(--ta-side)); transition: transform 300ms ${device_protocol_1.DeviceMotion.SHEET_CURVE}; }
|
|
173
175
|
.ta-swipe-row[data-swiped] > .ta-swipe-content { transform: translate3d(calc(-1 * var(--ta-swipe-width)), 0, 0); }
|
|
174
176
|
.ta-swipe-row[data-swiping] > .ta-swipe-content { transition: none; }
|
|
@@ -181,11 +183,11 @@ exports.DEVICE_STYLE = `
|
|
|
181
183
|
.ta-swipe-row[data-swiped] > .ta-swipe-actions > .ta-swipe-action { transform: none; }
|
|
182
184
|
.ta-swipe-row[data-swiping] > .ta-swipe-actions > .ta-swipe-action { transition: none; }
|
|
183
185
|
.ta-swipe-action.ta-danger { background: var(--ta-red); }
|
|
184
|
-
/* Each action fills what it leaves to its right as the row stretches past them (at most BEYOND_PX), under the next one; the first one what the content leaves, should their edges part by a pixel. */
|
|
186
|
+
/* Each action fills what it leaves to its right as the row stretches past them (at most BEYOND_PX), under the next one; the first one what the content leaves, should their edges part by a pixel (no wider: under the content its color would show at the content's edges). */
|
|
185
187
|
.ta-swipe-action::after, .ta-swipe-action:first-child::before { content: ''; position: absolute; top: 0; bottom: 0; width: 120px; background: inherit; }
|
|
186
188
|
/* Over its edge by a pixel: at a fraction of a pixel the two would show a seam. */
|
|
187
189
|
.ta-swipe-action::after { left: calc(100% - 1px); }
|
|
188
|
-
.ta-swipe-action:first-child::before { right: calc(100% - 1px); }
|
|
190
|
+
.ta-swipe-action:first-child::before { right: calc(100% - 1px); width: 2px; }
|
|
189
191
|
.ta-swipe-action:active { filter: brightness(0.9); }
|
|
190
192
|
/* Moved by the finger, the row is not pressed: what it shows pressed goes back to what it is under it, unless it is the one chosen. */
|
|
191
193
|
.ta-swipe-row[data-swiping] > .ta-swipe-content > :active:not([aria-current]) { background: var(--ta-swipe-bg, var(--ta-side)); }
|
|
@@ -73,8 +73,8 @@ export declare namespace ComposerUtil {
|
|
|
73
73
|
function commands<T extends {
|
|
74
74
|
name: string;
|
|
75
75
|
}>(all: T[], query: string, limit?: number): T[];
|
|
76
|
-
/** One button sends and stops: it stops while the agent works and there is nothing to send. */
|
|
77
|
-
function action(working: boolean, sendable: boolean): 'send' | 'stop';
|
|
76
|
+
/** One button sends and stops: it stops while the agent works, or the conversation is compacted, and there is nothing to send. */
|
|
77
|
+
function action(working: boolean, sendable: boolean, compacting?: boolean): 'send' | 'stop';
|
|
78
78
|
/** The empty box's words: on a finger only the short ones, which fit a phone beside the + and the buttons. */
|
|
79
79
|
function placeholderKey(working: boolean, touch: boolean): MessageId;
|
|
80
80
|
/** Why a pasted or dropped file is not taken, if it is not. */
|
|
@@ -79,9 +79,9 @@ var ComposerUtil;
|
|
|
79
79
|
return [...starts, ...contains].slice(0, limit);
|
|
80
80
|
}
|
|
81
81
|
ComposerUtil.commands = commands;
|
|
82
|
-
/** One button sends and stops: it stops while the agent works and there is nothing to send. */
|
|
83
|
-
function action(working, sendable) {
|
|
84
|
-
return working && !sendable ? 'stop' : 'send';
|
|
82
|
+
/** One button sends and stops: it stops while the agent works, or the conversation is compacted, and there is nothing to send. */
|
|
83
|
+
function action(working, sendable, compacting = false) {
|
|
84
|
+
return (working || compacting) && !sendable ? 'stop' : 'send';
|
|
85
85
|
}
|
|
86
86
|
ComposerUtil.action = action;
|
|
87
87
|
/** The empty box's words: on a finger only the short ones, which fit a phone beside the + and the buttons. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-web",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.32.0",
|
|
4
4
|
"description": "The web client of ta serve: sessions, streaming messages, tool runs with diffs, and dialogs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@celljs/core": "4.
|
|
37
|
-
"@celljs/react": "4.
|
|
38
|
-
"@celljs/ta-client": "4.
|
|
39
|
-
"@celljs/ta-protocol": "4.
|
|
40
|
-
"@celljs/ta-relay": "4.
|
|
41
|
-
"@celljs/widget": "4.
|
|
36
|
+
"@celljs/core": "4.32.0",
|
|
37
|
+
"@celljs/react": "4.32.0",
|
|
38
|
+
"@celljs/ta-client": "4.32.0",
|
|
39
|
+
"@celljs/ta-protocol": "4.32.0",
|
|
40
|
+
"@celljs/ta-relay": "4.32.0",
|
|
41
|
+
"@celljs/widget": "4.32.0",
|
|
42
42
|
"@types/three": "^0.187.0",
|
|
43
43
|
"@xterm/addon-fit": "^0.11.0",
|
|
44
44
|
"@xterm/addon-unicode11": "^0.9.0",
|