@linxin666/dsh-liangshen 0.3.23 → 0.4.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.i18n.yaml +2 -2
- package/README.md +55 -41
- package/README.zh.md +54 -40
- package/cordis.patch.yml +3 -2
- package/icon.svg +3 -0
- package/lib/client.js +1380 -29
- package/lib/client.js.map +1 -1
- package/lib/index.js +616 -367
- package/lib/types/announce.test.d.ts +10 -0
- package/lib/types/client/LiangShenSettingsCard.d.ts +78 -0
- package/lib/types/client/PluginSettingsCard.d.ts +137 -0
- package/lib/types/client/index.d.ts +57 -4
- package/lib/types/client/lever-controller.d.ts +16 -2
- package/lib/types/client/locales.d.ts +40 -1
- package/lib/types/client/main-session.d.ts +32 -0
- package/lib/types/client/plugin-card-seat.d.ts +103 -0
- package/lib/types/client/settings-form.d.ts +197 -0
- package/lib/types/composition.d.ts +116 -0
- package/lib/types/composition.test.d.ts +7 -0
- package/lib/types/core/lever.d.ts +6 -3
- package/lib/types/index.d.ts +160 -33
- package/lib/types/index.test.d.ts +5 -0
- package/package.json +27 -18
- package/presets/liangshen/NOTICE +4 -4
- package/presets/liangshen/agent.cordis.yml +168 -123
- package/presets/liangshen/fact-ledger.mjs +141 -0
- package/presets/liangshen/guard.mjs +426 -0
- package/presets/liangshen/minimal-prompt.mjs +73 -38
- package/presets/liangshen/paging.mjs +232 -0
- package/presets/liangshen/tool-activate.mjs +176 -0
- package/presets/liangshen/tool-catalog.mjs +615 -219
- package/presets/liangshen/working-context.mjs +222 -0
- package/src/announce.test.ts +248 -55
- package/src/client/LiangShenLever.module.css +2 -0
- package/src/client/LiangShenLever.tsx +41 -10
- package/src/client/LiangShenSettingsCard.tsx +233 -0
- package/src/client/PluginSettingsCard.tsx +555 -0
- package/src/client/index.ts +102 -5
- package/src/client/lever-controller.ts +76 -9
- package/src/client/locales.ts +79 -1
- package/src/client/main-session.ts +43 -0
- package/src/client/plugin-card-seat.ts +192 -0
- package/src/client/settings-card.module.css +418 -0
- package/src/client/settings-form.ts +442 -0
- package/src/composition.test.ts +294 -0
- package/src/composition.ts +554 -0
- package/src/core/lever.ts +7 -4
- package/src/index.test.ts +68 -1
- package/src/index.ts +293 -101
- package/tools/benchmark-live-run.mjs +193 -63
- package/lib/types/schema.d.ts +0 -18
- package/lib/types/schema.test.d.ts +0 -1
- package/lib/types/sync.d.ts +0 -47
- package/lib/types/sync.test.d.ts +0 -1
- package/presets/liangshen/custom-bash.mjs +0 -213
- package/src/schema.test.ts +0 -64
- package/src/schema.ts +0 -110
- package/src/sync.test.ts +0 -224
- package/src/sync.ts +0 -222
|
@@ -1 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The host half against a fake cordis context: announcing (issue #839) and the
|
|
3
|
+
* preset DECLARATION that replaces the pre-0.1.7 preset-file sync.
|
|
4
|
+
*
|
|
5
|
+
* Declare = enabled: activation registers the bundled preset with
|
|
6
|
+
* `ctx.agentPresets` and keeps the returned disposer, a committed settings write
|
|
7
|
+
* re-declares through `loader/volatile-update`, and unloading releases the
|
|
8
|
+
* registration. Each test re-imports the module so the mount-once guard cannot
|
|
9
|
+
* swallow a second apply call.
|
|
10
|
+
*/
|
|
1
11
|
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiangShen settings card: availability and the wire presentation. Registers
|
|
3
|
+
* into the `web-ui.plugin.item` child slot the Web UI plugin group renders,
|
|
4
|
+
* bound to the `liangshen` settings namespace (the Host profile entry id).
|
|
5
|
+
*
|
|
6
|
+
* The presentation field does not act on this client half: the Host applies it
|
|
7
|
+
* to the preset it declares to the agent-preset registry, so a session reads it
|
|
8
|
+
* from its preset. This card is the operator's only handle on it, which is why
|
|
9
|
+
* every field the Host schema carries appears here.
|
|
10
|
+
*/
|
|
11
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
12
|
+
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
13
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
14
|
+
import { type CardActions, type CardShell, type FieldState as CardFieldState } from './settings-form.ts';
|
|
15
|
+
/** Wire presentations the tool catalog accepts (mirrors the Host schema). */
|
|
16
|
+
export declare const PRESENTATION_CHOICES: readonly ["ptc", "native", "both"];
|
|
17
|
+
/** Sensitivity presets for the circuit breaker (mirrors the Host schema). */
|
|
18
|
+
export declare const SENSITIVITY_CHOICES: readonly ["conservative", "balanced", "aggressive"];
|
|
19
|
+
/** The LiangShen fields this card edits (the namespace's full schema). */
|
|
20
|
+
export interface LiangShenSettings {
|
|
21
|
+
/** Master switch for the plugin. */
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
/** Whether the plugin announces itself in every agent's system prompt. */
|
|
24
|
+
announceToAgent?: boolean;
|
|
25
|
+
/** Wire presentation the Host applies to the preset's tool-catalog row. */
|
|
26
|
+
presentation?: string;
|
|
27
|
+
/** Master switch for the runtime degeneration circuit breaker. */
|
|
28
|
+
guardEnabled?: boolean;
|
|
29
|
+
/** Sensitivity preset scaling the breaker's adaptive thresholds. */
|
|
30
|
+
guardSensitivity?: string;
|
|
31
|
+
/** Per-step reasoning-character floor for the breaker's runaway ladder. */
|
|
32
|
+
guardStallReasoningChars?: number;
|
|
33
|
+
/** Consecutive output-free reasoning steps for the breaker's slow-burn ladder. */
|
|
34
|
+
guardGlobalStallCap?: number;
|
|
35
|
+
/** Identical-argument tool failures for the breaker's echo ladder. */
|
|
36
|
+
guardEchoFailures?: number;
|
|
37
|
+
}
|
|
38
|
+
/** What the LiangShen card renders. */
|
|
39
|
+
export interface LiangShenSettingsCardState extends CardShell {
|
|
40
|
+
enabled: CardFieldState;
|
|
41
|
+
announceToAgent: CardFieldState;
|
|
42
|
+
presentation: CardFieldState;
|
|
43
|
+
guardEnabled: CardFieldState;
|
|
44
|
+
guardSensitivity: CardFieldState;
|
|
45
|
+
guardStallReasoningChars: CardFieldState;
|
|
46
|
+
guardGlobalStallCap: CardFieldState;
|
|
47
|
+
guardEchoFailures: CardFieldState;
|
|
48
|
+
}
|
|
49
|
+
/** The registration-side face the card's slot entry injects. */
|
|
50
|
+
export interface LiangShenSettingsCardFace extends CardActions {
|
|
51
|
+
hooks: {
|
|
52
|
+
/** Card snapshot bound by the renderer as useLiangShenSettingsCard. */
|
|
53
|
+
liangShenSettingsCard: SnapshotStore<LiangShenSettingsCardState>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Bridges the `liangshen` settings form onto the card's staged form. */
|
|
57
|
+
export declare class LiangShenSettingsCardController {
|
|
58
|
+
private readonly form;
|
|
59
|
+
private readonly store;
|
|
60
|
+
/** @param scope - the bound configuration form of the entry that owns this namespace. */
|
|
61
|
+
constructor(scope: ConfigForm<LiangShenSettings>);
|
|
62
|
+
private projection;
|
|
63
|
+
/**
|
|
64
|
+
* Build the face the card's slot registration injects.
|
|
65
|
+
* @returns the card's snapshot and its form actions.
|
|
66
|
+
*/
|
|
67
|
+
inject(): LiangShenSettingsCardFace;
|
|
68
|
+
/** Release the card's scope subscription and bound stores. */
|
|
69
|
+
dispose(): void;
|
|
70
|
+
}
|
|
71
|
+
/** Props the renderer binds for the LiangShen card. */
|
|
72
|
+
export type LiangShenSettingsCardProps = PropsRuntime<'web-ui.plugin.item'> & PropsLocale<'liangshen'> & InjectFace<LiangShenSettingsCardFace>;
|
|
73
|
+
/**
|
|
74
|
+
* Render the LiangShen card.
|
|
75
|
+
* @param props - locale copy, the card snapshot, and its form actions.
|
|
76
|
+
* @returns the card.
|
|
77
|
+
*/
|
|
78
|
+
export declare function LiangShenSettingsCard(props: LiangShenSettingsCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Family-shared chrome for plugin settings cards: a disclosure header naming
|
|
3
|
+
* the plugin and what its settings govern, the controls inside, and the save
|
|
4
|
+
* that writes them. Renders nothing while the namespace is unavailable — a
|
|
5
|
+
* deployment that does not compose the owning plugin should show no trace of
|
|
6
|
+
* it. Inlined into each consumer's client bundle; mirrors the official
|
|
7
|
+
* ui-plugin-config PluginCard in a self-contained slice.
|
|
8
|
+
*/
|
|
9
|
+
import { type ReactNode } from 'react';
|
|
10
|
+
import type { CardShell } from './settings-form.ts';
|
|
11
|
+
/** Copy keys the card chrome itself reads; every consumer locale carries this shared vocabulary. */
|
|
12
|
+
export declare const CARD_COPY_KEYS: readonly ["settings.collapse", "settings.expand", "settings.notExposed", "settings.unsaved", "settings.readOnly", "settings.saveFailed", "settings.discard", "settings.save", "settings.saving"];
|
|
13
|
+
/** Copy key the card chrome itself reads. */
|
|
14
|
+
export type CardCopyKey = (typeof CARD_COPY_KEYS)[number];
|
|
15
|
+
/** Key domain for the plugin's own copy (inferred per consumer). */
|
|
16
|
+
export type SettingsCardKey<TKey extends string = string> = TKey | CardCopyKey;
|
|
17
|
+
/** Card chrome shared by every plugin settings card. */
|
|
18
|
+
export interface PluginSettingsCardProps<TKey extends string = string> {
|
|
19
|
+
/** Locale reader for this card's copy. */
|
|
20
|
+
t: (key: SettingsCardKey<TKey>, params?: Record<string, string | number>) => string;
|
|
21
|
+
/** Locale key of the plugin's name. */
|
|
22
|
+
titleKey: TKey;
|
|
23
|
+
/** Locale key of the line describing what this plugin's settings govern. */
|
|
24
|
+
descriptionKey: TKey;
|
|
25
|
+
/** Optional rich header description rendered instead of the plain t(descriptionKey) text (the plain text stays as the tooltip). */
|
|
26
|
+
descriptionNode?: ReactNode;
|
|
27
|
+
/** The card's form state: availability, writability, and what a save would do. */
|
|
28
|
+
state: CardShell;
|
|
29
|
+
/** Write every staged edit. */
|
|
30
|
+
onSave: () => void;
|
|
31
|
+
/** Drop every staged edit. */
|
|
32
|
+
onDiscard: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Render the controls expanded on arrival (still collapsible). Defaults to
|
|
35
|
+
* true: promoted first-level sections show their settings immediately.
|
|
36
|
+
*/
|
|
37
|
+
defaultOpen?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Render without the collapse affordance: a static header and an always
|
|
40
|
+
* visible body. Used by first-level settings sections whose nav entry
|
|
41
|
+
* already provides the selection.
|
|
42
|
+
*/
|
|
43
|
+
alwaysOpen?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Hide the save/discard footer: cards whose body applies its own changes
|
|
46
|
+
* immediately (an embedded external settings section) have no staged
|
|
47
|
+
* edits, so the footer would sit there permanently disabled.
|
|
48
|
+
*/
|
|
49
|
+
hideFooter?: boolean;
|
|
50
|
+
/** Render children even when the settings namespace is not exposed by the host. */
|
|
51
|
+
renderChildrenWhenNotExposed?: boolean;
|
|
52
|
+
/** Hide the 'not exposed' warning banner when the settings namespace is not exposed. */
|
|
53
|
+
hideNotExposedNotice?: boolean;
|
|
54
|
+
/** The plugin's controls. */
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Render one plugin settings card.
|
|
59
|
+
* @param props - the plugin's copy keys, its form state, and its controls.
|
|
60
|
+
* @returns the card, or nothing while the namespace is still loading.
|
|
61
|
+
*/
|
|
62
|
+
export declare function PluginSettingsCard<TKey extends string = string>(props: PluginSettingsCardProps<TKey>): import("react").JSX.Element | null;
|
|
63
|
+
/** Props every field control needs regardless of its value type. */
|
|
64
|
+
export interface FieldProps {
|
|
65
|
+
/** Stable id associating the label with its control. */
|
|
66
|
+
id: string;
|
|
67
|
+
/** Visible label. */
|
|
68
|
+
label: string;
|
|
69
|
+
/** One-line explanation rendered under the control. */
|
|
70
|
+
hint: string;
|
|
71
|
+
/** Draft text this control renders. */
|
|
72
|
+
text: string;
|
|
73
|
+
/** True when saving would leave a user-layer entry for this field. */
|
|
74
|
+
overridden: boolean;
|
|
75
|
+
/** True when the draft is not a value this field accepts. */
|
|
76
|
+
invalid: boolean;
|
|
77
|
+
/** Copy for the overridden badge. */
|
|
78
|
+
overriddenLabel: string;
|
|
79
|
+
/** Copy for the reset control. */
|
|
80
|
+
resetLabel: string;
|
|
81
|
+
/** Copy shown in place of the hint while the draft is invalid. */
|
|
82
|
+
invalidLabel: string;
|
|
83
|
+
/** Disables every control (read-only document, or an unavailable namespace). */
|
|
84
|
+
disabled: boolean;
|
|
85
|
+
/** Stage draft text. */
|
|
86
|
+
onEdit: (text: string) => void;
|
|
87
|
+
/** Stage a clear so the field re-inherits the composition layer. */
|
|
88
|
+
onReset: () => void;
|
|
89
|
+
}
|
|
90
|
+
/** A staged value field. `numeric` only hints the keypad: which drafts a field accepts is decided by its spec. */
|
|
91
|
+
export declare function ValueField(props: FieldProps & {
|
|
92
|
+
/** Hints a numeric keypad without narrowing what the control accepts. */
|
|
93
|
+
numeric?: boolean;
|
|
94
|
+
/** Placeholder shown while the draft is empty. */
|
|
95
|
+
placeholder?: string;
|
|
96
|
+
}): import("react").JSX.Element;
|
|
97
|
+
interface SelectOption {
|
|
98
|
+
value: string;
|
|
99
|
+
label: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The shared dual-mode select control. While an appearance skin is active it
|
|
103
|
+
* renders the legacy native `<select>` untouched, so element-level skin
|
|
104
|
+
* selectors keep working; under the default appearance it renders a
|
|
105
|
+
* self-drawn `role="listbox"` popup whose open/close is transition-animated.
|
|
106
|
+
* Staged cards reach it through BooleanField/ChoiceField; immediate-apply
|
|
107
|
+
* editors (the side-card prefs) bind it directly through onEdit.
|
|
108
|
+
* 双模式下拉框:皮肤激活时用原生 select,默认外观用自绘动画弹层。
|
|
109
|
+
*/
|
|
110
|
+
export declare function SelectField(props: {
|
|
111
|
+
id: string;
|
|
112
|
+
options: ReadonlyArray<SelectOption>;
|
|
113
|
+
value: string;
|
|
114
|
+
disabled: boolean;
|
|
115
|
+
invalid: boolean;
|
|
116
|
+
onEdit: (text: string) => void;
|
|
117
|
+
}): import("react").JSX.Element;
|
|
118
|
+
/** A staged boolean field: 继承 / 开 / 关. */
|
|
119
|
+
export declare function BooleanField(props: FieldProps & {
|
|
120
|
+
/** Copy for the inherit option. */
|
|
121
|
+
inheritLabel: string;
|
|
122
|
+
/** Copy for the on option. */
|
|
123
|
+
onLabel: string;
|
|
124
|
+
/** Copy for the off option. */
|
|
125
|
+
offLabel: string;
|
|
126
|
+
}): import("react").JSX.Element;
|
|
127
|
+
/** A staged enumerated field rendered as a select. */
|
|
128
|
+
export declare function ChoiceField(props: FieldProps & {
|
|
129
|
+
/** Copy for the inherit option (draft text is the empty string). */
|
|
130
|
+
inheritLabel: string;
|
|
131
|
+
/** Choices rendered in order; `value` is the draft/stored text. */
|
|
132
|
+
choices: ReadonlyArray<{
|
|
133
|
+
value: string;
|
|
134
|
+
label: string;
|
|
135
|
+
}>;
|
|
136
|
+
}): import("react").JSX.Element;
|
|
137
|
+
export {};
|
|
@@ -18,14 +18,67 @@
|
|
|
18
18
|
* thrown — one external plugin must not take the GUI boot down.
|
|
19
19
|
*/
|
|
20
20
|
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
21
|
+
import type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client';
|
|
21
22
|
import { type LiangShenKey } from './locales.ts';
|
|
22
23
|
/** Locale namespace this half owns. */
|
|
23
24
|
export declare const NS = "liangshen";
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Settings namespace the settings card edits. Under the 0.1.7 settings
|
|
27
|
+
* contract the namespace IS the Host profile entry id, so this names the
|
|
28
|
+
* standalone row; the aggregate install mounts the generated
|
|
29
|
+
* `web-ui-liangshen` row instead and the family binder resolves between the
|
|
30
|
+
* two. Without that binder the card binds the entry id directly.
|
|
31
|
+
*/
|
|
32
|
+
export declare const SETTINGS_NAMESPACE = "liangshen";
|
|
33
|
+
/** Owner share of a plugin card (the section supplies nothing). */
|
|
34
|
+
export interface SettingsPluginItemOwnerProps {
|
|
35
|
+
/** Marker field: card owner props are intentionally empty. */
|
|
36
|
+
children?: never;
|
|
37
|
+
}
|
|
38
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
39
|
+
interface SlotMap {
|
|
40
|
+
/**
|
|
41
|
+
* The child slot the Web UI plugin group declares; this card registers into
|
|
42
|
+
* the group's list seat rather than the official bundle-configuration
|
|
43
|
+
* seat. Declared here so this package needs no dependency on the sibling UI
|
|
44
|
+
* package.
|
|
45
|
+
*/
|
|
46
|
+
'web-ui.plugin.item': {
|
|
47
|
+
kind: 'list';
|
|
48
|
+
scope: 'root';
|
|
49
|
+
owner: SettingsPluginItemOwnerProps;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
declare module '@deepseek-ai/cordis' {
|
|
54
|
+
interface Context {
|
|
55
|
+
/**
|
|
56
|
+
* Optional family settings binder provided by dsh-web-settings; absent when
|
|
57
|
+
* that group plugin is not installed, so callers bind the shared forms
|
|
58
|
+
* service (`ctx.configForms`) by profile entry id directly.
|
|
59
|
+
*/
|
|
60
|
+
webUiSettings?: {
|
|
61
|
+
bind<S>(spec: LiangShenFormSpec<S>): ConfigForm<S>;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* One settings namespace a family card binds. The 0.1.7 client exports no spec
|
|
67
|
+
* type (the form controller takes it privately), so the binder's input shape is
|
|
68
|
+
* restated here.
|
|
69
|
+
*/
|
|
70
|
+
export interface LiangShenFormSpec<T> {
|
|
71
|
+
/** Settings namespace registered by the owning host plugin. */
|
|
72
|
+
namespace: string;
|
|
73
|
+
/** Narrow one wire section; undefined keeps the last accepted value. */
|
|
74
|
+
decode?: (section: unknown) => T | undefined;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Required client services: the slot registry, locale, sessions, the shared
|
|
78
|
+
* configuration forms, and the roster Remote. Both `remote` and
|
|
79
|
+
* `remote.agentPresets` are declared: the context proxy refuses an uninjected
|
|
80
|
+
* service, and a nested service name does not imply its parent, so reading
|
|
81
|
+
* `ctx.remote.agentPresets` needs `remote` as well.
|
|
29
82
|
*/
|
|
30
83
|
export declare const inject: string[];
|
|
31
84
|
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The view stays pure; every fact and verb comes from here. The roster arrives
|
|
5
5
|
* over the agent-preset Remote namespace (the same one the official surfaces
|
|
6
|
-
* read), the
|
|
6
|
+
* read), the main-view session comes from the catalog's ownership marker, and the
|
|
7
7
|
* switch goes through `agentPresets.select`, which the host accepts only while
|
|
8
8
|
* the session is still blank.
|
|
9
9
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* default.
|
|
15
15
|
*/
|
|
16
16
|
import type { Context as ClientContext } from '@deepseek-ai/cordis';
|
|
17
|
-
import type { AgentPresetRoster } from '@deepseek-ai/dsh-agent-
|
|
17
|
+
import type { AgentPresetRoster } from '@deepseek-ai/dsh-agent-preset-registry/types';
|
|
18
18
|
import type { RemoteResult } from '@deepseek-ai/dsh-api-remotes/client';
|
|
19
19
|
import { type SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
20
20
|
import { type LeverState } from '../core/lever.ts';
|
|
@@ -47,6 +47,14 @@ export type LeverError =
|
|
|
47
47
|
};
|
|
48
48
|
/** How long one preset switch may stay in flight before it is reported as timed out. */
|
|
49
49
|
export declare const SELECT_TIMEOUT_MS = 10000;
|
|
50
|
+
/**
|
|
51
|
+
* Settings entry ids whose writes can move the roster this lever reads: the
|
|
52
|
+
* agent-preset registry's own entry (its default and selection policy) and this
|
|
53
|
+
* plugin's row under either install shape — the aggregate's generated row id
|
|
54
|
+
* and the standalone row id — because disabling the plugin unregisters the
|
|
55
|
+
* preset it declares.
|
|
56
|
+
*/
|
|
57
|
+
export declare const ROSTER_SETTINGS_ENTRY_IDS: readonly string[];
|
|
50
58
|
/** What the lever view renders. */
|
|
51
59
|
export interface LeverSnapshot {
|
|
52
60
|
/** Resolved lever state. */
|
|
@@ -119,6 +127,12 @@ export declare class LeverController {
|
|
|
119
127
|
refresh(): void;
|
|
120
128
|
/** The verb behind one gesture direction. */
|
|
121
129
|
private toggle;
|
|
130
|
+
/**
|
|
131
|
+
* Try to detect the active preset from the DOM hero chip or storage
|
|
132
|
+
* when session.projectionValues.agentPreset is absent.
|
|
133
|
+
*/
|
|
134
|
+
private detectPreset;
|
|
135
|
+
private rememberPrevious;
|
|
122
136
|
/** The facts one decision reads, from the live session and the roster. */
|
|
123
137
|
private facts;
|
|
124
138
|
private currentSessionId;
|
|
@@ -20,8 +20,47 @@ export declare const zh: {
|
|
|
20
20
|
'lever.failed.failed': string;
|
|
21
21
|
'burst.line1': string;
|
|
22
22
|
'burst.line2': string;
|
|
23
|
+
'settings.title': string;
|
|
24
|
+
'settings.description': string;
|
|
25
|
+
'settings.enabled': string;
|
|
26
|
+
'settings.enabledHint': string;
|
|
27
|
+
'settings.announceToAgent': string;
|
|
28
|
+
'settings.announceToAgentHint': string;
|
|
29
|
+
'settings.presentation': string;
|
|
30
|
+
'settings.presentationHint': string;
|
|
31
|
+
'settings.on': string;
|
|
32
|
+
'settings.off': string;
|
|
33
|
+
'settings.inherit': string;
|
|
34
|
+
'settings.overridden': string;
|
|
35
|
+
'settings.reset': string;
|
|
36
|
+
'settings.notExposed': string;
|
|
37
|
+
'settings.readOnly': string;
|
|
38
|
+
'settings.expand': string;
|
|
39
|
+
'settings.collapse': string;
|
|
40
|
+
'settings.save': string;
|
|
41
|
+
'settings.saving': string;
|
|
42
|
+
'settings.discard': string;
|
|
43
|
+
'settings.unsaved': string;
|
|
44
|
+
'settings.saveFailed': string;
|
|
45
|
+
'settings.invalidValue': string;
|
|
46
|
+
'presentation.ptc': string;
|
|
47
|
+
'presentation.native': string;
|
|
48
|
+
'presentation.both': string;
|
|
49
|
+
'settings.guardEnabled': string;
|
|
50
|
+
'settings.guardEnabledHint': string;
|
|
51
|
+
'settings.guardStallChars': string;
|
|
52
|
+
'settings.guardStallCharsHint': string;
|
|
53
|
+
'settings.guardGlobalCap': string;
|
|
54
|
+
'settings.guardGlobalCapHint': string;
|
|
55
|
+
'settings.guardSensitivity': string;
|
|
56
|
+
'settings.guardSensitivityHint': string;
|
|
57
|
+
'sensitivity.conservative': string;
|
|
58
|
+
'sensitivity.balanced': string;
|
|
59
|
+
'sensitivity.aggressive': string;
|
|
60
|
+
'settings.guardEchoFailures': string;
|
|
61
|
+
'settings.guardEchoFailuresHint': string;
|
|
23
62
|
};
|
|
24
63
|
/** English counterpart; the key set mirrors {@link zh} exactly. */
|
|
25
64
|
export declare const en: Record<keyof typeof zh, string>;
|
|
26
|
-
/**
|
|
65
|
+
/** Every key in the locale catalog. */
|
|
27
66
|
export type LiangShenKey = keyof typeof zh;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main-view Session derivation for the multi-instance Client Session model.
|
|
3
|
+
*
|
|
4
|
+
* The Client Session Controller carries no global "current" selection: view
|
|
5
|
+
* selection belongs to the workspace UI, which owns the main-area reference and
|
|
6
|
+
* publishes it through the catalog's per-source ownership counts
|
|
7
|
+
* (`SessionSummary.retainedBy.mainView`). A plugin that needs the Session the
|
|
8
|
+
* main view shows derives it from that marker instead of the removed
|
|
9
|
+
* `SessionListState.current` field.
|
|
10
|
+
*
|
|
11
|
+
* The marker describes view ownership, not authority. It is the right input for
|
|
12
|
+
* presentation and for deciding which view a navigation targets; it is not a
|
|
13
|
+
* business fallback, because source counts never imply visibility or success.
|
|
14
|
+
* @module dsh-web/shared/main-session
|
|
15
|
+
*/
|
|
16
|
+
/** The catalog row subset this helper reads (a `SessionSummary` projection). */
|
|
17
|
+
export interface MainViewOwnedRow<Id extends string = string> {
|
|
18
|
+
/** Catalog row identity. */
|
|
19
|
+
readonly id: Id;
|
|
20
|
+
/** Per-source local ownership counts; absent rows are never owned. */
|
|
21
|
+
readonly retainedBy?: Readonly<Partial<Record<string, number>>> | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the Session the main view currently shows.
|
|
25
|
+
*
|
|
26
|
+
* Reads the catalog's rows rather than a per-id retain-info source: ownership
|
|
27
|
+
* counts ride the list snapshot, so this neither allocates observers nor opens
|
|
28
|
+
* history, and a subscription to the list still fires when the selection moves.
|
|
29
|
+
* @param byId - the session catalog's rows (`SessionListState.byId`), when available.
|
|
30
|
+
* @returns the main-view session id, or undefined when the main view shows none.
|
|
31
|
+
*/
|
|
32
|
+
export declare function mainViewSessionId<Id extends string>(byId: Readonly<Record<Id, MainViewOwnedRow<Id> | undefined>> | undefined | null): Id | undefined;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Family plugin-card seat.
|
|
3
|
+
*
|
|
4
|
+
* A family plugin contributes its settings card to whichever plugin-card seat
|
|
5
|
+
* the running host actually renders:
|
|
6
|
+
*
|
|
7
|
+
* - `web-ui.plugin.item` — the list seat declared by the dsh-web-settings
|
|
8
|
+
* group section (this family's own first-level "Web UI plugins" section);
|
|
9
|
+
* - `plugins.bundle.config` — the official keyed seat of the harness's plugin
|
|
10
|
+
* manager page, keyed by the bundle's package name and rendered on that
|
|
11
|
+
* bundle's page. alpha.2 removed the `settings.plugin.item` keyed seat of the
|
|
12
|
+
* `ui-settings-plugins` tab that this helper used before, so a card keyed by
|
|
13
|
+
* its settings namespace has no seat to land in any more.
|
|
14
|
+
*
|
|
15
|
+
* SEAT SELECTION IS NOT A DECLARATION PROBE. The official plugin surface
|
|
16
|
+
* belongs to the harness bundle and declares its seats before any external
|
|
17
|
+
* plugin's `apply()` runs, so "is the official seat declared?" answers yes even
|
|
18
|
+
* in the deployment whose whole point is the family group. Choosing on that
|
|
19
|
+
* probe sends every family card to the official page and leaves the group's own
|
|
20
|
+
* section permanently empty — the family of reports where the section renders
|
|
21
|
+
* its heading and zero cards.
|
|
22
|
+
*
|
|
23
|
+
* The signal that actually distinguishes the two deployments is whether
|
|
24
|
+
* dsh-web-settings is loaded: it is the package that owns the group section and
|
|
25
|
+
* it publishes the `webUiSettings` service during `apply()`, which every
|
|
26
|
+
* family plugin already reads for its settings form. Group loaded -> the family
|
|
27
|
+
* seat; group absent -> the official seat.
|
|
28
|
+
*
|
|
29
|
+
* The decision is re-evaluated on every `slots/changed` because the group may
|
|
30
|
+
* apply after this plugin (the family aggregate orders it first, a profile that
|
|
31
|
+
* installs the group separately need not): the initial contribution goes to the
|
|
32
|
+
* official seat, then moves to the family seat the moment the group's section
|
|
33
|
+
* registers. The entry is disposed before the replacement is registered, so a
|
|
34
|
+
* card is never in two seats at once.
|
|
35
|
+
*
|
|
36
|
+
* The shared tree has no client-SDK dependency, so this module reads its
|
|
37
|
+
* context through the structural shape below; callers pass the plugin's own
|
|
38
|
+
* `ctx`.
|
|
39
|
+
*/
|
|
40
|
+
/** The family list seat key. */
|
|
41
|
+
export declare const FAMILY_PLUGIN_CARD_SEAT = "web-ui.plugin.item";
|
|
42
|
+
/** The official keyed plugin-card seat key (the alpha.2 bundle-configuration seat). */
|
|
43
|
+
export declare const OFFICIAL_PLUGIN_CARD_SEAT = "plugins.bundle.config";
|
|
44
|
+
/** The service dsh-web-settings publishes while it is loaded. */
|
|
45
|
+
export declare const FAMILY_GROUP_SERVICE = "webUiSettings";
|
|
46
|
+
/** The slot-registry member this helper uses (structurally satisfied by ctx.slots). */
|
|
47
|
+
export interface PluginCardSlots {
|
|
48
|
+
/** Contribution of one card entry. */
|
|
49
|
+
register(options: never, component: never): unknown;
|
|
50
|
+
}
|
|
51
|
+
/** The slice of the client context a card contribution needs. */
|
|
52
|
+
export interface PluginCardContext {
|
|
53
|
+
slots: PluginCardSlots;
|
|
54
|
+
/** Service lookup; absent on a context double that only models the slots. */
|
|
55
|
+
get?(name: string): unknown;
|
|
56
|
+
/** Event subscription seat; absent on an event-less test double. */
|
|
57
|
+
on?(event: string, listener: (...args: never[]) => void): unknown;
|
|
58
|
+
}
|
|
59
|
+
/** Owner share of a family list-seat card (that seat supplies nothing). */
|
|
60
|
+
export interface SettingsPluginItemOwnerProps {
|
|
61
|
+
/** Marker field: card owner props are intentionally empty. */
|
|
62
|
+
children?: never;
|
|
63
|
+
}
|
|
64
|
+
/** One family plugin's card contribution. */
|
|
65
|
+
export interface PluginCardSeat {
|
|
66
|
+
/**
|
|
67
|
+
* Npm package name of the bundle this card configures; the official keyed
|
|
68
|
+
* seat dispatches on it. Every family package ships its own bundle patch, so
|
|
69
|
+
* a standalone install lists that package as the bundle whose page renders
|
|
70
|
+
* this card.
|
|
71
|
+
*/
|
|
72
|
+
bundle: string;
|
|
73
|
+
/** Family list-seat entry id. */
|
|
74
|
+
id: string;
|
|
75
|
+
/** Family list-seat sort order. */
|
|
76
|
+
order?: number;
|
|
77
|
+
/** Family list-seat display label; the official keyed seat carries none. */
|
|
78
|
+
label?: () => string;
|
|
79
|
+
/** Locale namespace the card renders with. */
|
|
80
|
+
locale: string;
|
|
81
|
+
/** Business-face factory of the registration. */
|
|
82
|
+
inject?: () => object;
|
|
83
|
+
/**
|
|
84
|
+
* The card component. Its props type is the seat's composed shape, which is
|
|
85
|
+
* chosen at runtime, so the helper takes it erased; the registrant keeps its
|
|
86
|
+
* own precise typing at the call site.
|
|
87
|
+
*/
|
|
88
|
+
component: unknown;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Whether the family group (dsh-web-settings) is loaded in this page. The
|
|
92
|
+
* service is the group package's own contract, so the probe cannot be fooled
|
|
93
|
+
* by a harness release that starts declaring the official seat differently.
|
|
94
|
+
*/
|
|
95
|
+
export declare function familyGroupLoaded(ctx: PluginCardContext): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Contribute one family plugin card to the seat this host renders, following
|
|
98
|
+
* the group if it loads later. The entry is disposed and re-registered on a
|
|
99
|
+
* seat change, never duplicated.
|
|
100
|
+
* @param ctx - client context (its slot registry decides the seat).
|
|
101
|
+
* @param seat - the card contribution.
|
|
102
|
+
*/
|
|
103
|
+
export declare function installPluginCard(ctx: PluginCardContext, seat: PluginCardSeat): void;
|