@qilin-agent/client-ui-chat 3.1.4 → 3.1.6
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/README.i18n.yaml +11 -11
- package/README.md +10 -6
- package/README.zh.md +10 -6
- package/lib/client.js +784 -220
- package/lib/index.js +21 -7
- package/lib/types/chat-settings.d.ts +11 -0
- package/lib/types/client/chat/ChatNodeSeat.d.ts +3 -1
- package/lib/types/client/chat/flow-motion.d.ts +50 -6
- package/lib/types/client/chat/use-chat-reading.d.ts +11 -1
- package/lib/types/client/chat/use-chat-viewport.d.ts +65 -33
- package/lib/types/client/locale.d.ts +14 -0
- package/lib/types/client/presentation-policy.d.ts +7 -10
- package/lib/types/client/settings/TranscriptViewRow.d.ts +3 -3
- package/lib/types/client/transcript-view.d.ts +3 -3
- package/lib/types/index.d.ts +30 -4
- package/package.json +40 -40
package/lib/index.js
CHANGED
|
@@ -5,6 +5,12 @@ import z from "@qilin-agent/schemastery";
|
|
|
5
5
|
const CHAT_SETTINGS_NAMESPACE = "ui-chat";
|
|
6
6
|
/** Field carrying the work-details presentation mode. */
|
|
7
7
|
const TRANSCRIPT_VIEW_FIELD = "transcriptView";
|
|
8
|
+
/** Field carrying the independent work-details collapse timing. */
|
|
9
|
+
const COLLAPSE_TIMING_FIELD = "collapseTiming";
|
|
10
|
+
/** Available points when a completed Turn returns to its historical presentation. */
|
|
11
|
+
const COLLAPSE_TIMINGS = ["completion", "next-input"];
|
|
12
|
+
/** Preserve completion-time folding when no timing preference is saved. */
|
|
13
|
+
const DEFAULT_COLLAPSE_TIMING = "completion";
|
|
8
14
|
/** Work-details presentation modes a user can choose. */
|
|
9
15
|
const TRANSCRIPT_VIEW_MODES = [
|
|
10
16
|
"compact",
|
|
@@ -35,20 +41,28 @@ const DEFAULT_PERFORMANCE_USAGE = "detailed";
|
|
|
35
41
|
const DEFAULT_LINK_OPENING = "sidebar";
|
|
36
42
|
/** Durable Chat schema; also the wire envelope the browser scope validates against. */
|
|
37
43
|
const ChatSettingsFields = {
|
|
44
|
+
[COLLAPSE_TIMING_FIELD]: z.union([...COLLAPSE_TIMINGS]).default(DEFAULT_COLLAPSE_TIMING),
|
|
38
45
|
linkOpening: z.union(["sidebar", "new-tab"]).default(DEFAULT_LINK_OPENING),
|
|
39
46
|
performanceUsage: z.union([...PERFORMANCE_USAGE_MODES]).default(DEFAULT_PERFORMANCE_USAGE),
|
|
40
47
|
[TRANSCRIPT_VIEW_FIELD]: z.union([...TRANSCRIPT_VIEW_SETTING_VALUES]).default(DEFAULT_TRANSCRIPT_VIEW_MODE).loose()
|
|
41
48
|
};
|
|
42
|
-
|
|
43
|
-
const ChatSettingsSchema = z.object(ChatSettingsFields);
|
|
49
|
+
z.object(ChatSettingsFields);
|
|
44
50
|
//#endregion
|
|
45
51
|
//#region lib/types/index.js
|
|
46
|
-
/**
|
|
47
|
-
|
|
52
|
+
/** Live preferences projected to the browser. */
|
|
53
|
+
const Config = z.object({
|
|
54
|
+
[TRANSCRIPT_VIEW_FIELD]: ChatSettingsFields[TRANSCRIPT_VIEW_FIELD].volatile(),
|
|
55
|
+
collapseTiming: ChatSettingsFields.collapseTiming.volatile(),
|
|
56
|
+
performanceUsage: ChatSettingsFields["performanceUsage"].volatile(),
|
|
57
|
+
linkOpening: ChatSettingsFields.linkOpening.volatile()
|
|
58
|
+
});
|
|
59
|
+
/** Host preferences are consumed through the configuration form projection.
|
|
60
|
+
* @param ctx Plugin context used for optional settings presentation.
|
|
61
|
+
*/
|
|
48
62
|
function apply(ctx) {
|
|
49
|
-
ctx.inject(["settings"], (
|
|
50
|
-
|
|
63
|
+
ctx.inject(["settings"], (child) => {
|
|
64
|
+
child.effect(() => child.settings.configure({ auto: false }, ctx.fiber));
|
|
51
65
|
});
|
|
52
66
|
}
|
|
53
67
|
//#endregion
|
|
54
|
-
export { CHAT_SETTINGS_NAMESPACE,
|
|
68
|
+
export { CHAT_SETTINGS_NAMESPACE, Config, DEFAULT_LINK_OPENING, DEFAULT_PERFORMANCE_USAGE, DEFAULT_TRANSCRIPT_VIEW_MODE, LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE, LEGACY_TRANSCRIPT_VIEW_MODE, PERFORMANCE_USAGE_MODES, TRANSCRIPT_VIEW_FIELD, TRANSCRIPT_VIEW_MODES, apply };
|
|
@@ -4,6 +4,14 @@ import z from '@qilin-agent/schemastery';
|
|
|
4
4
|
export declare const CHAT_SETTINGS_NAMESPACE = "ui-chat";
|
|
5
5
|
/** Field carrying the work-details presentation mode. */
|
|
6
6
|
export declare const TRANSCRIPT_VIEW_FIELD = "transcriptView";
|
|
7
|
+
/** Field carrying the independent work-details collapse timing. */
|
|
8
|
+
export declare const COLLAPSE_TIMING_FIELD = "collapseTiming";
|
|
9
|
+
/** Available points when a completed Turn returns to its historical presentation. */
|
|
10
|
+
export declare const COLLAPSE_TIMINGS: readonly ["completion", "next-input"];
|
|
11
|
+
/** When a completed Turn returns to its historical presentation. */
|
|
12
|
+
export type CollapseTiming = typeof COLLAPSE_TIMINGS[number];
|
|
13
|
+
/** Preserve completion-time folding when no timing preference is saved. */
|
|
14
|
+
export declare const DEFAULT_COLLAPSE_TIMING: CollapseTiming;
|
|
7
15
|
/** Work-details presentation modes a user can choose. */
|
|
8
16
|
export declare const TRANSCRIPT_VIEW_MODES: readonly ["compact", "standard", "detailed", "verbose"];
|
|
9
17
|
/** Work-details presentation mode. */
|
|
@@ -31,6 +39,8 @@ export declare const DEFAULT_LINK_OPENING: LinkOpening;
|
|
|
31
39
|
export interface ChatSettings {
|
|
32
40
|
/** Work-details preference; legacy values are accepted only from existing saved settings. */
|
|
33
41
|
transcriptView: TranscriptViewMode | typeof LEGACY_TRANSCRIPT_VIEW_MODE | typeof LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE;
|
|
42
|
+
/** Independent collapse timing; absence preserves completion-time folding. */
|
|
43
|
+
collapseTiming?: CollapseTiming;
|
|
34
44
|
/** Detail level for composer statistics and completed-Turn usage. */
|
|
35
45
|
performanceUsage: PerformanceUsageMode;
|
|
36
46
|
/** Default destination for Chat HTTP(S) links. */
|
|
@@ -38,6 +48,7 @@ export interface ChatSettings {
|
|
|
38
48
|
}
|
|
39
49
|
/** Durable Chat schema; also the wire envelope the browser scope validates against. */
|
|
40
50
|
export declare const ChatSettingsFields: {
|
|
51
|
+
collapseTiming: z<"completion" | "next-input", "completion" | "next-input", "defined">;
|
|
41
52
|
linkOpening: z<"sidebar" | "new-tab", "sidebar" | "new-tab", "defined">;
|
|
42
53
|
performanceUsage: z<"compact" | "detailed", "compact" | "detailed", "defined">;
|
|
43
54
|
transcriptView: z<"compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "defined">;
|
|
@@ -2,6 +2,8 @@ import type { ChatNodeOwnerProps, ChatFlowSlotProps, UsePresentation } from '../
|
|
|
2
2
|
import type { ChatNodeStore } from '../contract/snapshot.ts';
|
|
3
3
|
interface ChatNodeSeatProps extends ChatNodeOwnerProps {
|
|
4
4
|
readonly nodeKey: string;
|
|
5
|
+
/** Nesting level inside a process group; absent for a root row. */
|
|
6
|
+
readonly depth?: number;
|
|
5
7
|
/** A replaced Builder must rebind keyed hooks even when references and keys survive. */
|
|
6
8
|
readonly nodeStore: ChatNodeStore;
|
|
7
9
|
readonly useChatNode: ChatFlowSlotProps['useChatNode'];
|
|
@@ -20,6 +22,6 @@ interface ChatNodeSeatProps extends ChatNodeOwnerProps {
|
|
|
20
22
|
* Policy reads select this seat's own conclusion, so a mode change re-renders
|
|
21
23
|
* only seats whose visibility actually changes.
|
|
22
24
|
*/
|
|
23
|
-
export declare const ChatNodeSeat: import("react").MemoExoticComponent<({ nodeKey, groupPart, useChatNode, useChatNodeProcess, usePresentation, cwd, openFile, openSkill, inspectCall, forkAt, editUserMessage, loadImage, renderMessageImages, fileMentions, useStore, actions, renderSlot, t, useChatNodeBottom, deferCollapse, useGroupAction, }: ChatNodeSeatProps) => import("react").JSX.Element | null>;
|
|
25
|
+
export declare const ChatNodeSeat: import("react").MemoExoticComponent<({ nodeKey, groupPart, depth, useChatNode, useChatNodeProcess, usePresentation, cwd, openFile, openSkill, inspectCall, forkAt, editUserMessage, loadImage, renderMessageImages, fileMentions, useStore, actions, renderSlot, t, useChatNodeBottom, deferCollapse, useGroupAction, }: ChatNodeSeatProps) => import("react").JSX.Element | null>;
|
|
24
26
|
export {};
|
|
25
27
|
//# sourceMappingURL=ChatNodeSeat.d.ts.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* the
|
|
4
|
-
* Motion is opt-in under `[data-chat-motion]`, respects reduced motion,
|
|
2
|
+
* Fold transitions owned by one Chat viewport. Every batch containing a closing row moves its boxes and
|
|
3
|
+
* the scrollport on one frame clock; a batch that only reveals rows, or a viewport without a reading
|
|
4
|
+
* policy, uses CSS transitions. Motion is opt-in under `[data-chat-motion]`, respects reduced motion,
|
|
5
|
+
* and clears temporary styles.
|
|
5
6
|
*/
|
|
6
7
|
import { type RefObject } from 'react';
|
|
7
8
|
/** Row-local operations supplied by the containing viewport. */
|
|
@@ -13,12 +14,55 @@ export interface FlowMotionRows {
|
|
|
13
14
|
/** @param element - row whose active transition should be cancelled without hiding it. */
|
|
14
15
|
cancelMotion(element: HTMLElement): void;
|
|
15
16
|
}
|
|
17
|
+
/** Geometry captured before one fold batch changes its boxes. */
|
|
18
|
+
export interface InputFoldBox {
|
|
19
|
+
readonly element: HTMLElement;
|
|
20
|
+
readonly height: number;
|
|
21
|
+
readonly marginTop: number;
|
|
22
|
+
readonly closing: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** The viewport moves on the same progress that changes the folded boxes. */
|
|
25
|
+
export interface InputFoldDriver {
|
|
26
|
+
/**
|
|
27
|
+
* Capture geometry and choose the landing before the frame clock changes the boxes.
|
|
28
|
+
* @param boxes - non-nested boxes whose layout changes on this clock.
|
|
29
|
+
* @returns closing boxes that scroll with the content and stay opaque; the rest fade in place. The driver
|
|
30
|
+
* may add boxes while the batch runs, when a newer tail request takes it over.
|
|
31
|
+
*/
|
|
32
|
+
begin(boxes: readonly InputFoldBox[]): ReadonlySet<HTMLElement>;
|
|
33
|
+
/**
|
|
34
|
+
* Reserve scroll range before box writes.
|
|
35
|
+
* @param progress - shared eased progress from zero to one.
|
|
36
|
+
* @param cancelled - a reading gesture stopped a tail landing's automatic target; a landing that keeps
|
|
37
|
+
* the reader's content still continues and includes the reader's own movement.
|
|
38
|
+
*/
|
|
39
|
+
prepare(progress: number, cancelled: boolean): void;
|
|
40
|
+
/**
|
|
41
|
+
* Apply viewport geometry after box writes.
|
|
42
|
+
* @param progress - shared eased progress from zero to one.
|
|
43
|
+
* @param cancelled - a reading gesture stopped a tail landing's automatic target.
|
|
44
|
+
* @returns actual scrollTop displacement from the batch start, for closing-content visual compensation.
|
|
45
|
+
*/
|
|
46
|
+
frame(progress: number, cancelled: boolean): number;
|
|
47
|
+
/**
|
|
48
|
+
* Install the final geometry after the last frame or cancellation.
|
|
49
|
+
* @param cancelled - a reading gesture stopped the automatic target, every closing row reopened, or the
|
|
50
|
+
* viewport detached; the driver commits no obsolete landing.
|
|
51
|
+
*/
|
|
52
|
+
finish(cancelled: boolean): void;
|
|
53
|
+
}
|
|
16
54
|
/** Animation lifetime and fold coordination for one viewport. */
|
|
17
55
|
export interface FlowMotion extends FlowMotionRows {
|
|
18
56
|
/** @returns whether a row owned by this viewport is closing. */
|
|
19
57
|
foldActive(): boolean;
|
|
20
58
|
/** @param listener - callback after the last fold. @returns cancellation for a pending callback. */
|
|
21
59
|
onFoldIdle(listener: () => void): () => void;
|
|
60
|
+
/** Stop the running batch's automatic target while letting its boxes finish. */
|
|
61
|
+
cancelInput(): void;
|
|
62
|
+
/** Restore the running batch's automatic target after a newer request takes it over. */
|
|
63
|
+
resumeInput(): void;
|
|
64
|
+
/** @returns whether a fold batch runs, or one is scheduled for this commit's closing rows. */
|
|
65
|
+
inputActive(): boolean;
|
|
22
66
|
/** Cancel owned animations and pending work when the viewport detaches. */
|
|
23
67
|
clear(): void;
|
|
24
68
|
}
|
|
@@ -36,16 +80,16 @@ export declare function motionEnabled(element: HTMLElement): boolean;
|
|
|
36
80
|
export declare function hiddenOrCollapsing(element: HTMLElement): boolean;
|
|
37
81
|
/**
|
|
38
82
|
* Create animation coordination without cross-viewport broadcasts.
|
|
39
|
-
* @param
|
|
83
|
+
* @param driver - the viewport's driver for the next batch; null while detached.
|
|
40
84
|
* @param foldingChanged - disable or restore this viewport's native scroll anchoring.
|
|
41
85
|
* @returns stable callbacks and cleanup for this viewport's animations.
|
|
42
86
|
*/
|
|
43
|
-
export declare function createFlowMotion(
|
|
87
|
+
export declare function createFlowMotion(driver: () => InputFoldDriver | null, foldingChanged: (active: boolean) => void): FlowMotion;
|
|
44
88
|
/**
|
|
45
89
|
* Apply searchable hiding with the containing Chat viewport's optional fold animation.
|
|
46
90
|
* @param hidden - desired visibility.
|
|
47
91
|
* @param reveal - browser-find and focus-protection callback.
|
|
48
|
-
* @param motion - owning viewport's row callbacks;
|
|
92
|
+
* @param motion - owning viewport's row callbacks; undefined applies visibility synchronously.
|
|
49
93
|
* @returns the stable subtree ref.
|
|
50
94
|
*/
|
|
51
95
|
export declare function useFlowHidden(hidden: boolean, reveal: () => void, motion: FlowMotionRows | undefined): RefObject<HTMLDivElement>;
|
|
@@ -23,9 +23,9 @@ export declare class ChatReading {
|
|
|
23
23
|
private readonly follow;
|
|
24
24
|
private sampleTimer;
|
|
25
25
|
private probeFrame;
|
|
26
|
+
private sampled;
|
|
26
27
|
/** Settled reader row and offset, re-aligned when a layout change moves it. */
|
|
27
28
|
private readerPosition;
|
|
28
|
-
private sampled;
|
|
29
29
|
constructor(viewport: ChatViewport, store: PositionStore, state: ChatReadingState, onChange: (state: ChatReadingState) => void, follow: ScrollFollow);
|
|
30
30
|
/**
|
|
31
31
|
* Expose pending reader ownership to navigation and resize handlers.
|
|
@@ -57,6 +57,16 @@ export declare class ChatReading {
|
|
|
57
57
|
* @param behavior - immediate positioning, or one native animation when the reader's own input moved the tail.
|
|
58
58
|
*/
|
|
59
59
|
followTail(behavior?: 'instant' | 'smooth'): void;
|
|
60
|
+
/**
|
|
61
|
+
* Follow the tail on the active fold's animation clock.
|
|
62
|
+
* @returns whether a fold batch owns the tail movement instead of a separate scroll animation.
|
|
63
|
+
*/
|
|
64
|
+
followInputFold(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Let fold batches read follow intent and commit their tail landings.
|
|
67
|
+
* @returns a disposer that disconnects this reading policy from the viewport.
|
|
68
|
+
*/
|
|
69
|
+
bindFolds(): () => void;
|
|
60
70
|
/** Stop a native follow animation where it is; the next sampled position decides follow intent. */
|
|
61
71
|
interruptFollow(): void;
|
|
62
72
|
/** Restore the Session's semantic position, or follow the tail when none is saved. */
|
|
@@ -17,13 +17,21 @@ export interface ViewportLanding {
|
|
|
17
17
|
}
|
|
18
18
|
interface ViewportEvents {
|
|
19
19
|
scroll: (event: ViewportScroll) => void;
|
|
20
|
-
/** Settled scroll; `outer` distinguishes the transcript scroller from a process body. */
|
|
21
20
|
scrollEnd: (outer: boolean) => void;
|
|
22
21
|
resize: () => void;
|
|
23
22
|
interact: () => void;
|
|
24
23
|
/** Any reading gesture, before paging ownership is consulted. */
|
|
25
24
|
intent?: () => void;
|
|
26
25
|
}
|
|
26
|
+
/** Reading policy that fold batches consult and report tail landings to. */
|
|
27
|
+
export interface FoldReader {
|
|
28
|
+
/** Follow intent at batch start selects the tail landing; tail landings commit it. */
|
|
29
|
+
readonly follow: ScrollFollow;
|
|
30
|
+
/** @param landing - the actual geometry after a batch landed at the tail. */
|
|
31
|
+
readonly landedAtTail: (landing: ViewportLanding) => void;
|
|
32
|
+
/** @returns whether reader movement awaits sampling; until then follow intent is undecided. */
|
|
33
|
+
readonly pending: () => boolean;
|
|
34
|
+
}
|
|
27
35
|
/** Owns one Chat scrollport's DOM operations, event listeners, and size observer. */
|
|
28
36
|
export declare class ChatViewport {
|
|
29
37
|
private elements;
|
|
@@ -31,9 +39,16 @@ export declare class ChatViewport {
|
|
|
31
39
|
private events;
|
|
32
40
|
private turns;
|
|
33
41
|
private observation;
|
|
42
|
+
private paging;
|
|
43
|
+
private reader;
|
|
44
|
+
/** A transcript resize observed since the previous sample. */
|
|
34
45
|
private resized;
|
|
46
|
+
/** Reader input observed since the previous sample. */
|
|
35
47
|
private readerIntent;
|
|
36
|
-
|
|
48
|
+
/** The pending or running fold batch lands at the tail. */
|
|
49
|
+
private tailRequested;
|
|
50
|
+
/** Switches the running batch to a tail landing; null while no batch runs. */
|
|
51
|
+
private retarget;
|
|
37
52
|
/** Transition state and row callbacks owned by this viewport's attachment. */
|
|
38
53
|
readonly motion: import("./flow-motion.ts").FlowMotion;
|
|
39
54
|
/**
|
|
@@ -65,17 +80,57 @@ export declare class ChatViewport {
|
|
|
65
80
|
private spacerHeight;
|
|
66
81
|
private setSpacer;
|
|
67
82
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @
|
|
83
|
+
* Connect the reading policy that fold batches consult.
|
|
84
|
+
* @param reader - follow intent and the tail-landing commit.
|
|
85
|
+
* @returns a disposer that disconnects only this reader.
|
|
86
|
+
*/
|
|
87
|
+
bindReader(reader: FoldReader): () => void;
|
|
88
|
+
/**
|
|
89
|
+
* Land the pending or running fold batch at the tail instead of starting a separate scroll.
|
|
90
|
+
* @param follow - follow controller whose native animation yields to the batch.
|
|
91
|
+
* @returns whether a fold owns the tail movement.
|
|
92
|
+
*/
|
|
93
|
+
followInputFold(follow: ScrollFollow): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Drive one fold batch on its frame clock. A tail landing ends at the floor, never above the reader's
|
|
96
|
+
* compensated position; a reader landing keeps the visible content still. Both install only the room
|
|
97
|
+
* the landing lacks.
|
|
98
|
+
* @returns the batch driver, or null while detached or without a reading policy.
|
|
99
|
+
*/
|
|
100
|
+
private foldDriver;
|
|
101
|
+
/**
|
|
102
|
+
* Find the first visible top-level row at or below the scrollport top that holds no batch box.
|
|
103
|
+
* Binary search over the ordered top-level rows reads O(log n) boxes.
|
|
104
|
+
* @returns the reference row, or null when every visible row folds.
|
|
71
105
|
*/
|
|
72
|
-
|
|
106
|
+
private readingReference;
|
|
107
|
+
/**
|
|
108
|
+
* Consume the pending transcript resize. A delivery that arrives with one is the
|
|
109
|
+
* browser's layout compensation, not a reader choice, so it must not re-anchor the
|
|
110
|
+
* semantic position.
|
|
111
|
+
* @returns whether the transcript resized since the previous sample.
|
|
112
|
+
*/
|
|
113
|
+
consumeResize(): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Consume reader input recorded since the previous sample. Geometry alone cannot
|
|
116
|
+
* separate a reader scroll from the browser's layout compensation, so a transcript
|
|
117
|
+
* that moved with reader input present is the reader's own choice.
|
|
118
|
+
* @returns whether wheel, touch, pointer, key, or find-in-page input arrived.
|
|
119
|
+
*/
|
|
120
|
+
consumeReaderIntent(): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Re-align the reader's own settled row after a layout change moved it. A missing row
|
|
123
|
+
* leaves the scrollport untouched: the raw position is only meaningful for the row it
|
|
124
|
+
* was sampled against.
|
|
125
|
+
* @param position - semantic position sampled while the reader owned the transcript.
|
|
126
|
+
* @returns the actual landing, or null when the row is absent or still aligned.
|
|
127
|
+
*/
|
|
128
|
+
restoreReaderRow(position: ChatScrollPosition | null): ViewportLanding | null;
|
|
73
129
|
/** Clear fold reservations after a display-mode change, allowing the scroll range to shrink. */
|
|
74
130
|
resetBelow(): void;
|
|
75
131
|
/**
|
|
76
|
-
* Give reserved room back
|
|
77
|
-
*
|
|
78
|
-
* would let the next frame clamp.
|
|
132
|
+
* Give reserved room back after acknowledged scrolling or content growth without clamping the reader.
|
|
133
|
+
* Holds still during folds and unsampled movement; following includes the room that remains.
|
|
79
134
|
*/
|
|
80
135
|
reclaimBelow(): void;
|
|
81
136
|
/**
|
|
@@ -88,21 +143,6 @@ export declare class ChatViewport {
|
|
|
88
143
|
* @param metrics - settled reader position used as the next attribution baseline.
|
|
89
144
|
*/
|
|
90
145
|
acknowledge(metrics: ViewportMetrics): void;
|
|
91
|
-
/**
|
|
92
|
-
* Consume the pending transcript resize.
|
|
93
|
-
* A delivery that arrives with one is the browser's layout compensation,
|
|
94
|
-
* not a reader choice, so it must not re-anchor the semantic position.
|
|
95
|
-
* @returns whether the transcript resized since the previous sample.
|
|
96
|
-
*/
|
|
97
|
-
consumeResize(): boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Consume reader input recorded since the previous sample.
|
|
100
|
-
* Geometry alone cannot separate a reader scroll from the browser's layout
|
|
101
|
-
* compensation, so a transcript that moved with reader input present is the
|
|
102
|
-
* reader's own choice.
|
|
103
|
-
* @returns whether wheel, touch, pointer, key, or find-in-page input arrived.
|
|
104
|
-
*/
|
|
105
|
-
consumeReaderIntent(): boolean;
|
|
106
146
|
/**
|
|
107
147
|
* Compare the current scroll geometry with the last acknowledged position.
|
|
108
148
|
* @returns current metrics and movement attribution, or null while detached.
|
|
@@ -142,14 +182,6 @@ export declare class ChatViewport {
|
|
|
142
182
|
* @returns the actual landing, or null while detached.
|
|
143
183
|
*/
|
|
144
184
|
restore(position: ChatScrollPosition): ViewportLanding | null;
|
|
145
|
-
/**
|
|
146
|
-
* Re-align the reader's own settled row after a layout change moved it.
|
|
147
|
-
* A missing row leaves the scrollport untouched: the raw position is only
|
|
148
|
-
* meaningful for the row it was sampled against.
|
|
149
|
-
* @param position - semantic position sampled while the reader owned the transcript.
|
|
150
|
-
* @returns the actual landing, or null when the row is absent or still aligned.
|
|
151
|
-
*/
|
|
152
|
-
restoreReaderRow(position: ChatScrollPosition | null): ViewportLanding | null;
|
|
153
185
|
/** Retain the first eligible transcript seat in DOM order; selection reads no geometry. */
|
|
154
186
|
beginPaging(): void;
|
|
155
187
|
/**
|
|
@@ -172,7 +204,7 @@ export declare class ChatViewport {
|
|
|
172
204
|
*/
|
|
173
205
|
preserve(): ViewportLanding | null;
|
|
174
206
|
/**
|
|
175
|
-
* Align the
|
|
207
|
+
* Align with the physical floor, including fold room that newer content has not yet filled.
|
|
176
208
|
* @param follow - independent follow intent and scrolling controller.
|
|
177
209
|
* @param behavior - immediate positioning, or one native animation for a reader-caused tail change.
|
|
178
210
|
* @returns the actual floor landing, or null while detached. A smooth landing reports the starting
|
|
@@ -52,6 +52,8 @@ export declare const zh: {
|
|
|
52
52
|
'fileOpen.title': string;
|
|
53
53
|
'fileOpen.unknown': string;
|
|
54
54
|
'message.extraBlock': string;
|
|
55
|
+
'secret.reveal': string;
|
|
56
|
+
'secret.hide': string;
|
|
55
57
|
'message.systemPrompt': string;
|
|
56
58
|
'message.systemPromptUpdate': string;
|
|
57
59
|
'message.contextInjection': string;
|
|
@@ -164,6 +166,11 @@ export declare const zh: {
|
|
|
164
166
|
'message.retry.delay': string;
|
|
165
167
|
'message.retry.failure': string;
|
|
166
168
|
'message.failure.auth': string;
|
|
169
|
+
'message.taskStopped': string;
|
|
170
|
+
'message.failure.accountSignedOut': string;
|
|
171
|
+
'message.failure.interrupted': string;
|
|
172
|
+
'message.failure.accountSignInRequired': string;
|
|
173
|
+
'message.failure.quota': string;
|
|
167
174
|
'message.turnError': string;
|
|
168
175
|
'message.maxTokens': string;
|
|
169
176
|
'message.maxTokens.hint': string;
|
|
@@ -244,6 +251,8 @@ export declare const en: {
|
|
|
244
251
|
'fileOpen.title': string;
|
|
245
252
|
'fileOpen.unknown': string;
|
|
246
253
|
'message.extraBlock': string;
|
|
254
|
+
'secret.reveal': string;
|
|
255
|
+
'secret.hide': string;
|
|
247
256
|
'message.systemPrompt': string;
|
|
248
257
|
'message.systemPromptUpdate': string;
|
|
249
258
|
'message.contextInjection': string;
|
|
@@ -356,6 +365,11 @@ export declare const en: {
|
|
|
356
365
|
'message.retry.delay': string;
|
|
357
366
|
'message.retry.failure': string;
|
|
358
367
|
'message.failure.auth': string;
|
|
368
|
+
'message.taskStopped': string;
|
|
369
|
+
'message.failure.accountSignedOut': string;
|
|
370
|
+
'message.failure.interrupted': string;
|
|
371
|
+
'message.failure.accountSignInRequired': string;
|
|
372
|
+
'message.failure.quota': string;
|
|
359
373
|
'message.turnError': string;
|
|
360
374
|
'message.maxTokens': string;
|
|
361
375
|
'message.maxTokens.hint': string;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
/** Chat presentation derived from Host-backed detail and
|
|
1
|
+
/** Chat presentation derived from Host-backed detail and collapse timing. */
|
|
2
2
|
import type { ObservableSnapshot } from '@qilin-agent/client-store';
|
|
3
|
-
import type { TranscriptViewMode } from '../chat-settings.ts';
|
|
4
|
-
|
|
5
|
-
export declare const COLLAPSE_TIMINGS: readonly ["completion", "next-input"];
|
|
6
|
-
/** When a completed Turn returns to its historical presentation. */
|
|
7
|
-
export type CollapseTiming = typeof COLLAPSE_TIMINGS[number];
|
|
3
|
+
import type { CollapseTiming, TranscriptViewMode } from '../chat-settings.ts';
|
|
4
|
+
export { COLLAPSE_TIMINGS, type CollapseTiming } from '../chat-settings.ts';
|
|
8
5
|
/** Presentation capabilities that one work-details mode enables. */
|
|
9
6
|
export interface ChatPresentationPolicy {
|
|
10
7
|
/** Preference identity for layout resets and diagnostics; renderers select the capabilities below. */
|
|
11
8
|
readonly mode: TranscriptViewMode;
|
|
12
|
-
/**
|
|
9
|
+
/** Saved collapse timing; completion retains the default immediate folding and scrolling. */
|
|
13
10
|
readonly collapseTiming: CollapseTiming;
|
|
14
11
|
/** Whether a normally completed Turn folds its process rows behind the whole-Turn control. */
|
|
15
12
|
readonly foldCompletedTurns: boolean;
|
|
@@ -23,14 +20,14 @@ export interface ChatPresentationPolicy {
|
|
|
23
20
|
/**
|
|
24
21
|
* Resolve a stable policy for one detail mode and collapse timing.
|
|
25
22
|
* @param mode - persisted work-details mode.
|
|
26
|
-
* @param collapseTiming -
|
|
23
|
+
* @param collapseTiming - persisted timing; defaults to immediate completion folding.
|
|
27
24
|
* @returns the same policy object for the same pair of choices.
|
|
28
25
|
*/
|
|
29
26
|
export declare function presentationPolicyFor(mode: TranscriptViewMode, collapseTiming?: CollapseTiming): ChatPresentationPolicy;
|
|
30
27
|
/**
|
|
31
|
-
* Combine Host-backed detail and
|
|
28
|
+
* Combine Host-backed detail and persisted timing without owning subscriptions.
|
|
32
29
|
* @param mode - live work-details mode.
|
|
33
|
-
* @param collapseTiming - live
|
|
30
|
+
* @param collapseTiming - live Host-backed collapse timing.
|
|
34
31
|
* @returns observable policy whose subscriptions follow both preferences.
|
|
35
32
|
*/
|
|
36
33
|
export declare function derivePresentationPolicy(mode: ObservableSnapshot<TranscriptViewMode>, collapseTiming: ObservableSnapshot<CollapseTiming>): ObservableSnapshot<ChatPresentationPolicy>;
|
|
@@ -8,18 +8,18 @@ export interface TranscriptViewRowInjected {
|
|
|
8
8
|
hooks: {
|
|
9
9
|
/** Persisted work-details preference bound as useTranscriptView. */
|
|
10
10
|
transcriptView: SnapshotStore<TranscriptViewMode>;
|
|
11
|
-
/**
|
|
11
|
+
/** Persisted collapse timing bound as useCollapseTiming. */
|
|
12
12
|
collapseTiming: SnapshotStore<CollapseTiming>;
|
|
13
13
|
};
|
|
14
14
|
/** Change the work-details presentation. */
|
|
15
15
|
setTranscriptView: (mode: TranscriptViewMode) => void;
|
|
16
|
-
/**
|
|
16
|
+
/** Persist collapse timing independently of the work-details mode. */
|
|
17
17
|
setCollapseTiming: (timing: CollapseTiming) => void;
|
|
18
18
|
}
|
|
19
19
|
/** Full Settings-row props. */
|
|
20
20
|
export type TranscriptViewRowProps = PropsRuntime<'settings.general.item'> & PropsLocale<'chat'> & InjectFace<TranscriptViewRowInjected>;
|
|
21
21
|
/**
|
|
22
|
-
* Render work-details and
|
|
22
|
+
* Render the independent, Host-backed work-details and collapse-timing selectors.
|
|
23
23
|
* @param props - composed Settings slot props.
|
|
24
24
|
* @returns the preference row.
|
|
25
25
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Independent work-details preferences backed by the same Host configuration form. */
|
|
2
2
|
import { type SnapshotStore } from '@qilin-agent/client-store';
|
|
3
3
|
import type { ConfigForm } from '@qilin-agent/client-ui-settings/client';
|
|
4
4
|
import type { CollapseTiming } from './presentation-policy.ts';
|
|
@@ -10,7 +10,7 @@ export declare class TranscriptViewPolicy {
|
|
|
10
10
|
private readonly unsubscribe;
|
|
11
11
|
/** Reactive current mode, including the client default before Host settings arrive. */
|
|
12
12
|
readonly mode: SnapshotStore<TranscriptViewMode>;
|
|
13
|
-
/**
|
|
13
|
+
/** Reactive collapse timing, defaulting to completion until Host settings arrive. */
|
|
14
14
|
readonly collapseTiming: SnapshotStore<CollapseTiming>;
|
|
15
15
|
/**
|
|
16
16
|
* @param host - durable Chat settings scope.
|
|
@@ -25,7 +25,7 @@ export declare class TranscriptViewPolicy {
|
|
|
25
25
|
*/
|
|
26
26
|
setMode(mode: TranscriptViewMode): void;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Publish and persist collapse timing without changing the work-details mode.
|
|
29
29
|
* @param timing - immediate completion folding or deferred folding at the next input.
|
|
30
30
|
*/
|
|
31
31
|
setCollapseTiming(timing: CollapseTiming): void;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { Volatile, Context } from '@qilin-agent/kylin';
|
|
2
|
+
import type { ChatSettings, CollapseTiming, LinkOpening, PerformanceUsageMode } from './chat-settings.ts';
|
|
3
|
+
import z from '@qilin-agent/schemastery';
|
|
4
|
+
export { CHAT_SETTINGS_NAMESPACE, DEFAULT_LINK_OPENING, DEFAULT_PERFORMANCE_USAGE, DEFAULT_TRANSCRIPT_VIEW_MODE, LEGACY_EXPANDED_TRANSCRIPT_VIEW_MODE, LEGACY_TRANSCRIPT_VIEW_MODE, PERFORMANCE_USAGE_MODES, TRANSCRIPT_VIEW_FIELD, TRANSCRIPT_VIEW_MODES, type ChatSettings, type LinkOpening, type PerformanceUsageMode, type TranscriptViewMode, } from './chat-settings.ts';
|
|
5
|
+
/** Runtime preferences projected to the browser. */
|
|
6
|
+
export interface Config {
|
|
7
|
+
/** Completed turn transcript presentation. */
|
|
8
|
+
transcriptView: Volatile<ChatSettings['transcriptView']>;
|
|
9
|
+
/** When completed work details return to their historical presentation. */
|
|
10
|
+
collapseTiming: Volatile<CollapseTiming>;
|
|
11
|
+
/** Performance and usage detail level. */
|
|
12
|
+
performanceUsage: Volatile<PerformanceUsageMode>;
|
|
13
|
+
/** Default destination for Chat HTTP(S) links. */
|
|
14
|
+
linkOpening: Volatile<LinkOpening>;
|
|
15
|
+
}
|
|
16
|
+
/** Live preferences projected to the browser. */
|
|
17
|
+
export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
18
|
+
transcriptView: z<"compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "volatile-defined">;
|
|
19
|
+
collapseTiming: z<"completion" | "next-input", "completion" | "next-input", "volatile-defined">;
|
|
20
|
+
performanceUsage: z<"compact" | "detailed", "compact" | "detailed", "volatile-defined">;
|
|
21
|
+
linkOpening: z<"sidebar" | "new-tab", "sidebar" | "new-tab", "volatile-defined">;
|
|
22
|
+
}>>, Schemastery.ObjectT<NoInfer<{
|
|
23
|
+
transcriptView: z<"compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "compact" | "standard" | "detailed" | "verbose" | "normal" | "expanded", "volatile-defined">;
|
|
24
|
+
collapseTiming: z<"completion" | "next-input", "completion" | "next-input", "volatile-defined">;
|
|
25
|
+
performanceUsage: z<"compact" | "detailed", "compact" | "detailed", "volatile-defined">;
|
|
26
|
+
linkOpening: z<"sidebar" | "new-tab", "sidebar" | "new-tab", "volatile-defined">;
|
|
27
|
+
}>>, "plain">;
|
|
28
|
+
/** Host preferences are consumed through the configuration form projection.
|
|
29
|
+
* @param ctx Plugin context used for optional settings presentation.
|
|
30
|
+
*/
|
|
5
31
|
export declare function apply(ctx: Context): void;
|
|
6
32
|
//# sourceMappingURL=index.d.ts.map
|