dsh-model-think-level 2.1.0 → 2.2.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 +1 -0
- package/lib/autofill.d.ts +20 -2
- package/lib/client/ConfigPane.d.ts +4 -6
- package/lib/client/image-config-client.d.ts +0 -23
- package/lib/client/index.d.ts +1 -0
- package/lib/client/injection/compat-guard.d.ts +33 -0
- package/lib/client/injection/key-prefetch.d.ts +13 -1
- package/lib/client/injection/model-order-drag.d.ts +1 -1
- package/lib/client/injection/models-page-editor.d.ts +1 -2
- package/lib/client/injection/models-page-mutation.d.ts +6 -0
- package/lib/client/injection/provider-balance.d.ts +12 -1
- package/lib/client/injection/provider-delete-seat.d.ts +4 -1
- package/lib/client/injection/provider-disabled-group.d.ts +4 -1
- package/lib/client/injection/provider-order-drag.d.ts +5 -1
- package/lib/client/injection/provider-toggle.d.ts +4 -1
- package/lib/client/key-manager-client.d.ts +21 -9
- package/lib/client/locales.d.ts +5 -25
- package/lib/client/model-order.d.ts +9 -0
- package/lib/client/order-sync.d.ts +63 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client.js +13 -168
- package/lib/client.js.map +4 -4
- package/lib/constants.d.ts +15 -7
- package/lib/image/command.d.ts +1 -1
- package/lib/index.js +506 -224
- package/lib/index.js.map +4 -4
- package/lib/key-index.d.ts +11 -0
- package/lib/knowledge.d.ts +26 -0
- package/lib/order-store.d.ts +78 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ DSH 的第三方模型补齐思考等级:在官方 Models 页每个模型行
|
|
|
70
70
|
- 每把密钥行首有一个圆形对勾开关:亮起表示参与路由,灰色表示暂停使用。停用只是把密钥移出分流池,别名、模型清单与协议指定全部保留,重新点亮即恢复;最后一把启用中的密钥不允许停用(否则请求会回落到适配器自身的单密钥路径,仍然用刚被停用的那把签名)。
|
|
71
71
|
- 「添加另一个密钥」会优先**填回已经列出、但凭据库里还没有值的引用**,而不是再铸一个新名字。这条是为跨机同步准备的:配置从另一台电脑同步过来时,点名的 `XXX_API_KEY_2` 在这台还没有值,直接填进去两台的名字就一致了;若改成铸 `XXX_API_KEY_3`,名字会分叉,旧名字还会在面板上留一行「未存储」的残行。填回时别名、模型清单与协议指定都保留(只补值,不改标签)。库里已有值的引用不会被顶掉——那种情况下仍然铸新名字。
|
|
72
72
|
- 插件自身元数据保存在 DSH 数据目录的 `dsh-model-think-level/key-index.json`,只记录引用、别名、模型清单、协议指定、各协议族地址与启停状态,绝不保存密钥值(密钥值始终由 DSH 凭据库保管)。
|
|
73
|
+
- 模型页拖出来的**供应商排序与各供应商的模型排序**也会镜像到同目录的 `ui-order.json`:页面上每次拖动照旧即时生效(实时状态在 localStorage),插件在后台防抖写入这个文件,下次启动时按「最后写入者胜」与本地状态对齐(文件更新就采纳文件,本地更新就回写文件)。文件里只有供应商路由与模型 id,不含任何密钥,可以放心交给同步盘/网盘携带,实现多台机器的排序同步。
|
|
73
74
|
- 新增供应商的表单在官方密钥输入框下方也带这套卡片式密钥列表:草稿密钥先暂存在本页,点「创建」供应商落库后自动写入,第一把草稿密钥自动成为启用密钥。挂载前已敲进官方输入框的值保留在原处——官方框保存的仍是那把密钥,下方的列表只收之后新增的。刷新页面会丢弃草稿,与表单自身行为一致;若 id 撞上已存在的供应商,草稿不会写入对方。
|
|
74
75
|
|
|
75
76
|
### 按密钥切换协议与多地址
|
package/lib/autofill.d.ts
CHANGED
|
@@ -27,6 +27,24 @@ export declare function buildAutofillPatch(providers: unknown, routeFilter?: (ro
|
|
|
27
27
|
efforts?: boolean;
|
|
28
28
|
modalities?: boolean;
|
|
29
29
|
}, revision?: number): JsonObject | undefined;
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Build the protocol-mismatch cleanup patch (the compat guard): every model
|
|
32
|
+
* row -- and the route-level compat block -- whose compat carries a switch its
|
|
33
|
+
* route's wire protocol does not take loses exactly those keys.
|
|
34
|
+
*
|
|
35
|
+
* This is the repair for a protocol switched after the switches were written:
|
|
36
|
+
* openai-completions → openai-responses leaves `supportsReasoningEffort` on
|
|
37
|
+
* every model, and the kernel then refuses each of them at catalog resolution
|
|
38
|
+
* ("sets compat ..., but its api is ..., which does not take it"), so the
|
|
39
|
+
* route serves nothing until the keys are gone.
|
|
40
|
+
*
|
|
41
|
+
* Only routes that NAME a wire protocol are swept: a route without `api`
|
|
42
|
+
* resolves each model's protocol from the installed catalog, which this
|
|
43
|
+
* builder cannot see, so touching it could strip a key a catalog model
|
|
44
|
+
* legitimately takes. Returns the partial providers patch, or undefined when
|
|
45
|
+
* nothing is dirty -- the common case, so a caller never writes speculatively.
|
|
46
|
+
* Pure data logic like {@link buildAutofillPatch}: shared by BOTH halves.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildCompatCleanupPatch(providers: unknown): JsonObject | undefined;
|
|
49
|
+
/** Strip newer-only compat keys from an autofill patch (older-kernel downgrade). */ export declare function stripNewCompatKeysDeep(patch: JsonObject): JsonObject | undefined;
|
|
32
50
|
export {};
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
* Models-page title-row button.
|
|
5
5
|
*
|
|
6
6
|
* One card today, 「生图」, per the design's card-list shape with room for
|
|
7
|
-
* more: the params row
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* editor uses — never a raw file edit), and the built-in-tool status card
|
|
12
|
-
* whose state the host reports from its live tools/attachments registration.
|
|
7
|
+
* more: the params row and the default-model select under it. The marked
|
|
8
|
+
* models surface as that select's options; marking itself lives on the Models
|
|
9
|
+
* page (展开模型行 → 输入模态 → 勾选「生图」), so the pane keeps no list,
|
|
10
|
+
* no empty state and no built-in-tool status card of its own.
|
|
13
11
|
*
|
|
14
12
|
* Esc / backdrop / ✕ close it; the wrapper unmounts and the page keeps
|
|
15
13
|
* whatever the pane saved.
|
|
@@ -50,26 +50,3 @@ export declare function saveImageConfig(patch: {
|
|
|
50
50
|
}>;
|
|
51
51
|
outputDir?: string;
|
|
52
52
|
}): Promise<TransportAnswer<undefined>>;
|
|
53
|
-
/** 对一行模型发起端点测试(n:1、最小尺寸的真实请求)。 */
|
|
54
|
-
export declare function testImageEndpoint(id: string): Promise<TransportAnswer<{
|
|
55
|
-
status: string;
|
|
56
|
-
checkedAt?: string;
|
|
57
|
-
}>>;
|
|
58
|
-
/** 显式生成(辅通道):拿全部落盘路径直接弹预览。 */
|
|
59
|
-
export declare function generateImageDirect(request: {
|
|
60
|
-
model?: string;
|
|
61
|
-
prompt: string;
|
|
62
|
-
size?: string;
|
|
63
|
-
quality?: string;
|
|
64
|
-
n?: number;
|
|
65
|
-
referenceImages?: readonly string[];
|
|
66
|
-
}): Promise<TransportAnswer<{
|
|
67
|
-
images: readonly string[];
|
|
68
|
-
model: string;
|
|
69
|
-
paramsUsed: {
|
|
70
|
-
size: string;
|
|
71
|
-
quality: string;
|
|
72
|
-
n: number;
|
|
73
|
-
};
|
|
74
|
-
warning?: string;
|
|
75
|
-
}>>;
|
package/lib/client/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* slider-toggle-slot.ts the Models-page footer toggle
|
|
15
15
|
* provider-order-drag.ts the Models-page provider-row drag handles (order)
|
|
16
16
|
* provider-order.ts the stored provider order (settings page + composer)
|
|
17
|
+
* order-sync.ts the orderings mirrored into ui-order.json (sync)
|
|
17
18
|
* provider-toggle.ts the Models-page per-provider enable switch
|
|
18
19
|
* provider-enabled.ts the stored disabled providers (settings page + composer)
|
|
19
20
|
* autofill-run.ts the running auto-fill complement (issue #7)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compat guard: the running repair for a wire protocol switched after
|
|
3
|
+
* compat switches were written.
|
|
4
|
+
*
|
|
5
|
+
* Switching a route to `openai-responses` (or `anthropic-messages`) leaves the
|
|
6
|
+
* old openai-completions switches -- `supportsReasoningEffort` and friends --
|
|
7
|
+
* stored on its models, and the kernel then refuses every model that still
|
|
8
|
+
* carries one ("sets compat ..., but its api is ..., which does not take it"):
|
|
9
|
+
* the route serves nothing until the keys are gone. The host heals what it
|
|
10
|
+
* finds at boot; everything a session changes afterwards is healed HERE, on
|
|
11
|
+
* the idle pass -- the only moment no official card is holding a revision
|
|
12
|
+
* baseline a write would invalidate (issue #7, the same rule the running
|
|
13
|
+
* auto-fill complement follows).
|
|
14
|
+
*
|
|
15
|
+
* @module dsh-model-think-level/client/injection/compat-guard
|
|
16
|
+
*/
|
|
17
|
+
import type { RemoteApi, SettingsJoin } from '../types.js';
|
|
18
|
+
/** What the guard needs from its host. */
|
|
19
|
+
export interface CompatGuardDeps {
|
|
20
|
+
/** The settings remote. */
|
|
21
|
+
api: RemoteApi;
|
|
22
|
+
}
|
|
23
|
+
/** The guard's face. */
|
|
24
|
+
export interface CompatGuard {
|
|
25
|
+
/** Run the guard; fire-and-forget on the injector's idle pass. */
|
|
26
|
+
run: (join?: SettingsJoin) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build the guard.
|
|
30
|
+
* @param deps - the settings remote.
|
|
31
|
+
* @returns the guard's {@link CompatGuard} face.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createCompatGuard(deps: CompatGuardDeps): CompatGuard;
|
|
@@ -20,10 +20,18 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type { KeyManagerClient } from '../key-manager-client.js';
|
|
22
22
|
import type { HostLabels } from './models-page-editor.js';
|
|
23
|
+
interface PendingKeyList {
|
|
24
|
+
readonly route: string;
|
|
25
|
+
readonly client: KeyManagerClient;
|
|
26
|
+
}
|
|
23
27
|
/** Per-session bookkeeping (one instance lives in `models-page.ts`). */
|
|
24
28
|
export interface KeyPrefetchState {
|
|
25
29
|
/** Routes already asked during THIS page opening. */
|
|
26
30
|
readonly requested: Set<string>;
|
|
31
|
+
/** Work not yet started; discarded when the provider list disappears. */
|
|
32
|
+
readonly pending: PendingKeyList[];
|
|
33
|
+
/** In-flight reads survive page reopen, keeping the shared limit at two. */
|
|
34
|
+
readonly running: Set<string>;
|
|
27
35
|
/** Whether the provider list was present in the previous pass. */
|
|
28
36
|
visible: boolean;
|
|
29
37
|
}
|
|
@@ -40,5 +48,9 @@ export interface KeyPrefetchDeps {
|
|
|
40
48
|
* Visit the provider list once per scan: on a (re)opened page, ask the host for
|
|
41
49
|
* each visible provider's key list, once, and let the panel's cache hold the
|
|
42
50
|
* answer until an expansion needs it.
|
|
51
|
+
* @param list - the provider list already resolved by the caller's scan (see
|
|
52
|
+
* `reconcileProviderOrder`); re-deriving it here costs a document-wide walk
|
|
53
|
+
* per pass, and one burst runs several passes.
|
|
43
54
|
*/
|
|
44
|
-
export declare function reconcileKeyPrefetch(root: HTMLElement, deps: KeyPrefetchDeps, state: KeyPrefetchState): void;
|
|
55
|
+
export declare function reconcileKeyPrefetch(root: HTMLElement, deps: KeyPrefetchDeps, state: KeyPrefetchState, list?: HTMLElement | undefined): void;
|
|
56
|
+
export {};
|
|
@@ -71,7 +71,7 @@ export declare function modelListMutation(records: readonly MutationRecord[]): b
|
|
|
71
71
|
* that might belong to another provider, or writing one there, is worse than
|
|
72
72
|
* leaving that editor without grips for a scan.
|
|
73
73
|
*/
|
|
74
|
-
export declare function reconcileModelOrder(root: HTMLElement, deps: ModelOrderDeps, state: ModelOrderState): void;
|
|
74
|
+
export declare function reconcileModelOrder(root: HTMLElement, deps: ModelOrderDeps, state: ModelOrderState, lists?: readonly HTMLElement[]): void;
|
|
75
75
|
/**
|
|
76
76
|
* Undo everything this module put on the page. A plugin disable or an HMR
|
|
77
77
|
* replace unmounts React trees on its own, but the grips, the widened grids and
|
|
@@ -801,8 +801,7 @@ export declare function pinModelListCards(root: HTMLElement, windowMs?: number):
|
|
|
801
801
|
* own DOM are skipped, exactly like the Edit buttons above.
|
|
802
802
|
*/
|
|
803
803
|
export declare function addModelTriggersOf(scope: HTMLElement, labels: HostLabels): HTMLElement[];
|
|
804
|
-
/**
|
|
805
|
-
* Scan the settings DOM for official model rows and reconcile the injected
|
|
804
|
+
/** Scan the settings DOM for official model rows and reconcile the injected
|
|
806
805
|
* editors. Idempotent: existing editors are left alone, new disclosures get
|
|
807
806
|
* one, and removed ones are unmounted.
|
|
808
807
|
* @param root - the settings panel root to scan.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat streaming and foreign-root renders must not wake every Models-page seam.
|
|
3
|
+
* Inspect the mutation's subtree, not document.body. Removed subtrees are kept
|
|
4
|
+
* in the records too, so navigation away still releases page-opening sessions.
|
|
5
|
+
*/
|
|
6
|
+
export declare function modelsPageMutation(records: readonly MutationRecord[]): boolean;
|
|
@@ -43,9 +43,16 @@ export interface ProviderBalanceState {
|
|
|
43
43
|
readonly inflight: Set<string>;
|
|
44
44
|
/** Routes invalidated while a read was in flight (re-read on settle). */
|
|
45
45
|
readonly pending: Set<string>;
|
|
46
|
+
/** Reads waiting for a concurrency slot; discarded when the page closes. */
|
|
47
|
+
readonly queued: PendingBalanceRead[];
|
|
46
48
|
/** Whether the provider list was present in the previous pass. */
|
|
47
49
|
visible: boolean;
|
|
48
50
|
}
|
|
51
|
+
/** A read waiting for a slot: the row that asked and the route it asked for. */
|
|
52
|
+
interface PendingBalanceRead {
|
|
53
|
+
readonly head: HTMLElement;
|
|
54
|
+
readonly route: string;
|
|
55
|
+
}
|
|
49
56
|
/** What the chip needs from its host. */
|
|
50
57
|
export interface ProviderBalanceDeps {
|
|
51
58
|
/** The plugin's own translator, for the chip's label and tooltip. */
|
|
@@ -71,8 +78,11 @@ export declare function createProviderBalanceState(): ProviderBalanceState;
|
|
|
71
78
|
* A missing provider list means the Models page is closed (or not rendered):
|
|
72
79
|
* the opening is over, so the next presence starts a new read session. No
|
|
73
80
|
* request is made from this function while the list is absent.
|
|
81
|
+
* @param list - the provider list already resolved by the caller's scan (see
|
|
82
|
+
* `reconcileProviderOrder`); re-deriving it here costs a document-wide walk
|
|
83
|
+
* per pass, and one burst runs several passes.
|
|
74
84
|
*/
|
|
75
|
-
export declare function reconcileProviderBalance(root: HTMLElement, deps: ProviderBalanceDeps, state: ProviderBalanceState): void;
|
|
85
|
+
export declare function reconcileProviderBalance(root: HTMLElement, deps: ProviderBalanceDeps, state: ProviderBalanceState, list?: HTMLElement | undefined): void;
|
|
76
86
|
/**
|
|
77
87
|
* Forget one route's session, so the next reconcile reads it now.
|
|
78
88
|
* A balance URL was just written (or cleared): the old amount belongs to the
|
|
@@ -81,3 +91,4 @@ export declare function reconcileProviderBalance(root: HTMLElement, deps: Provid
|
|
|
81
91
|
export declare function invalidateProviderBalance(state: ProviderBalanceState, route: string): void;
|
|
82
92
|
/** Remove every chip (the fiber is going away). */
|
|
83
93
|
export declare function teardownProviderBalance(): void;
|
|
94
|
+
export {};
|
|
@@ -32,7 +32,10 @@ export interface ProviderDeleteDeps {
|
|
|
32
32
|
* Give every provider row the delete seat the host left out. Idempotent: a row
|
|
33
33
|
* that already has one is only relabelled, and a row whose provider became
|
|
34
34
|
* removable hands the seat back to the host's own button.
|
|
35
|
+
* @param list - the provider list already resolved by the caller's scan (see
|
|
36
|
+
* `reconcileProviderOrder`); re-deriving it here costs a document-wide walk
|
|
37
|
+
* per pass, and one burst runs several passes.
|
|
35
38
|
*/
|
|
36
|
-
export declare function reconcileProviderDeleteSeat(root: HTMLElement, deps: ProviderDeleteDeps): void;
|
|
39
|
+
export declare function reconcileProviderDeleteSeat(root: HTMLElement, deps: ProviderDeleteDeps, list?: HTMLElement | undefined): void;
|
|
37
40
|
/** Take every seat out again (plugin dispose, HMR teardown). */
|
|
38
41
|
export declare function teardownProviderDeleteSeats(): void;
|
|
@@ -50,7 +50,10 @@ export declare function createProviderDisabledGroupState(): ProviderDisabledGrou
|
|
|
50
50
|
* Idempotent: a row already folded stays folded, and the control is only ever
|
|
51
51
|
* written when a value genuinely changed, so a scan never mutates the page on
|
|
52
52
|
* behalf of a state that is already on it.
|
|
53
|
+
* @param list - the provider list already resolved by the caller's scan (see
|
|
54
|
+
* `reconcileProviderOrder`); re-deriving it here costs a document-wide walk
|
|
55
|
+
* per pass, and one burst runs several passes.
|
|
53
56
|
*/
|
|
54
|
-
export declare function reconcileProviderDisabledGroup(root: HTMLElement, deps: ProviderDisabledGroupDeps, state: ProviderDisabledGroupState): void;
|
|
57
|
+
export declare function reconcileProviderDisabledGroup(root: HTMLElement, deps: ProviderDisabledGroupDeps, state: ProviderDisabledGroupState, list?: HTMLElement | undefined): void;
|
|
55
58
|
/** Remove the control and unfold every row it hid. */
|
|
56
59
|
export declare function teardownProviderDisabledGroup(): void;
|
|
@@ -74,8 +74,12 @@ export declare function applyRowOrder(list: HTMLElement, ids: readonly string[])
|
|
|
74
74
|
* open, so this cannot ride along with it) and is idempotent by DOM presence —
|
|
75
75
|
* the same guard the editor injector uses, which keeps the insertion from
|
|
76
76
|
* re-triggering the scan that found it.
|
|
77
|
+
* @param list - the provider list already resolved by the caller's scan. Every
|
|
78
|
+
* pass of one `reconcileDom` shares one `rowsListOf` answer: the fallback
|
|
79
|
+
* re-derivation costs a full-document substring-class walk, and seven passes
|
|
80
|
+
* paying it separately is what showed up as tens of walks per burst.
|
|
77
81
|
*/
|
|
78
|
-
export declare function reconcileProviderOrder(root: HTMLElement, deps: ProviderOrderDeps, state: ProviderOrderState): void;
|
|
82
|
+
export declare function reconcileProviderOrder(root: HTMLElement, deps: ProviderOrderDeps, state: ProviderOrderState, list?: HTMLElement | undefined): void;
|
|
79
83
|
/**
|
|
80
84
|
* Undo everything this module put on the official page. A plugin disable or an
|
|
81
85
|
* HMR replace unmounts React trees on its own, but the grips, the draggable
|
|
@@ -36,7 +36,10 @@ export declare function createProviderToggleState(): ProviderToggleState;
|
|
|
36
36
|
* Visit every provider row and make sure it shows a switch carrying its own
|
|
37
37
|
* state. Idempotent: a row that already has one is only relabelled, which is
|
|
38
38
|
* also how a language switch and an external toggle reach the page.
|
|
39
|
+
* @param list - the provider list already resolved by the caller's scan (see
|
|
40
|
+
* {@link reconcileProviderOrder}); re-deriving it here costs a document-wide
|
|
41
|
+
* walk per pass, and one burst runs several passes.
|
|
39
42
|
*/
|
|
40
|
-
export declare function reconcileProviderEnabled(root: HTMLElement, deps: ProviderToggleDeps, state: ProviderToggleState): void;
|
|
43
|
+
export declare function reconcileProviderEnabled(root: HTMLElement, deps: ProviderToggleDeps, state: ProviderToggleState, list?: HTMLElement | undefined): void;
|
|
41
44
|
/** Remove every switch and every dimmed row. */
|
|
42
45
|
export declare function teardownProviderEnabled(): void;
|
|
@@ -71,9 +71,10 @@ export interface KeyRow {
|
|
|
71
71
|
*/
|
|
72
72
|
readonly protocol?: RouteProtocol;
|
|
73
73
|
/**
|
|
74
|
-
* Whether the key's model scope is the
|
|
75
|
-
*
|
|
76
|
-
*
|
|
74
|
+
* Whether the key's model scope is the probe's assignment rather than a
|
|
75
|
+
* manual one — the panel shows it so a scope edit knows the checked chips
|
|
76
|
+
* will keep being rewritten on every probe run until the user saves one by
|
|
77
|
+
* hand.
|
|
77
78
|
*/
|
|
78
79
|
readonly auto?: boolean;
|
|
79
80
|
/**
|
|
@@ -111,10 +112,9 @@ export interface KeyState {
|
|
|
111
112
|
/** The provider's two base URLs, keyed by protocol family. */
|
|
112
113
|
readonly endpoints: KeyEndpoints;
|
|
113
114
|
/**
|
|
114
|
-
* Whether the host is probing this route's keys
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* reopen.
|
|
115
|
+
* Whether the host is probing this route's keys right now (the panel button's
|
|
116
|
+
* scope check). The panel follows it with a quiet poll until it clears, so
|
|
117
|
+
* the assignments the probe writes land on screen without a reopen.
|
|
118
118
|
*/
|
|
119
119
|
readonly probing?: boolean;
|
|
120
120
|
}
|
|
@@ -140,10 +140,15 @@ export interface RouteBalanceAnswer {
|
|
|
140
140
|
/** The host's wording when the read was refused. */
|
|
141
141
|
readonly error?: string;
|
|
142
142
|
}
|
|
143
|
+
/** Read policy for the masked key list; omitted options always revalidate. */
|
|
144
|
+
export interface KeyListOptions {
|
|
145
|
+
/** Reuse a successful masked answer for up to five seconds. */
|
|
146
|
+
readonly preferCache?: boolean;
|
|
147
|
+
}
|
|
143
148
|
/** The manager's transport, injectable so the panel can be tested without one. */
|
|
144
149
|
export interface KeyManagerClient {
|
|
145
|
-
/** Read the provider's whole key list. */
|
|
146
|
-
list(route: string): Promise<KeyAnswer>;
|
|
150
|
+
/** Read the provider's whole key list (fresh unless cache reuse is requested). */
|
|
151
|
+
list(route: string, options?: KeyListOptions): Promise<KeyAnswer>;
|
|
147
152
|
/**
|
|
148
153
|
* Read only the route's two addresses.
|
|
149
154
|
*
|
|
@@ -193,6 +198,13 @@ export interface KeyManagerClient {
|
|
|
193
198
|
* survive a balance edit.
|
|
194
199
|
*/
|
|
195
200
|
setBalanceEndpoint?(route: string, endpoint: string): Promise<KeyAnswer>;
|
|
201
|
+
/**
|
|
202
|
+
* Ask the host to probe every key of a multi-key route and check the
|
|
203
|
+
* probe-maintained scopes to what each key actually serves. The answer is
|
|
204
|
+
* the list as it stands when the run was queued — `probing` says the run is
|
|
205
|
+
* on, and the panel follows it to the assignments it writes.
|
|
206
|
+
*/
|
|
207
|
+
probe(route: string): Promise<KeyAnswer>;
|
|
196
208
|
/** The stored value of one listed reference, or undefined. */
|
|
197
209
|
reveal(route: string, ref: string): Promise<string | undefined>;
|
|
198
210
|
}
|
package/lib/client/locales.d.ts
CHANGED
|
@@ -154,6 +154,11 @@ export declare const en: {
|
|
|
154
154
|
keysScopeSaved: string;
|
|
155
155
|
keysScopeHint: string;
|
|
156
156
|
keysScopeAutoHint: string;
|
|
157
|
+
keysProbe: string;
|
|
158
|
+
keysProbing: string;
|
|
159
|
+
keysProbeHint: string;
|
|
160
|
+
keysProbeSingle: string;
|
|
161
|
+
keysProbeDone: string;
|
|
157
162
|
keysScopeObserved: string;
|
|
158
163
|
keysScopeObservedHint: string;
|
|
159
164
|
keysScopeEmpty: string;
|
|
@@ -223,43 +228,18 @@ export declare const en: {
|
|
|
223
228
|
configPaneTitle: string;
|
|
224
229
|
configPaneClose: string;
|
|
225
230
|
configPaneFailed: string;
|
|
226
|
-
configPaneFoot: string;
|
|
227
231
|
imagegenSectionTitle: string;
|
|
228
|
-
imagegenSectionSub: string;
|
|
229
|
-
imagegenModelCount: string;
|
|
230
232
|
imagegenLoading: string;
|
|
231
233
|
imagegenLoadFailed: string;
|
|
232
234
|
imagegenDefaultsLabel: string;
|
|
233
235
|
imagegenDefaultModelLabel: string;
|
|
234
236
|
imagegenDefaultModelNone: string;
|
|
235
|
-
imagegenDefaultBadge: string;
|
|
236
|
-
imagegenEndpointOk: string;
|
|
237
|
-
imagegenEndpointUnverified: string;
|
|
238
|
-
imagegenEndpointUnsupported: string;
|
|
239
|
-
imagegenEndpointBadgeHint: string;
|
|
240
|
-
imagegenNoEndpoint: string;
|
|
241
237
|
imagegenSizeLabel: string;
|
|
242
238
|
imagegenQualityLabel: string;
|
|
243
239
|
imagegenCountLabel: string;
|
|
244
240
|
imagegenTimeoutLabel: string;
|
|
245
241
|
imagegenTimeoutMinutes: string;
|
|
246
242
|
imagegenTimeoutHint: string;
|
|
247
|
-
imagegenTestEndpoint: string;
|
|
248
|
-
imagegenProbe: string;
|
|
249
|
-
imagegenProbeDone: string;
|
|
250
|
-
imagegenEmptyText: string;
|
|
251
|
-
imagegenEmptyHint: string;
|
|
252
|
-
imagegenFindSuspects: string;
|
|
253
|
-
imagegenNoSuspects: string;
|
|
254
|
-
imagegenMarkSuspects: string;
|
|
255
|
-
imagegenMarked: string;
|
|
256
|
-
imagegenMarkFailed: string;
|
|
257
|
-
imagegenProbeDoneMulti: string;
|
|
258
|
-
imagegenToolTitle: string;
|
|
259
|
-
imagegenToolRegistered: string;
|
|
260
|
-
imagegenToolUnregistered: string;
|
|
261
|
-
imagegenToolTest: string;
|
|
262
|
-
imagegenToolHint: string;
|
|
263
243
|
imagegenCardRunning: string;
|
|
264
244
|
};
|
|
265
245
|
/** The plugin's locale key union. */
|
|
@@ -35,6 +35,15 @@ export declare function modelOrderOf(provider: string): readonly string[];
|
|
|
35
35
|
export declare function setModelOrder(provider: string, next: readonly string[]): void;
|
|
36
36
|
/** Apply a map incoming from another tab (no persist: the writer already stored it). */
|
|
37
37
|
export declare function syncModelOrders(next: ModelOrderMap): void;
|
|
38
|
+
/**
|
|
39
|
+
* Replace the whole map with `next` AND persist it — the boot adoption of the
|
|
40
|
+
* synced order document (`order-sync.ts`). Like `syncModelOrders` it is a
|
|
41
|
+
* wholesale replace; unlike it, the map also lands in localStorage, because
|
|
42
|
+
* the writer here is the file sync, not another tab's own persisting store.
|
|
43
|
+
* Entries with no nameable model left are dropped, exactly as `parseModelOrders`
|
|
44
|
+
* drops them, so an adopted map is a parsed-map shape.
|
|
45
|
+
*/
|
|
46
|
+
export declare function adoptModelOrders(next: ModelOrderMap): void;
|
|
38
47
|
/** Subscribe to order changes; returns the disposer. */
|
|
39
48
|
export declare function subscribeModelOrders(listener: () => void): () => void;
|
|
40
49
|
/**
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The order document's sync: the browser half's provider/model orderings
|
|
3
|
+
* mirrored into the host's `ui-order.json` (ORDER_PATH).
|
|
4
|
+
*
|
|
5
|
+
* localStorage — the live stores' medium (provider-order.ts / model-order.ts)
|
|
6
|
+
* — is per-install and does not travel; the file does. The sync is a two-way
|
|
7
|
+
* last-writer-wins fold, arbitrated by the `savedAt` stamp each side carries:
|
|
8
|
+
*
|
|
9
|
+
* - Every local ORDER CHANGE is stamped into localStorage immediately (not
|
|
10
|
+
* when the push lands), so a page closed inside the debounce window still
|
|
11
|
+
* reads as the newer side at the next boot and pushes what it holds.
|
|
12
|
+
* - Boot pulls the file: a file newer than the local stamp is ADOPTED into
|
|
13
|
+
* the stores (and with them into localStorage, so the page and the
|
|
14
|
+
* composer follow without a reload); an older or absent file is
|
|
15
|
+
* overwritten by the local state — the seed after an upgrade, and the
|
|
16
|
+
* repair when a previous push never landed.
|
|
17
|
+
* - Every change is pushed, debounced, so a drag burst lands as one write;
|
|
18
|
+
* an adoption schedules nothing (the content already matches).
|
|
19
|
+
*
|
|
20
|
+
* The file holds no secrets — provider routes and model ids only — which is
|
|
21
|
+
* what makes it safe to point a sync tool at. Every fetch failure is silent:
|
|
22
|
+
* the local stores keep working, and the next boot reconciles.
|
|
23
|
+
*
|
|
24
|
+
* @module dsh-model-think-level/client/order-sync
|
|
25
|
+
*/
|
|
26
|
+
/** localStorage key of the last local order change (epoch ms; 0 = unstamped). */
|
|
27
|
+
export declare const ORDER_SAVED_AT_KEY = "dsh-model-think-level.order-saved-at";
|
|
28
|
+
/**
|
|
29
|
+
* Floor between a drag and its push. Long enough to fold a keyboard nudge
|
|
30
|
+
* burst into one write, short enough that closing the page right after a drag
|
|
31
|
+
* usually still lands (and `flushOrderSync` covers the rest).
|
|
32
|
+
*/
|
|
33
|
+
export declare const ORDER_PUSH_DEBOUNCE_MS = 400;
|
|
34
|
+
/** The wire shape of the order document (declared here; the host parses its own). */
|
|
35
|
+
export interface OrderDocumentView {
|
|
36
|
+
savedAt: number;
|
|
37
|
+
providerOrder: readonly string[];
|
|
38
|
+
modelOrder: Readonly<Record<string, readonly string[]>>;
|
|
39
|
+
/**
|
|
40
|
+
* The disabled set the document carries, or `undefined` when it names none —
|
|
41
|
+
* which is not the same as naming an empty one: an explicit empty array is a
|
|
42
|
+
* real "everything is on" a newer file can hold over a local disabled row,
|
|
43
|
+
* while an absent field is an old writer that never knew the field, and must
|
|
44
|
+
* not clear what this machine has.
|
|
45
|
+
*/
|
|
46
|
+
providersDisabled: readonly string[] | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Push any pending change immediately — the pagehide flush. A drag landing
|
|
50
|
+
* inside the debounce window would otherwise stay local until the next boot.
|
|
51
|
+
* The pending timer is cancelled with it: one change, one push.
|
|
52
|
+
*/
|
|
53
|
+
export declare function flushOrderSync(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Boot pass: pull the file and arbitrate. Resolves once the decision has been
|
|
56
|
+
* acted on (adoption is synchronous; a push is fire-and-forget).
|
|
57
|
+
*/
|
|
58
|
+
export declare function reconcileOrderSync(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Start the sync: the boot pass plus the change subscription. Returns the
|
|
61
|
+
* disposer; a disposed sync stops pushing and ignores the boot answer.
|
|
62
|
+
*/
|
|
63
|
+
export declare function startOrderSync(): () => void;
|