@ahggg/dsh-side-chat 0.7.1 → 0.7.3
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.md +3 -3
- package/README.zh-CN.md +3 -3
- package/lib/client/apply.d.ts +0 -1
- package/lib/client/apply.js +0 -1
- package/lib/client/contracts.d.ts +0 -1
- package/lib/client/contracts.js +0 -1
- package/lib/client/index.d.ts +0 -1
- package/lib/client/index.js +0 -1
- package/lib/client/model-preference.d.ts +0 -1
- package/lib/client/model-preference.js +0 -1
- package/lib/client/panel/SelectionQuote.d.ts +0 -1
- package/lib/client/panel/SelectionQuote.js +0 -1
- package/lib/client/panel/SendIcon.d.ts +0 -1
- package/lib/client/panel/SendIcon.js +0 -1
- package/lib/client/panel/SideChatBody.d.ts +0 -1
- package/lib/client/panel/SideChatBody.js +0 -1
- package/lib/client/panel/SideChatErrorState.d.ts +0 -1
- package/lib/client/panel/SideChatErrorState.js +0 -1
- package/lib/client/panel/SideChatHeader.d.ts +0 -1
- package/lib/client/panel/SideChatHeader.js +0 -1
- package/lib/client/panel/SideChatModelSelect.d.ts +0 -1
- package/lib/client/panel/SideChatModelSelect.js +0 -1
- package/lib/client/panel/SideChatPanel.d.ts +0 -1
- package/lib/client/panel/SideChatPanel.js +0 -1
- package/lib/client/panel/StopIcon.d.ts +0 -1
- package/lib/client/panel/StopIcon.js +0 -1
- package/lib/client/panel/messages.d.ts +0 -1
- package/lib/client/panel/messages.js +0 -1
- package/lib/client/panel/use-auto-growing-textarea.d.ts +0 -1
- package/lib/client/panel/use-auto-growing-textarea.js +0 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.d.ts +0 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.js +26 -3
- package/lib/client/parent-composer/add-to-conversation.d.ts +15 -54
- package/lib/client/parent-composer/add-to-conversation.js +308 -63
- package/lib/client/parent-composer/annotation-persistence.d.ts +1 -2
- package/lib/client/parent-composer/annotation-persistence.js +43 -41
- package/lib/client/parent-composer/composer-reference.d.ts +81 -0
- package/lib/client/parent-composer/composer-reference.js +89 -0
- package/lib/client/parent-composer/referenced-conversation.d.ts +2 -3
- package/lib/client/parent-composer/referenced-conversation.js +36 -25
- package/lib/client/rc6/ArchivedConversation.d.ts +2 -3
- package/lib/client/rc6/ArchivedConversation.js +6 -5
- package/lib/client/rc6/Rc6SideChatOverlay.d.ts +0 -1
- package/lib/client/rc6/Rc6SideChatOverlay.js +12 -2
- package/lib/client/rc6/SideChatTool.d.ts +1 -2
- package/lib/client/rc6/SideChatTool.js +18 -9
- package/lib/client/rc6/context.d.ts +9 -3
- package/lib/client/rc6/context.js +0 -1
- package/lib/client/rc6/primitive-labels.d.ts +7 -0
- package/lib/client/rc6/primitive-labels.js +60 -0
- package/lib/client/rc6/remote-adapter.d.ts +0 -1
- package/lib/client/rc6/remote-adapter.js +4 -3
- package/lib/client/rc6/runtime-compat.d.ts +120 -0
- package/lib/client/rc6/runtime-compat.js +187 -0
- package/lib/client/rc6/sessions-adapter.d.ts +9 -4
- package/lib/client/rc6/sessions-adapter.js +74 -46
- package/lib/client/selection/ConversationAnnotationMarkers.d.ts +0 -1
- package/lib/client/selection/ConversationAnnotationMarkers.js +0 -1
- package/lib/client/selection/SelectionActions.d.ts +5 -2
- package/lib/client/selection/SelectionActions.js +66 -50
- package/lib/client/selection/selection-controller.d.ts +0 -1
- package/lib/client/selection/selection-controller.js +0 -1
- package/lib/client/selection/selection-limits.d.ts +0 -1
- package/lib/client/selection/selection-limits.js +0 -1
- package/lib/client/selection/selection-normalizer.d.ts +0 -1
- package/lib/client/selection/selection-normalizer.js +0 -1
- package/lib/client/side-chat-controller.d.ts +0 -1
- package/lib/client/side-chat-controller.js +0 -1
- package/lib/client.js +1173 -8744
- package/lib/host/archived-fork-service.d.ts +0 -1
- package/lib/host/archived-fork-service.js +71 -26
- package/lib/host/index.d.ts +0 -1
- package/lib/host/index.js +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/remote.d.ts +0 -1
- package/lib/remote.js +0 -1
- package/lib/shared/archived-wire.d.ts +0 -1
- package/lib/shared/archived-wire.js +0 -1
- package/lib/shared/constants.d.ts +0 -1
- package/lib/shared/constants.js +0 -1
- package/lib/shared/contracts.d.ts +0 -1
- package/lib/shared/contracts.js +0 -1
- package/lib/shared/error-codes.d.ts +0 -1
- package/lib/shared/error-codes.js +0 -1
- package/lib/shared/observable.d.ts +0 -1
- package/lib/shared/observable.js +0 -1
- package/lib/typert.d.ts +0 -1
- package/lib/typert.js +64 -51
- package/package.json +60 -38
- package/lib/client/apply.d.ts.map +0 -1
- package/lib/client/apply.js.map +0 -1
- package/lib/client/contracts.d.ts.map +0 -1
- package/lib/client/contracts.js.map +0 -1
- package/lib/client/index.d.ts.map +0 -1
- package/lib/client/index.js.map +0 -1
- package/lib/client/model-preference.d.ts.map +0 -1
- package/lib/client/model-preference.js.map +0 -1
- package/lib/client/panel/SelectionQuote.d.ts.map +0 -1
- package/lib/client/panel/SelectionQuote.js.map +0 -1
- package/lib/client/panel/SendIcon.d.ts.map +0 -1
- package/lib/client/panel/SendIcon.js.map +0 -1
- package/lib/client/panel/SideChatBody.d.ts.map +0 -1
- package/lib/client/panel/SideChatBody.js.map +0 -1
- package/lib/client/panel/SideChatErrorState.d.ts.map +0 -1
- package/lib/client/panel/SideChatErrorState.js.map +0 -1
- package/lib/client/panel/SideChatHeader.d.ts.map +0 -1
- package/lib/client/panel/SideChatHeader.js.map +0 -1
- package/lib/client/panel/SideChatModelSelect.d.ts.map +0 -1
- package/lib/client/panel/SideChatModelSelect.js.map +0 -1
- package/lib/client/panel/SideChatPanel.d.ts.map +0 -1
- package/lib/client/panel/SideChatPanel.js.map +0 -1
- package/lib/client/panel/StopIcon.d.ts.map +0 -1
- package/lib/client/panel/StopIcon.js.map +0 -1
- package/lib/client/panel/messages.d.ts.map +0 -1
- package/lib/client/panel/messages.js.map +0 -1
- package/lib/client/panel/use-auto-growing-textarea.d.ts.map +0 -1
- package/lib/client/panel/use-auto-growing-textarea.js.map +0 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.d.ts.map +0 -1
- package/lib/client/parent-composer/ParentConversationAnnotations.js.map +0 -1
- package/lib/client/parent-composer/add-to-conversation.d.ts.map +0 -1
- package/lib/client/parent-composer/add-to-conversation.js.map +0 -1
- package/lib/client/parent-composer/annotation-persistence.d.ts.map +0 -1
- package/lib/client/parent-composer/annotation-persistence.js.map +0 -1
- package/lib/client/parent-composer/referenced-conversation.d.ts.map +0 -1
- package/lib/client/parent-composer/referenced-conversation.js.map +0 -1
- package/lib/client/rc6/ArchivedConversation.d.ts.map +0 -1
- package/lib/client/rc6/ArchivedConversation.js.map +0 -1
- package/lib/client/rc6/Rc6SideChatOverlay.d.ts.map +0 -1
- package/lib/client/rc6/Rc6SideChatOverlay.js.map +0 -1
- package/lib/client/rc6/SideChatTool.d.ts.map +0 -1
- package/lib/client/rc6/SideChatTool.js.map +0 -1
- package/lib/client/rc6/context.d.ts.map +0 -1
- package/lib/client/rc6/context.js.map +0 -1
- package/lib/client/rc6/remote-adapter.d.ts.map +0 -1
- package/lib/client/rc6/remote-adapter.js.map +0 -1
- package/lib/client/rc6/sessions-adapter.d.ts.map +0 -1
- package/lib/client/rc6/sessions-adapter.js.map +0 -1
- package/lib/client/selection/ConversationAnnotationMarkers.d.ts.map +0 -1
- package/lib/client/selection/ConversationAnnotationMarkers.js.map +0 -1
- package/lib/client/selection/SelectionActions.d.ts.map +0 -1
- package/lib/client/selection/SelectionActions.js.map +0 -1
- package/lib/client/selection/selection-controller.d.ts.map +0 -1
- package/lib/client/selection/selection-controller.js.map +0 -1
- package/lib/client/selection/selection-limits.d.ts.map +0 -1
- package/lib/client/selection/selection-limits.js.map +0 -1
- package/lib/client/selection/selection-normalizer.d.ts.map +0 -1
- package/lib/client/selection/selection-normalizer.js.map +0 -1
- package/lib/client/side-chat-controller.d.ts.map +0 -1
- package/lib/client/side-chat-controller.js.map +0 -1
- package/lib/client.js.map +0 -1
- package/lib/host/archived-fork-service.d.ts.map +0 -1
- package/lib/host/archived-fork-service.js.map +0 -1
- package/lib/host/index.d.ts.map +0 -1
- package/lib/host/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/remote.d.ts.map +0 -1
- package/lib/remote.js.map +0 -1
- package/lib/shared/archived-wire.d.ts.map +0 -1
- package/lib/shared/archived-wire.js.map +0 -1
- package/lib/shared/constants.d.ts.map +0 -1
- package/lib/shared/constants.js.map +0 -1
- package/lib/shared/contracts.d.ts.map +0 -1
- package/lib/shared/contracts.js.map +0 -1
- package/lib/shared/error-codes.d.ts.map +0 -1
- package/lib/shared/error-codes.js.map +0 -1
- package/lib/shared/observable.d.ts.map +0 -1
- package/lib/shared/observable.js.map +0 -1
- package/lib/typert.d.ts.map +0 -1
- package/lib/typert.js.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
export declare const LEGACY_REFERENCE_PLACEHOLDER = "\uFFFC";
|
|
3
|
+
export interface ParentComposerOccurrence {
|
|
4
|
+
readonly occurrenceId: number;
|
|
5
|
+
readonly source: string;
|
|
6
|
+
readonly ref: string;
|
|
7
|
+
readonly offset: number;
|
|
8
|
+
/** Occupied projection length (display text through 0.1.1, clipboard text in 0.1.2). */
|
|
9
|
+
readonly length?: number;
|
|
10
|
+
/** Insert-time display label, present in current DSH input snapshots. */
|
|
11
|
+
readonly label?: string;
|
|
12
|
+
/** Draft-persistence projection cached by current DSH input snapshots. */
|
|
13
|
+
readonly clipboardText?: string;
|
|
14
|
+
readonly appearance?: 'session' | 'file' | 'folder';
|
|
15
|
+
}
|
|
16
|
+
export interface ParentComposerInputSnapshot {
|
|
17
|
+
readonly draft: string;
|
|
18
|
+
readonly draftRev: number;
|
|
19
|
+
readonly occurrences: readonly ParentComposerOccurrence[];
|
|
20
|
+
}
|
|
21
|
+
export interface ParentComposerSpan {
|
|
22
|
+
readonly start: number;
|
|
23
|
+
readonly end: number;
|
|
24
|
+
readonly draftRev: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ParentComposerInput {
|
|
27
|
+
readonly state: {
|
|
28
|
+
getSnapshot(): ParentComposerInputSnapshot;
|
|
29
|
+
subscribe?(listener: () => void): () => void;
|
|
30
|
+
};
|
|
31
|
+
/** DSH 0.1.2's Lexical editor projects each reference as one mutation coordinate. */
|
|
32
|
+
readonly referenceMode?: 'text' | 'lexical';
|
|
33
|
+
setDraft(text: string): void;
|
|
34
|
+
/** Atomic plain-text replacement supplied by Side Chat's scoped input-event adapter. */
|
|
35
|
+
replaceText?(text: string, span: ParentComposerSpan): boolean;
|
|
36
|
+
insertReference(reference: {
|
|
37
|
+
readonly source: string;
|
|
38
|
+
readonly ref: string;
|
|
39
|
+
readonly label: string;
|
|
40
|
+
readonly appearance?: 'session' | 'file' | 'folder';
|
|
41
|
+
readonly clipboardText: string;
|
|
42
|
+
}, span: ParentComposerSpan): boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface ParentConversationService {
|
|
45
|
+
readonly input: {
|
|
46
|
+
for(scope: Context): ParentComposerInput;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface SelectionReferenceSource {
|
|
50
|
+
readonly trigger: '@';
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly order: number;
|
|
53
|
+
candidates(): Promise<readonly never[]>;
|
|
54
|
+
onPick(): undefined;
|
|
55
|
+
readonly codec: {
|
|
56
|
+
clipboardText(ref: string): string;
|
|
57
|
+
serialize(ref: string, signal: AbortSignal): Promise<string>;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export interface OccurrenceRange {
|
|
61
|
+
readonly start: number;
|
|
62
|
+
readonly end: number;
|
|
63
|
+
}
|
|
64
|
+
export declare function referenceDisplayText(label: string): string;
|
|
65
|
+
/**
|
|
66
|
+
* Resolve one occurrence's occupied draft range across both DSH reference
|
|
67
|
+
* representations: current full `@label` text with `length`, and the legacy
|
|
68
|
+
* one-code-unit U+FFFC placeholder without it.
|
|
69
|
+
*/
|
|
70
|
+
export declare function occurrenceRange(snapshot: ParentComposerInputSnapshot, occurrence: ParentComposerOccurrence, expectedLabel: string): OccurrenceRange | undefined;
|
|
71
|
+
export declare function occurrenceMatchesDraft(snapshot: ParentComposerInputSnapshot, occurrence: ParentComposerOccurrence, expectedLabel: string): boolean;
|
|
72
|
+
/** Convert one published occurrence range to the host input machine's mutation coordinates. */
|
|
73
|
+
export declare function occurrenceEditSpan(input: ParentComposerInput, snapshot: ParentComposerInputSnapshot, occurrence: ParentComposerOccurrence, options?: {
|
|
74
|
+
readonly consumeFollowingSeparator?: boolean;
|
|
75
|
+
}): ParentComposerSpan | undefined;
|
|
76
|
+
/** Find the exact occurrence minted by one synchronous insertReference call. */
|
|
77
|
+
export declare function newlyInsertedOccurrence(before: ParentComposerInputSnapshot, after: ParentComposerInputSnapshot, source: string, ref: string): ParentComposerOccurrence | undefined;
|
|
78
|
+
/** Remove one occurrence's display range and, optionally, its separating ASCII gap. */
|
|
79
|
+
export declare function draftWithoutOccurrence(snapshot: ParentComposerInputSnapshot, occurrence: ParentComposerOccurrence, expectedLabel: string, options?: {
|
|
80
|
+
readonly consumeAdjacentSpace?: boolean;
|
|
81
|
+
}): string | undefined;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export const LEGACY_REFERENCE_PLACEHOLDER = '\uFFFC';
|
|
2
|
+
export function referenceDisplayText(label) {
|
|
3
|
+
return `@${label}`;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Resolve one occurrence's occupied draft range across both DSH reference
|
|
7
|
+
* representations: current full `@label` text with `length`, and the legacy
|
|
8
|
+
* one-code-unit U+FFFC placeholder without it.
|
|
9
|
+
*/
|
|
10
|
+
export function occurrenceRange(snapshot, occurrence, expectedLabel) {
|
|
11
|
+
const start = occurrence.offset;
|
|
12
|
+
if (!Number.isSafeInteger(start) || start < 0 || start > snapshot.draft.length)
|
|
13
|
+
return;
|
|
14
|
+
if (occurrence.length !== undefined
|
|
15
|
+
&& Number.isSafeInteger(occurrence.length)
|
|
16
|
+
&& occurrence.length > 0
|
|
17
|
+
&& start + occurrence.length <= snapshot.draft.length) {
|
|
18
|
+
return { start, end: start + occurrence.length };
|
|
19
|
+
}
|
|
20
|
+
if (snapshot.draft.startsWith(LEGACY_REFERENCE_PLACEHOLDER, start)) {
|
|
21
|
+
return { start, end: start + LEGACY_REFERENCE_PLACEHOLDER.length };
|
|
22
|
+
}
|
|
23
|
+
const display = referenceDisplayText(expectedLabel);
|
|
24
|
+
if (snapshot.draft.startsWith(display, start))
|
|
25
|
+
return { start, end: start + display.length };
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
export function occurrenceMatchesDraft(snapshot, occurrence, expectedLabel) {
|
|
29
|
+
const range = occurrenceRange(snapshot, occurrence, expectedLabel);
|
|
30
|
+
if (range === undefined)
|
|
31
|
+
return false;
|
|
32
|
+
const text = snapshot.draft.slice(range.start, range.end);
|
|
33
|
+
if (text === LEGACY_REFERENCE_PLACEHOLDER || text === referenceDisplayText(expectedLabel))
|
|
34
|
+
return true;
|
|
35
|
+
return occurrence.label === expectedLabel
|
|
36
|
+
&& occurrence.clipboardText !== undefined
|
|
37
|
+
&& text === occurrence.clipboardText;
|
|
38
|
+
}
|
|
39
|
+
/** Convert one published occurrence range to the host input machine's mutation coordinates. */
|
|
40
|
+
export function occurrenceEditSpan(input, snapshot, occurrence, options = {}) {
|
|
41
|
+
const range = occurrenceRange(snapshot, occurrence, occurrence.label ?? '');
|
|
42
|
+
if (range === undefined)
|
|
43
|
+
return;
|
|
44
|
+
let start = range.start;
|
|
45
|
+
let end = range.end;
|
|
46
|
+
if (input.referenceMode === 'lexical') {
|
|
47
|
+
if (occurrence.length === undefined)
|
|
48
|
+
return;
|
|
49
|
+
start = occurrence.offset;
|
|
50
|
+
for (const candidate of [...snapshot.occurrences].sort((left, right) => left.offset - right.offset)) {
|
|
51
|
+
if (candidate.occurrenceId === occurrence.occurrenceId)
|
|
52
|
+
break;
|
|
53
|
+
if (candidate.offset > occurrence.offset || candidate.length === undefined)
|
|
54
|
+
return;
|
|
55
|
+
start -= candidate.length - 1;
|
|
56
|
+
}
|
|
57
|
+
end = start + 1;
|
|
58
|
+
}
|
|
59
|
+
if (options.consumeFollowingSeparator === true) {
|
|
60
|
+
const tail = snapshot.draft.slice(range.end);
|
|
61
|
+
if (tail.startsWith('\n\n'))
|
|
62
|
+
end += 2;
|
|
63
|
+
else if (tail.startsWith('\n') || tail.startsWith(' '))
|
|
64
|
+
end += 1;
|
|
65
|
+
}
|
|
66
|
+
return { start, end, draftRev: snapshot.draftRev };
|
|
67
|
+
}
|
|
68
|
+
/** Find the exact occurrence minted by one synchronous insertReference call. */
|
|
69
|
+
export function newlyInsertedOccurrence(before, after, source, ref) {
|
|
70
|
+
const previousIds = new Set(before.occurrences.map(occurrence => occurrence.occurrenceId));
|
|
71
|
+
const inserted = after.occurrences.filter(occurrence => !previousIds.has(occurrence.occurrenceId)
|
|
72
|
+
&& occurrence.source === source
|
|
73
|
+
&& occurrence.ref === ref);
|
|
74
|
+
return inserted.length === 1 ? inserted[0] : undefined;
|
|
75
|
+
}
|
|
76
|
+
/** Remove one occurrence's display range and, optionally, its separating ASCII gap. */
|
|
77
|
+
export function draftWithoutOccurrence(snapshot, occurrence, expectedLabel, options = {}) {
|
|
78
|
+
const range = occurrenceRange(snapshot, occurrence, expectedLabel);
|
|
79
|
+
if (range === undefined)
|
|
80
|
+
return;
|
|
81
|
+
let { start, end } = range;
|
|
82
|
+
if (options.consumeAdjacentSpace === true) {
|
|
83
|
+
if (snapshot.draft[end] === ' ')
|
|
84
|
+
end += 1;
|
|
85
|
+
else if (start > 0 && snapshot.draft[start - 1] === ' ')
|
|
86
|
+
start -= 1;
|
|
87
|
+
}
|
|
88
|
+
return snapshot.draft.slice(0, start) + snapshot.draft.slice(end);
|
|
89
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ConversationNode } from '@deepseek-ai/dsh-client-
|
|
1
|
+
import type { ConversationNode } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
2
2
|
import type { SessionId } from '../../shared/contracts.js';
|
|
3
|
-
import type { ParentComposerInput, SelectionReferenceSource } from './
|
|
3
|
+
import type { ParentComposerInput, SelectionReferenceSource } from './composer-reference.js';
|
|
4
4
|
export declare const SIDE_CHAT_CONVERSATION_REFERENCE_SOURCE = "dsh-side-chat-conversation";
|
|
5
5
|
export interface ReferencedConversationMessage {
|
|
6
6
|
readonly role: 'user' | 'assistant';
|
|
@@ -32,4 +32,3 @@ export declare function parseReferencedConversationPrompt(text: string): ParsedR
|
|
|
32
32
|
export declare function addReferencedSideChatToConversation(input: ParentComposerInput, reference: ReferencedSideChatConversation): boolean;
|
|
33
33
|
/** Reference codec used by the native composer chip and submit pipeline. */
|
|
34
34
|
export declare const sideChatConversationReferenceSource: SelectionReferenceSource;
|
|
35
|
-
//# sourceMappingURL=referenced-conversation.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { draftWithoutOccurrence, newlyInsertedOccurrence, occurrenceEditSpan, } from './composer-reference.js';
|
|
1
2
|
export const SIDE_CHAT_CONVERSATION_REFERENCE_SOURCE = 'dsh-side-chat-conversation';
|
|
2
3
|
const OPEN_TAG = '<referenced_conversation>';
|
|
3
4
|
const CLOSE_TAG = '</referenced_conversation>';
|
|
@@ -19,7 +20,7 @@ function visibleContentText(content) {
|
|
|
19
20
|
}
|
|
20
21
|
function assistantText(node) {
|
|
21
22
|
return node.blocks
|
|
22
|
-
.flatMap(block => block.kind === 'text' ? [block.text] : [])
|
|
23
|
+
.flatMap((block) => block.kind === 'text' ? [block.text] : [])
|
|
23
24
|
.join('\n')
|
|
24
25
|
.trim();
|
|
25
26
|
}
|
|
@@ -138,29 +139,29 @@ function matchingOccurrences(snapshot, reference) {
|
|
|
138
139
|
}
|
|
139
140
|
});
|
|
140
141
|
}
|
|
141
|
-
function occurrenceLength(occurrence) {
|
|
142
|
-
if (occurrence.length !== undefined && Number.isSafeInteger(occurrence.length) && occurrence.length > 0) {
|
|
143
|
-
return occurrence.length;
|
|
144
|
-
}
|
|
145
|
-
try {
|
|
146
|
-
return `@${decodeReferencedConversation(occurrence.ref).title}`.length;
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
return 1;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
142
|
function removeOccurrence(input, occurrenceId) {
|
|
153
143
|
const snapshot = input.state.getSnapshot();
|
|
154
144
|
const occurrence = snapshot.occurrences.find(candidate => candidate.occurrenceId === occurrenceId);
|
|
155
145
|
if (occurrence === undefined)
|
|
156
146
|
return;
|
|
157
|
-
let
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
147
|
+
let title;
|
|
148
|
+
try {
|
|
149
|
+
title = decodeReferencedConversation(occurrence.ref).title;
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (input.referenceMode === 'lexical' && input.replaceText !== undefined) {
|
|
155
|
+
const span = occurrenceEditSpan(input, snapshot, occurrence, {
|
|
156
|
+
consumeFollowingSeparator: true,
|
|
157
|
+
});
|
|
158
|
+
if (span !== undefined)
|
|
159
|
+
input.replaceText('', span);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const draft = draftWithoutOccurrence(snapshot, occurrence, title, { consumeAdjacentSpace: true });
|
|
163
|
+
if (draft !== undefined)
|
|
164
|
+
input.setDraft(draft);
|
|
164
165
|
}
|
|
165
166
|
/** Insert or refresh one Side Chat label without duplicating an older snapshot. */
|
|
166
167
|
export function addReferencedSideChatToConversation(input, reference) {
|
|
@@ -171,19 +172,30 @@ export function addReferencedSideChatToConversation(input, reference) {
|
|
|
171
172
|
const encoded = encodeReferencedConversation(reference);
|
|
172
173
|
if (existing.some(occurrence => occurrence.ref === encoded))
|
|
173
174
|
return true;
|
|
175
|
+
const target = input.referenceMode === 'lexical' ? existing[0] : undefined;
|
|
176
|
+
const span = target === undefined
|
|
177
|
+
? { start: 0, end: 0, draftRev: before.draftRev }
|
|
178
|
+
: occurrenceEditSpan(input, before, target);
|
|
179
|
+
if (span === undefined)
|
|
180
|
+
return false;
|
|
174
181
|
const inserted = input.insertReference({
|
|
175
182
|
source: SIDE_CHAT_CONVERSATION_REFERENCE_SOURCE,
|
|
176
183
|
ref: encoded,
|
|
177
184
|
label: reference.title,
|
|
178
185
|
appearance: 'session',
|
|
179
186
|
clipboardText: `@${reference.title}`,
|
|
180
|
-
},
|
|
181
|
-
start: 0,
|
|
182
|
-
end: 0,
|
|
183
|
-
draftRev: before.draftRev,
|
|
184
|
-
});
|
|
187
|
+
}, span);
|
|
185
188
|
if (!inserted)
|
|
186
189
|
return false;
|
|
190
|
+
if (input.referenceMode === 'lexical') {
|
|
191
|
+
const after = input.state.getSnapshot();
|
|
192
|
+
const occurrence = newlyInsertedOccurrence(before, after, SIDE_CHAT_CONVERSATION_REFERENCE_SOURCE, encoded);
|
|
193
|
+
if (occurrence === undefined)
|
|
194
|
+
return false;
|
|
195
|
+
for (const duplicate of existing.slice(1))
|
|
196
|
+
removeOccurrence(input, duplicate.occurrenceId);
|
|
197
|
+
return matchingOccurrences(input.state.getSnapshot(), reference).length === 1;
|
|
198
|
+
}
|
|
187
199
|
for (const occurrence of existing)
|
|
188
200
|
removeOccurrence(input, occurrence.occurrenceId);
|
|
189
201
|
return true;
|
|
@@ -204,4 +216,3 @@ export const sideChatConversationReferenceSource = {
|
|
|
204
216
|
},
|
|
205
217
|
},
|
|
206
218
|
};
|
|
207
|
-
//# sourceMappingURL=referenced-conversation.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type { SessionFace } from '@deepseek-ai/dsh-client-runtime/client';
|
|
3
2
|
import type { ConversationSelection } from '../../shared/contracts.js';
|
|
4
3
|
import type { SideChatController } from '../side-chat-controller.js';
|
|
4
|
+
import type { SideChatConversationFace } from './runtime-compat.js';
|
|
5
5
|
/** Functional rc.6 conversation surface bound to a non-current child Session. */
|
|
6
6
|
export declare function ArchivedConversation({ face, inheritedThroughSeq, controller, selection, locale, cwd, modelControl, }: {
|
|
7
|
-
readonly face:
|
|
7
|
+
readonly face: SideChatConversationFace;
|
|
8
8
|
readonly inheritedThroughSeq: number;
|
|
9
9
|
readonly controller: SideChatController;
|
|
10
10
|
readonly selection?: ConversationSelection;
|
|
@@ -12,4 +12,3 @@ export declare function ArchivedConversation({ face, inheritedThroughSeq, contro
|
|
|
12
12
|
readonly cwd?: string | undefined;
|
|
13
13
|
readonly modelControl?: ReactNode;
|
|
14
14
|
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
//# sourceMappingURL=ArchivedConversation.d.ts.map
|
|
@@ -7,6 +7,7 @@ import { SendIcon } from '../panel/SendIcon.js';
|
|
|
7
7
|
import { StopIcon } from '../panel/StopIcon.js';
|
|
8
8
|
import { useAutoGrowingTextarea } from '../panel/use-auto-growing-textarea.js';
|
|
9
9
|
import { RunningToolCard, ToolBlockCard, ToolCard, } from './SideChatTool.js';
|
|
10
|
+
import { MARKDOWN_LABELS } from './primitive-labels.js';
|
|
10
11
|
function stringify(value) {
|
|
11
12
|
if (typeof value === 'string')
|
|
12
13
|
return value;
|
|
@@ -87,8 +88,9 @@ function ReasoningRow({ text, running, locale }) {
|
|
|
87
88
|
function AssistantBlocks({ blocks, streaming = false, projectedToolCallIds, unprojectedToolState = 'pending', cwd, locale }) {
|
|
88
89
|
return _jsx(_Fragment, { children: blocks.map((block, index) => {
|
|
89
90
|
const key = `${block.kind}-${String(index)}`;
|
|
90
|
-
if (block.kind === 'text')
|
|
91
|
-
return _jsx(MarkdownText, { text: block.text, streaming: streaming }, key);
|
|
91
|
+
if (block.kind === 'text') {
|
|
92
|
+
return _jsx(MarkdownText, { text: block.text, streaming: streaming, labels: MARKDOWN_LABELS }, key);
|
|
93
|
+
}
|
|
92
94
|
if (block.kind === 'reasoning') {
|
|
93
95
|
return (_jsx(ReasoningRow, { text: block.text, running: streaming && index === blocks.length - 1, locale: locale }, key));
|
|
94
96
|
}
|
|
@@ -133,10 +135,10 @@ function MessageRow({ node, projectedToolCallIds, cwd, locale }) {
|
|
|
133
135
|
return _jsxs("details", { className: "dsh-side-chat-turn-notice", children: [_jsx("summary", { children: node.type }), _jsx("pre", { children: stringify(node.data) })] });
|
|
134
136
|
}
|
|
135
137
|
function ApprovalCard({ wait, onRespond, }) {
|
|
136
|
-
return (_jsxs("section", { className: "dsh-side-chat-interaction", "aria-label": "Tool approval required", children: [_jsxs("strong", { children: ["Allow tool: ", wait.
|
|
138
|
+
return (_jsxs("section", { className: "dsh-side-chat-interaction", "aria-label": "Tool approval required", children: [_jsxs("strong", { children: ["Allow tool: ", wait.toolName, "?"] }), wait.reason !== undefined && _jsx("p", { children: wait.reason }), _jsxs("div", { className: "dsh-side-chat-interaction-actions", children: [_jsx("button", { type: "button", onClick: () => { onRespond('decline'); }, children: "Decline" }), _jsx("button", { type: "button", onClick: () => { onRespond('approve'); }, children: "Allow once" })] })] }));
|
|
137
139
|
}
|
|
138
140
|
function QuestionCard({ wait, onRespond, }) {
|
|
139
|
-
const questions = wait.
|
|
141
|
+
const questions = wait.questions;
|
|
140
142
|
const [answers, setAnswers] = useState(() => Object.fromEntries(questions.map(question => [question.id, { selected: [], custom: '' }])));
|
|
141
143
|
const update = (id, answer) => {
|
|
142
144
|
setAnswers(current => ({ ...current, [id]: answer }));
|
|
@@ -227,4 +229,3 @@ export function ArchivedConversation({ face, inheritedThroughSeq, controller, se
|
|
|
227
229
|
}
|
|
228
230
|
} }), _jsxs("div", { className: "dsh-side-chat-composer-actions", children: [modelControl, snapshot.running ? (_jsx("button", { type: "button", className: "dsh-side-chat-stop-button", "aria-label": "Stop generating", title: "Stop generating", onClick: () => { void controller.cancel(); }, children: _jsx(StopIcon, {}) })) : (_jsx("button", { type: "submit", className: "dsh-side-chat-send-button", "aria-label": "Send", disabled: sending || draft.trim().length === 0, children: _jsx(SendIcon, {}) }))] })] })] }));
|
|
229
231
|
}
|
|
230
|
-
//# sourceMappingURL=ArchivedConversation.js.map
|
|
@@ -359,7 +359,18 @@ export function Rc6SideChatOverlay({ controller, sessions, }) {
|
|
|
359
359
|
}
|
|
360
360
|
annotationEditing.current = false;
|
|
361
361
|
setEditingAnnotation(null);
|
|
362
|
-
}, onAnnotationEditorChange: (open) => { annotationEditing.current = open; },
|
|
362
|
+
}, onAnnotationEditorChange: (open) => { annotationEditing.current = open; }, onRemoveAnnotation: () => {
|
|
363
|
+
try {
|
|
364
|
+
if (!sessions.removeConversationAnnotation(editingAnnotation.annotationIndex)) {
|
|
365
|
+
sessions.notify({ kind: 'warning', text: 'Could not remove the annotation.' });
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
catch {
|
|
369
|
+
sessions.notify({ kind: 'warning', text: 'Could not remove the annotation.' });
|
|
370
|
+
}
|
|
371
|
+
annotationEditing.current = false;
|
|
372
|
+
setEditingAnnotation(null);
|
|
373
|
+
}, onMoreDetails: () => { }, onAskInSideChat: () => { }, onDismiss: () => {
|
|
363
374
|
annotationEditing.current = false;
|
|
364
375
|
setEditingAnnotation(null);
|
|
365
376
|
} }, `annotation:${String(editingAnnotation.annotationIndex)}`)), state.phase !== 'closed' && (_jsx(SideChatPanel, { state: state, locale: locale, ...childFace === undefined || inheritedThroughSeq === undefined
|
|
@@ -371,4 +382,3 @@ export function Rc6SideChatOverlay({ controller, sessions, }) {
|
|
|
371
382
|
void sessions.openSession(state.parentSessionId);
|
|
372
383
|
}, onAddToConversation: addToConversation, addToConversationDisabled: addToConversationDisabled, onRemoveSelection: () => { controller.clearSelection(); } }))] }));
|
|
373
384
|
}
|
|
374
|
-
//# sourceMappingURL=Rc6SideChatOverlay.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RunningToolCall, ToolCallBlock } from '@deepseek-ai/dsh-client-runtime/client';
|
|
2
1
|
import type { ContentBlock } from '@deepseek-ai/dsh-api-remotes/client';
|
|
2
|
+
import type { RunningToolCall, ToolCallBlock } from './runtime-compat.js';
|
|
3
3
|
export type ToolState = 'pending' | 'running' | 'success' | 'error' | 'interrupted';
|
|
4
4
|
export declare function toolOutputText(content: readonly ContentBlock[]): string;
|
|
5
5
|
export declare function ToolCard({ callId, name, argsRaw, state, output, callView, resultView, cwd, }: {
|
|
@@ -20,4 +20,3 @@ export declare function RunningToolCard({ call, cwd }: {
|
|
|
20
20
|
readonly call: RunningToolCall;
|
|
21
21
|
readonly cwd?: string | undefined;
|
|
22
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
//# sourceMappingURL=SideChatTool.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { CodeBlock, DiffBlock, DisclosureRow, IconApiOutline14, IconBrowseOutline16, IconCodeOutline16, IconEditOutline16, IconSearchOutline16, IconSparkle16, ReadBlock, SearchBlock, StateDot, TerminalBlock, WebBlock, } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
4
|
+
import { DIFF_LABELS, READ_LABELS, SEARCH_LABELS, TERMINAL_LABELS, WEB_LABELS, } from './primitive-labels.js';
|
|
4
5
|
const TOOL_VARIANTS = {
|
|
5
6
|
bash: 'bash',
|
|
6
7
|
pwsh: 'bash',
|
|
@@ -238,7 +239,7 @@ function validSearchCard(resultView) {
|
|
|
238
239
|
if (result['shape'] === 'paths') {
|
|
239
240
|
const paths = result['paths'];
|
|
240
241
|
return Array.isArray(paths) && paths.every((path) => typeof path === 'string')
|
|
241
|
-
? { kind: 'paths', paths, truncated, total }
|
|
242
|
+
? { kind: 'paths', paths, truncated, total, labels: SEARCH_LABELS }
|
|
242
243
|
: null;
|
|
243
244
|
}
|
|
244
245
|
if (result['shape'] !== 'matches' || !Array.isArray(result['files']))
|
|
@@ -261,7 +262,7 @@ function validSearchCard(resultView) {
|
|
|
261
262
|
}
|
|
262
263
|
files.push({ path, matches });
|
|
263
264
|
}
|
|
264
|
-
return { kind: 'matches', files, truncated, total };
|
|
265
|
+
return { kind: 'matches', files, truncated, total, labels: SEARCH_LABELS };
|
|
265
266
|
}
|
|
266
267
|
function validDiffs(view) {
|
|
267
268
|
const value = record(view);
|
|
@@ -289,7 +290,9 @@ function validWebCard(view) {
|
|
|
289
290
|
if (result['kind'] === 'fetch') {
|
|
290
291
|
const url = stringValue(result['url']);
|
|
291
292
|
const statusCode = numberValue(result['statusCode']);
|
|
292
|
-
return url === undefined || statusCode === undefined
|
|
293
|
+
return url === undefined || statusCode === undefined
|
|
294
|
+
? null
|
|
295
|
+
: { kind: 'fetch', url, statusCode, truncated, labels: WEB_LABELS };
|
|
293
296
|
}
|
|
294
297
|
if (result['kind'] !== 'search' || !Array.isArray(result['sources']))
|
|
295
298
|
return null;
|
|
@@ -310,7 +313,13 @@ function validWebCard(view) {
|
|
|
310
313
|
});
|
|
311
314
|
}
|
|
312
315
|
const answer = stringValue(result['answer']);
|
|
313
|
-
return {
|
|
316
|
+
return {
|
|
317
|
+
kind: 'search',
|
|
318
|
+
sources,
|
|
319
|
+
truncated,
|
|
320
|
+
labels: WEB_LABELS,
|
|
321
|
+
...(answer === undefined ? {} : { answer }),
|
|
322
|
+
};
|
|
314
323
|
}
|
|
315
324
|
function genericBody(variant, argsRaw) {
|
|
316
325
|
if (argsRaw === '' || argsRaw === '{}')
|
|
@@ -362,13 +371,13 @@ export function ToolCard({ callId, name, argsRaw, state, output, callView, resul
|
|
|
362
371
|
return (_jsxs("section", { className: "dsh-side-chat-tool", "data-call-id": callId, "data-state": visualState, "data-expanded": open || undefined, children: [status !== null && _jsx("span", { className: "dsh-side-chat-tool-visually-hidden", children: status }), _jsx(DisclosureRow, { rowClassName: "dsh-side-chat-tool-row", leadingClassName: "dsh-side-chat-tool-leading", titleClassName: "dsh-side-chat-tool-title", chevronClassName: "dsh-side-chat-tool-chevron", icon: leadingFor(visualState, variantIcon(variant)), title: toolTitle(name, variant), open: open, expandable: expandable, expandOnRowClick: true, keepContentWhenOpen: true, onToggle: () => { setExpanded(current => !current); }, collapsedContent: summaryText !== '' && (_jsxs(_Fragment, { children: [_jsx("span", { className: "dsh-side-chat-tool-separator", "aria-hidden": "true" }), _jsx("span", { className: failureLine === null
|
|
363
372
|
? 'dsh-side-chat-tool-summary'
|
|
364
373
|
: 'dsh-side-chat-tool-summary dsh-side-chat-tool-error-summary', children: summaryText })] })), children: _jsx("div", { className: "dsh-side-chat-tool-body-wrap", children: terminal !== null
|
|
365
|
-
? (_jsx(TerminalBlock, { command: terminal.command, cwd: terminal.cwd, output: terminal.output, exitCode: terminal.exitCode, signal: terminal.signal, running: terminal.running, maxLines: Infinity, className: "dsh-side-chat-tool-terminal" }))
|
|
374
|
+
? (_jsx(TerminalBlock, { command: terminal.command, cwd: terminal.cwd, output: terminal.output, exitCode: terminal.exitCode, signal: terminal.signal, running: terminal.running, maxLines: Infinity, className: "dsh-side-chat-tool-terminal", labels: TERMINAL_LABELS }))
|
|
366
375
|
: read !== null
|
|
367
|
-
? _jsx(ReadBlock, { ...read, maxLines: 8, className: "dsh-side-chat-tool-read" })
|
|
376
|
+
? _jsx(ReadBlock, { ...read, labels: READ_LABELS, maxLines: 8, className: "dsh-side-chat-tool-read" })
|
|
368
377
|
: search !== null
|
|
369
378
|
? _jsx(SearchBlock, { ...search, maxLines: 8, className: "dsh-side-chat-tool-search" })
|
|
370
379
|
: diffs !== null
|
|
371
|
-
? _jsx(DiffBlock, { diffs: diffs, maxLines: 8, className: "dsh-side-chat-tool-diff" })
|
|
380
|
+
? _jsx(DiffBlock, { diffs: diffs, labels: DIFF_LABELS, maxLines: 8, className: "dsh-side-chat-tool-diff" })
|
|
372
381
|
: web !== null
|
|
373
382
|
? _jsx(WebBlock, { ...web, className: "dsh-side-chat-tool-web" })
|
|
374
383
|
: code !== undefined
|
|
@@ -382,14 +391,14 @@ function resultState(node, output) {
|
|
|
382
391
|
return /\b(?:aborted|cancelled|canceled)\b/iu.test(identity) ? 'interrupted' : 'error';
|
|
383
392
|
}
|
|
384
393
|
export function ToolBlockCard({ block, cwd }) {
|
|
394
|
+
const presentation = block;
|
|
385
395
|
const settled = 'kind' in block;
|
|
386
396
|
const output = settled ? toolOutputText(block.content) : undefined;
|
|
387
397
|
const state = settled ? resultState(block, output ?? '') : 'running';
|
|
388
398
|
const name = settled ? block.call?.name ?? block.callId : block.name;
|
|
389
399
|
const argsRaw = settled ? block.call?.argsRaw ?? '{}' : block.argsRaw;
|
|
390
|
-
return (_jsxs("div", { className: "dsh-side-chat-tool-branch", children: [_jsx(ToolCard, { callId: block.callId, name: name, argsRaw: argsRaw, state: state, output: output, callView:
|
|
400
|
+
return (_jsxs("div", { className: "dsh-side-chat-tool-branch", children: [_jsx(ToolCard, { callId: block.callId, name: name, argsRaw: argsRaw, state: state, output: output, callView: presentation.callView, resultView: settled ? presentation.resultView : null, cwd: cwd }), block.subCalls.length > 0 && (_jsx("div", { className: "dsh-side-chat-tool-subcalls", "data-subcalls": true, children: block.subCalls.map(child => _jsx(ToolBlockCard, { block: child, cwd: cwd }, child.callId)) }))] }));
|
|
391
401
|
}
|
|
392
402
|
export function RunningToolCard({ call, cwd }) {
|
|
393
403
|
return _jsx(ToolBlockCard, { block: call, cwd: cwd });
|
|
394
404
|
}
|
|
395
|
-
//# sourceMappingURL=SideChatTool.js.map
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import type { ClientRemote } from '@deepseek-ai/dsh-api-remotes/client';
|
|
3
|
-
import type { ISessions
|
|
3
|
+
import type { ISessions } from '@deepseek-ai/dsh-api-session-controller/client';
|
|
4
|
+
import type { UiConversation } from '@deepseek-ai/dsh-client-ui-conversation/client';
|
|
4
5
|
import type { ModelDirectoryResolver } from '@deepseek-ai/dsh-client-ui-model-selection/client';
|
|
6
|
+
import type { SlotRegistry } from '@deepseek-ai/dsh-client-ui-renderer/client';
|
|
7
|
+
import type { UiSession } from '@deepseek-ai/dsh-client-ui-session/client';
|
|
5
8
|
import type { ParentConversationService, SelectionReferenceSource } from '../parent-composer/add-to-conversation.js';
|
|
6
9
|
/** Browser-only Cordis view for a package that also compiles the Host half. */
|
|
7
|
-
export type Rc6ClientContext = Omit<Context, 'conversation' | 'inputTriggers' | 'modelDirectories' | 'remote' | 'sessions' | 'slots'> & {
|
|
10
|
+
export type Rc6ClientContext = Omit<Context, 'conversation' | 'inputTriggers' | 'modelDirectories' | 'remote' | 'sessions' | 'slots' | 'uiConversation' | 'uiSession'> & {
|
|
8
11
|
readonly conversation: ParentConversationService;
|
|
9
12
|
readonly inputTriggers: {
|
|
10
13
|
registerSource(source: SelectionReferenceSource): () => void;
|
|
@@ -13,5 +16,8 @@ export type Rc6ClientContext = Omit<Context, 'conversation' | 'inputTriggers' |
|
|
|
13
16
|
readonly remote: ClientRemote;
|
|
14
17
|
readonly sessions: ISessions;
|
|
15
18
|
readonly slots: SlotRegistry;
|
|
19
|
+
/** Added by DSH 0.1.2; absent on the monolithic 0.1.0/0.1.1 runtime. */
|
|
20
|
+
readonly uiConversation?: Pick<UiConversation, 'binding'>;
|
|
21
|
+
/** Added by DSH 0.1.2; absent on the monolithic 0.1.0/0.1.1 runtime. */
|
|
22
|
+
readonly uiSession?: Pick<UiSession, 'pendingInteractions'>;
|
|
16
23
|
};
|
|
17
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DiffBlockLabels, MarkdownLabels, ReadBlockLabels, SearchBlockLabels, TerminalBlockLabels, WebBlockLabels } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
2
|
+
export declare const MARKDOWN_LABELS: MarkdownLabels;
|
|
3
|
+
export declare const TERMINAL_LABELS: TerminalBlockLabels;
|
|
4
|
+
export declare const READ_LABELS: ReadBlockLabels;
|
|
5
|
+
export declare const DIFF_LABELS: DiffBlockLabels;
|
|
6
|
+
export declare const SEARCH_LABELS: SearchBlockLabels;
|
|
7
|
+
export declare const WEB_LABELS: WebBlockLabels;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const hiddenLines = (hidden) => `Show ${String(hidden)} hidden line${hidden === 1 ? '' : 's'}`;
|
|
2
|
+
export const MARKDOWN_LABELS = {
|
|
3
|
+
code: { copyLabel: 'Copy', copiedLabel: 'Copied' },
|
|
4
|
+
footnotes: 'Footnotes',
|
|
5
|
+
};
|
|
6
|
+
export const TERMINAL_LABELS = {
|
|
7
|
+
signal: signal => `Signal ${signal}`,
|
|
8
|
+
exitCode: code => `Exit ${String(code)}`,
|
|
9
|
+
running: 'Running',
|
|
10
|
+
failed: 'Failed',
|
|
11
|
+
done: 'Done',
|
|
12
|
+
copy: 'Copy',
|
|
13
|
+
copied: 'Copied',
|
|
14
|
+
noOutput: 'No output',
|
|
15
|
+
collapseAria: 'Collapse command output',
|
|
16
|
+
collapse: 'Collapse',
|
|
17
|
+
expandAria: hiddenLines,
|
|
18
|
+
expand: hiddenLines,
|
|
19
|
+
};
|
|
20
|
+
export const READ_LABELS = {
|
|
21
|
+
window: (shown, total) => `Showing ${String(shown)} of ${String(total)} lines`,
|
|
22
|
+
copy: 'Copy',
|
|
23
|
+
copied: 'Copied',
|
|
24
|
+
collapseAria: 'Collapse file content',
|
|
25
|
+
expandAria: hiddenLines,
|
|
26
|
+
collapse: 'Collapse',
|
|
27
|
+
expand: hiddenLines,
|
|
28
|
+
};
|
|
29
|
+
export const DIFF_LABELS = {
|
|
30
|
+
copy: 'Copy',
|
|
31
|
+
copied: 'Copied',
|
|
32
|
+
collapseAria: 'Collapse diff',
|
|
33
|
+
expandAria: hiddenLines,
|
|
34
|
+
collapse: 'Collapse',
|
|
35
|
+
expand: hiddenLines,
|
|
36
|
+
files: count => `${String(count)} file${count === 1 ? '' : 's'}`,
|
|
37
|
+
};
|
|
38
|
+
export const SEARCH_LABELS = {
|
|
39
|
+
pathsSummary: (shown, total, truncated) => truncated
|
|
40
|
+
? `Showing ${String(shown)} of ${String(total)} paths`
|
|
41
|
+
: `${String(total)} path${total === 1 ? '' : 's'}`,
|
|
42
|
+
matchesSummary: (shown, total, files, truncated) => {
|
|
43
|
+
const summary = `${String(shown)} match${shown === 1 ? '' : 'es'} in ${String(files)} file${files === 1 ? '' : 's'}`;
|
|
44
|
+
return truncated ? `${summary} (${String(total)} total)` : summary;
|
|
45
|
+
},
|
|
46
|
+
copy: 'Copy',
|
|
47
|
+
copied: 'Copied',
|
|
48
|
+
noResults: 'No results',
|
|
49
|
+
collapseAria: 'Collapse search results',
|
|
50
|
+
expandAria: hiddenLines,
|
|
51
|
+
collapse: 'Collapse',
|
|
52
|
+
expand: hiddenLines,
|
|
53
|
+
};
|
|
54
|
+
export const WEB_LABELS = {
|
|
55
|
+
noResults: 'No results',
|
|
56
|
+
sourcesTruncated: 'Sources truncated',
|
|
57
|
+
http: 'HTTP',
|
|
58
|
+
contentTruncated: 'Content truncated',
|
|
59
|
+
markdown: MARKDOWN_LABELS,
|
|
60
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import TYPERT_REMOTE from '../../remote.js';
|
|
2
2
|
function remoteFailure(error) {
|
|
3
|
+
const code = error.code;
|
|
4
|
+
const badRequest = code === 'bad-request' || code === 'gateway/bad-request';
|
|
3
5
|
return {
|
|
4
|
-
code:
|
|
6
|
+
code: badRequest ? 'invalid_request' : 'transport_error',
|
|
5
7
|
message: error.message || 'The Side Chat RPC failed.',
|
|
6
|
-
recoverable:
|
|
8
|
+
recoverable: !badRequest,
|
|
7
9
|
};
|
|
8
10
|
}
|
|
9
11
|
export async function mountArchivedRemote(ctx) {
|
|
@@ -30,4 +32,3 @@ export async function mountArchivedRemote(ctx) {
|
|
|
30
32
|
dispose,
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
|
-
//# sourceMappingURL=remote-adapter.js.map
|