dsh-model-think-level 2.3.6 → 2.5.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/README.md +39 -0
- package/lib/camouflage-store.d.ts +55 -0
- package/lib/camouflage.d.ts +91 -0
- package/lib/client/AdvancedPane.d.ts +38 -0
- package/lib/client/AutoContinueController.d.ts +38 -0
- package/lib/client/CamouflageEditor.d.ts +100 -0
- package/lib/client/ConfigPane.d.ts +9 -1
- package/lib/client/HeadersEditor.d.ts +34 -1
- package/lib/client/HistoryCompatEditor.d.ts +67 -0
- package/lib/client/auto-continue-pref.d.ts +5 -2
- package/lib/client/auto-continue-rules.d.ts +33 -1
- package/lib/client/error-detail-pref.d.ts +18 -0
- package/lib/client/injection/auto-continue-run.d.ts +36 -4
- package/lib/client/injection/error-detail.d.ts +79 -0
- package/lib/client/injection/model-order-drag.d.ts +3 -1
- package/lib/client/locales.d.ts +70 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client.js +520 -40
- package/lib/client.js.map +4 -4
- package/lib/constants.d.ts +39 -0
- package/lib/headers-core.d.ts +27 -2
- package/lib/history-compat-store.d.ts +55 -0
- package/lib/history-compat.d.ts +98 -0
- package/lib/index.js +689 -98
- package/lib/index.js.map +4 -4
- package/package.json +13 -1
|
@@ -5,11 +5,15 @@
|
|
|
5
5
|
* The decision is {@link judgeTurnTail} (auto-continue-rules.ts); this module
|
|
6
6
|
* owns the OBSERVATION and the GUARDS around it:
|
|
7
7
|
*
|
|
8
|
-
* - Only the CURRENT session is watched
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* - Only the CURRENT session is watched. The one exception is an ending
|
|
9
|
+
* nobody answered: when the watcher first sees a session whose newest
|
|
10
|
+
* turn/end is a continuable failure with no user message or new run after
|
|
11
|
+
* it, that ending is judged once (within a day). A failure the user already
|
|
12
|
+
* moved past, or one older than the window, stays history — replaying old
|
|
12
13
|
* failures is exactly the mindless behaviour the switch must not have.
|
|
14
|
+
* - A page that loads into a session whose last turn failed yesterday does
|
|
15
|
+
* nothing — auto-continuing stale failures is exactly the mindless
|
|
16
|
+
* behaviour the switch must not have.
|
|
13
17
|
* - The durable `turn/end` is what is judged, not the running edge, so the
|
|
14
18
|
* evaluation waits briefly for the settlement to reach the event window.
|
|
15
19
|
* - Guards at send time: the switch still on, the turn still ended, nothing
|
|
@@ -43,6 +47,34 @@ export interface AutoContinueDeps {
|
|
|
43
47
|
export interface AutoContinueRunner {
|
|
44
48
|
/** Stop the poll, detach every listener and cancel every pending send. */
|
|
45
49
|
dispose: () => void;
|
|
50
|
+
/** What the in-session controller should render right now. */
|
|
51
|
+
status: () => AutoContinueStatus;
|
|
52
|
+
/** Subscribe to status changes; returns the disposer. */
|
|
53
|
+
subscribe: (listener: () => void) => () => void;
|
|
54
|
+
/** Stand down for THIS session: cancel the wait, hide the controller, stay quiet. */
|
|
55
|
+
stop: () => void;
|
|
56
|
+
/** Clear a stood-down chain so the next ending starts again at one. */
|
|
57
|
+
reset: () => void;
|
|
58
|
+
/** Skip the wait and reply now. */
|
|
59
|
+
resumeNow: () => void;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* One session's auto-continue chain, as the controller renders it.
|
|
63
|
+
* `idle` is never shown; the chip only exists while a chain is running.
|
|
64
|
+
*/
|
|
65
|
+
export interface AutoContinueStatus {
|
|
66
|
+
/** The watched session, undefined while nothing is open. */
|
|
67
|
+
readonly sessionId: string | undefined;
|
|
68
|
+
readonly phase: 'idle' | 'waiting' | 'sent' | 'exhausted';
|
|
69
|
+
/** Automatic replies already sent in THIS chain. */
|
|
70
|
+
readonly consecutive: number;
|
|
71
|
+
readonly maxRetries: number;
|
|
72
|
+
/** Epoch ms the pending reply fires at; 0 when no timer is armed. */
|
|
73
|
+
readonly nextSendAt: number;
|
|
74
|
+
/** The judged interruption, e.g. `RATE_LIMIT` or `max-tokens` (tooltip only). */
|
|
75
|
+
readonly detail: string;
|
|
76
|
+
/** Whether the user stopped this session's chain. */
|
|
77
|
+
readonly muted: boolean;
|
|
46
78
|
}
|
|
47
79
|
/**
|
|
48
80
|
* Build the watcher. The poll runs for the fiber's whole life (memory-only
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The failure-detail seat: re-reads the session's durable events and puts a
|
|
3
|
+
* quiet 「查看详情」 button at the end of each OFFICIAL failure row.
|
|
4
|
+
*
|
|
5
|
+
* Why the seat exists at all: the Chat row for a failed turn is drawn from a
|
|
6
|
+
* projection that deliberately blanks the provider message for `AUTH`
|
|
7
|
+
* (`displayFailure()` in `dsh-client-ui-trajectory` — "safe for Chat"), and the
|
|
8
|
+
* DSH error code is then swapped for a fixed label. The ORIGINAL text is still
|
|
9
|
+
* in the stream this page already holds — `turn/end → data.reason.error.
|
|
10
|
+
* {message, code}` — so nothing here guesses: the popover shows exactly what
|
|
11
|
+
* the provider answered, including the HTTP status and traceId.
|
|
12
|
+
*
|
|
13
|
+
* Two rules keep this neighbouring the official row instead of fighting it:
|
|
14
|
+
* - the button rides the row's message span as a text run (a grid item would
|
|
15
|
+
* be pushed onto a second line by the row's three-column template);
|
|
16
|
+
* - every colour comes from this plugin's `--bre-*` theme vars, so the seat
|
|
17
|
+
* and the popover follow whichever theme the shell is in.
|
|
18
|
+
*
|
|
19
|
+
* @module dsh-model-think-level/client/injection/error-detail
|
|
20
|
+
*/
|
|
21
|
+
/** The copy face this module needs (a keyed translator). */
|
|
22
|
+
type Copy = (key: string, params?: Record<string, unknown>) => string;
|
|
23
|
+
/** What this module needs from the plugin context. */
|
|
24
|
+
export interface ErrorDetailContext {
|
|
25
|
+
get?(name: string): unknown;
|
|
26
|
+
}
|
|
27
|
+
/** Dependencies of the seat. */
|
|
28
|
+
export interface ErrorDetailDeps {
|
|
29
|
+
/** The client root context (only `get` is used). */
|
|
30
|
+
ctx: ErrorDetailContext;
|
|
31
|
+
/** The bound translator. */
|
|
32
|
+
t: Copy;
|
|
33
|
+
}
|
|
34
|
+
/** The seat's face. */
|
|
35
|
+
export interface ErrorDetail {
|
|
36
|
+
/** Remove the buttons, the popover and every listener. */
|
|
37
|
+
dispose: () => void;
|
|
38
|
+
}
|
|
39
|
+
/** One failure, reduced to what the popover shows. */
|
|
40
|
+
interface FailureView {
|
|
41
|
+
sessionId: string;
|
|
42
|
+
seq: number;
|
|
43
|
+
/** DSH's own classification (AUTH / QUOTA / RATE_LIMIT / …). */
|
|
44
|
+
code: string;
|
|
45
|
+
/** HTTP status parsed off the provider message, when it carries one. */
|
|
46
|
+
http?: number;
|
|
47
|
+
/** The provider's human message. */
|
|
48
|
+
reason: string;
|
|
49
|
+
/** The provider's machine code (MODEL_ACCESS_DENIED, …). */
|
|
50
|
+
providerCode?: string;
|
|
51
|
+
traceId?: string;
|
|
52
|
+
/** The untouched upstream text. */
|
|
53
|
+
raw: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Mask anything key-shaped: this seat shows text the product chose to hide, and
|
|
57
|
+
* the reason it hid it (a provider echoing the credential back) is real.
|
|
58
|
+
* @param text - the upstream message.
|
|
59
|
+
* @returns the message with credential-shaped runs replaced.
|
|
60
|
+
*/
|
|
61
|
+
export declare function redact(text: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Split `403: {"code":…}` into status / payload / readable reason.
|
|
64
|
+
* @param error - the durable `reason.error`.
|
|
65
|
+
* @param sessionId - owning session.
|
|
66
|
+
* @param seq - the `turn/end` sequence.
|
|
67
|
+
* @returns the projected failure.
|
|
68
|
+
*/
|
|
69
|
+
export declare function projectFailure(error: {
|
|
70
|
+
message?: unknown;
|
|
71
|
+
code?: unknown;
|
|
72
|
+
}, sessionId: string, seq: number): FailureView;
|
|
73
|
+
/**
|
|
74
|
+
* Build the seat.
|
|
75
|
+
* @param deps - the plugin context and translator.
|
|
76
|
+
* @returns the {@link ErrorDetail} face.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createErrorDetail(deps: ErrorDetailDeps): ErrorDetail;
|
|
79
|
+
export {};
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* Model-row drag reordering inside one provider's editor on the official Models
|
|
3
3
|
* settings page.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Older official editors render a provider's models as
|
|
6
6
|
* `div.modelList > div.modelEntry > div.modelRow` (a four-column grid: id,
|
|
7
7
|
* display name, and two icon buttons), straight from
|
|
8
8
|
* `models.map((model, index) => …)`. React owns those children, so — exactly as
|
|
9
9
|
* for the provider rows — a model is moved with a CSS `order`, and the id
|
|
10
10
|
* sequence that results is stored per provider by `../model-order.js`.
|
|
11
|
+
* Editors with a native `modelDragHandle` own both ordering and responsive
|
|
12
|
+
* layout; those lists must not receive another grip or a legacy grid override.
|
|
11
13
|
*
|
|
12
14
|
* Two differences from the provider list, and both are in the adapter:
|
|
13
15
|
* - the row is a grid of INPUTS, so only the grip drags. A drag that began on
|
package/lib/client/locales.d.ts
CHANGED
|
@@ -191,6 +191,20 @@ export declare const en: {
|
|
|
191
191
|
keysLastEnabledOff: string;
|
|
192
192
|
headersTitle: string;
|
|
193
193
|
headersHint: string;
|
|
194
|
+
camouflageTitle: string;
|
|
195
|
+
camouflageHint: string;
|
|
196
|
+
camouflageOff: string;
|
|
197
|
+
camouflageCodex: string;
|
|
198
|
+
camouflageClaude: string;
|
|
199
|
+
camouflageSaved: string;
|
|
200
|
+
camouflageError: string;
|
|
201
|
+
camouflageUnavailable: string;
|
|
202
|
+
historyCompatTitle: string;
|
|
203
|
+
historyCompatHint: string;
|
|
204
|
+
historyCompatCost: string;
|
|
205
|
+
historyCompatOff: string;
|
|
206
|
+
historyCompatOn: string;
|
|
207
|
+
historyCompatUnavailable: string;
|
|
194
208
|
headersEmpty: string;
|
|
195
209
|
headersAdd: string;
|
|
196
210
|
headersName: string;
|
|
@@ -266,6 +280,62 @@ export declare const en: {
|
|
|
266
280
|
autoContinueConfigHint: string;
|
|
267
281
|
autoContinueAria: string;
|
|
268
282
|
autoContinueMessage: string;
|
|
283
|
+
autoContinueTriggers: string;
|
|
284
|
+
autoContinueRestore: string;
|
|
285
|
+
autoContinueMaxTokens: string;
|
|
286
|
+
autoContinueHttpStatus: string;
|
|
287
|
+
autoContinueErrorTypes: string;
|
|
288
|
+
autoContinueCodesMore: string;
|
|
289
|
+
autoContinueCodesAll: string;
|
|
290
|
+
autoContinueCodesNone: string;
|
|
291
|
+
autoContinueGroupTransient: string;
|
|
292
|
+
autoContinueGroupOther: string;
|
|
293
|
+
autoContinueGroupFlags: string;
|
|
294
|
+
autoContinueWhyMaxTokens: string;
|
|
295
|
+
autoContinueWhyHttpStatus: string;
|
|
296
|
+
autoContinueChipHttp: string;
|
|
297
|
+
autoContinueTagContinue: string;
|
|
298
|
+
autoContinueTagUseless: string;
|
|
299
|
+
autoContinueTagDepends: string;
|
|
300
|
+
autoContinueWhyEMPTY_RESPONSE: string;
|
|
301
|
+
autoContinueWhyRATE_LIMIT: string;
|
|
302
|
+
autoContinueWhySERVER: string;
|
|
303
|
+
autoContinueWhyTIMEOUT: string;
|
|
304
|
+
autoContinueWhyTRANSPORT: string;
|
|
305
|
+
autoContinueWhyPI_AI_ERROR: string;
|
|
306
|
+
autoContinueWhyINVALID_REQUEST: string;
|
|
307
|
+
autoContinueWhyAUTH: string;
|
|
308
|
+
autoContinueWhyLEGACY_CLI_OUTCOME_UNKNOWN: string;
|
|
309
|
+
autoContinueWhyUNSUPPORTED_REASONING_EFFORT: string;
|
|
310
|
+
autoContinueWhyMALFORMED_RESPONSE: string;
|
|
311
|
+
autoContinueWhyUNKNOWN_MODEL: string;
|
|
312
|
+
autoContinueControllerWaiting: string;
|
|
313
|
+
autoContinueControllerSent: string;
|
|
314
|
+
autoContinueControllerExhausted: string;
|
|
315
|
+
autoContinueControllerStop: string;
|
|
316
|
+
autoContinueControllerResume: string;
|
|
317
|
+
autoContinueControllerReset: string;
|
|
318
|
+
autoContinueControllerSettings: string;
|
|
319
|
+
autoContinueControllerAria: string;
|
|
320
|
+
autoContinueControllerDetail: string;
|
|
321
|
+
errorDetailSectionTitle: string;
|
|
322
|
+
errorDetailSummary: string;
|
|
323
|
+
errorDetailHint: string;
|
|
324
|
+
errorDetailAria: string;
|
|
325
|
+
errorDetailButton: string;
|
|
326
|
+
errorDetailTitle: string;
|
|
327
|
+
errorDetailClose: string;
|
|
328
|
+
errorDetailReason: string;
|
|
329
|
+
errorDetailTrace: string;
|
|
330
|
+
errorDetailCode: string;
|
|
331
|
+
errorDetailShown: string;
|
|
332
|
+
errorDetailRaw: string;
|
|
333
|
+
errorDetailCopy: string;
|
|
334
|
+
errorDetailCopied: string;
|
|
335
|
+
errorDetailCopyRaw: string;
|
|
336
|
+
errorDetailSource: string;
|
|
337
|
+
errorDetailUnwrapped: string;
|
|
338
|
+
errorDetailFixedLabel: string;
|
|
269
339
|
};
|
|
270
340
|
/** The plugin's locale key union. */
|
|
271
341
|
export type BreKey = keyof typeof en;
|