dsh-connect 0.9.0 → 0.9.2
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 +119 -18
- package/README.zh.md +87 -13
- package/client/client.js +18 -15
- package/client/client.js.map +2 -2
- package/client/settings-client.mjs +22 -13
- package/lib/channels/dingtalk/index.d.ts +49 -49
- package/lib/channels/dingtalk/index.d.ts.map +1 -1
- package/lib/channels/feishu/adapter.d.ts +8 -1
- package/lib/channels/feishu/adapter.d.ts.map +1 -1
- package/lib/channels/feishu/adapter.js +120 -39
- package/lib/channels/feishu/adapter.js.map +1 -1
- package/lib/channels/feishu/index.d.ts +27 -27
- package/lib/channels/feishu/index.d.ts.map +1 -1
- package/lib/channels/telegram/index.d.ts +13 -13
- package/lib/channels/telegram/index.d.ts.map +1 -1
- package/lib/channels/web/adapter.d.ts +3 -1
- package/lib/channels/web/adapter.d.ts.map +1 -1
- package/lib/channels/web/adapter.js +3 -1
- package/lib/channels/web/adapter.js.map +1 -1
- package/lib/channels/web/index.d.ts +5 -5
- package/lib/channels/web/index.d.ts.map +1 -1
- package/lib/index.d.ts +42 -58
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +162 -57
- package/lib/index.js.map +1 -1
- package/lib/interaction.d.ts +90 -50
- package/lib/interaction.d.ts.map +1 -1
- package/lib/interaction.js +233 -272
- package/lib/interaction.js.map +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +7 -1
- package/lib/retry.js.map +1 -1
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +0 -2
- package/lib/service.js.map +1 -1
- package/lib/settings/legacy-import.d.ts +190 -0
- package/lib/settings/legacy-import.d.ts.map +1 -0
- package/lib/settings/legacy-import.js +373 -0
- package/lib/settings/legacy-import.js.map +1 -0
- package/lib/settings/namespace.d.ts +204 -116
- package/lib/settings/namespace.d.ts.map +1 -1
- package/lib/settings/namespace.js +235 -148
- package/lib/settings/namespace.js.map +1 -1
- package/lib/settings/settings-model.d.ts.map +1 -1
- package/lib/settings/settings-model.js +10 -1
- package/lib/settings/settings-model.js.map +1 -1
- package/lib/settings/settings-service.d.ts +13 -0
- package/lib/settings/settings-service.d.ts.map +1 -1
- package/lib/settings/settings-service.js +73 -4
- package/lib/settings/settings-service.js.map +1 -1
- package/lib/types.d.ts +14 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +12 -11
|
@@ -1,105 +1,195 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `dsh-connect` user-settings
|
|
2
|
+
* The `dsh-connect` user-settings seam.
|
|
3
3
|
*
|
|
4
|
-
* DSH
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* provider, and `scope.watch()` tells the plugin to re-read.
|
|
4
|
+
* DSH 0.2 replaced the plugin-facing settings API. The old `ctx.settings`
|
|
5
|
+
* namespace contract (`installSection(owner, ns, schema, entry, hooks)` backed by
|
|
6
|
+
* a `$DSH_HOME/settings.yaml` section keyed by the plugin *name*) is gone; what
|
|
7
|
+
* is left is `SettingsForms`, which edits a plugin's **profile entry** and
|
|
8
|
+
* hot-commits the fields that plugin declared `volatile`:
|
|
10
9
|
*
|
|
11
|
-
*
|
|
10
|
+
* - **Reads come from our own config.** A field declared with
|
|
11
|
+
* `z.…volatile()` arrives in `apply()` as a *reference* (`{ get() }`) rather
|
|
12
|
+
* than a value, and the loader updates that reference in place when the
|
|
13
|
+
* profile entry changes — no remount, no `apply()` re-entry. So there is no
|
|
14
|
+
* read API to call: the live state is `refs.get()`, and this module's
|
|
15
|
+
* `materializeConfig()` turns the ref-carrying config into a plain snapshot.
|
|
16
|
+
* - **Writes go through `SettingsForms.replace(ns, section)`**, where `ns` is
|
|
17
|
+
* the profile entry id (`connect`) — *not* the package name. `replace` resets
|
|
18
|
+
* every live field to its inherited value and then applies the supplied ones,
|
|
19
|
+
* which is exactly "this is the user's complete visible config" — and why a
|
|
20
|
+
* *partial* section is a destructive write: a field the caller omits is
|
|
21
|
+
* reset, not preserved. Callers that mean to preserve something must merge
|
|
22
|
+
* it in first ({@link mergeSections}).
|
|
23
|
+
* - **`volatileForm(schema)` must not be empty**, or `replace` refuses the
|
|
24
|
+
* write with `Plugin entry "connect" has no volatile fields`. That is why
|
|
25
|
+
* `paneConfigFields()` exists and must keep declaring the pane's field set.
|
|
12
26
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* `settings.yaml` with a typo must degrade to the plugin config, not abort
|
|
22
|
-
* the plugin's `apply`.
|
|
27
|
+
* **Only volatile *leaves* may be declared — never a volatile container.**
|
|
28
|
+
* `projectForm(form, base)` projects the *base* layer down to volatile fields
|
|
29
|
+
* before the write is merged: if `feishu` itself were volatile it would be
|
|
30
|
+
* copied whole into the settings document, `appSecret` and all. Declaring the
|
|
31
|
+
* leaves keeps every non-pane key (`appSecret`, `appId`, …) in the raw
|
|
32
|
+
* remainder, where `strip()` leaves ordinary config untouched. This is the same
|
|
33
|
+
* hazard `sectionOf()` guards on the write path, from the other side: an
|
|
34
|
+
* undeclared key in a *submitted* section must not reach the document either.
|
|
23
35
|
*
|
|
24
|
-
*
|
|
25
|
-
* credential store (`ctx.credentials`), which is where
|
|
26
|
-
*
|
|
27
|
-
* plain
|
|
28
|
-
* projects secret keys *out* of the base for the same reason — schemastery
|
|
29
|
-
* preserves undeclared keys verbatim, so anything left in the base rides out
|
|
30
|
-
* through `describe()` and the settings RPC. The same projection guards the
|
|
31
|
-
* write path (`LiveConnectSection.write`), which is the mirror hazard: an
|
|
32
|
-
* undeclared key in a *submitted* section would be preserved into the document.
|
|
33
|
-
*
|
|
34
|
-
* `installSection` returns nothing, so the write handle it hands back is built
|
|
35
|
-
* here: `setSource` already wires a thunk onto `scope.get()`, which reads the
|
|
36
|
-
* registration's resolved value at call time — live in both directions.
|
|
36
|
+
* Secrets therefore never appear in either declared surface: they live in the
|
|
37
|
+
* DSH credential store (`ctx.credentials`), which is where onboarding and the
|
|
38
|
+
* `FEISHU_*`-style env layering already put them, and `settings`-side documents
|
|
39
|
+
* are plain files users are invited to paste into bug reports.
|
|
37
40
|
*
|
|
38
41
|
* @module dsh-connect/settings/namespace
|
|
39
42
|
*/
|
|
40
43
|
import z from "@deepseek-ai/schemastery";
|
|
41
44
|
import { CHANNELS } from "./channels.js";
|
|
42
|
-
import { CHANNEL_CONFIG_FIELDS, CHANNEL_DEFAULT_FIELDS
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
45
|
+
import { CHANNEL_CONFIG_FIELDS, CHANNEL_DEFAULT_FIELDS } from "./settings-model.js";
|
|
46
|
+
/**
|
|
47
|
+
* The section key the pre-0.2 harness read from `$DSH_HOME/settings.yaml`, keyed
|
|
48
|
+
* by plugin *name*. Nothing writes it any more; `legacy-import.ts` reads it once
|
|
49
|
+
* so an upgrading user's pane settings survive the switch to the new store.
|
|
50
|
+
*/
|
|
51
|
+
export const LEGACY_CONNECT_SECTION = "dsh-connect";
|
|
52
|
+
/**
|
|
53
|
+
* The automatic-page policy for our entry. `auto: false` stops the host's
|
|
54
|
+
* Plugins page from generating a second, generic form for `connect`: this
|
|
55
|
+
* plugin ships its own client pane (`client/settings-client.mjs`), and two
|
|
56
|
+
* editors writing the same fields through different UIs is how a save silently
|
|
57
|
+
* reverts. Register it with `settings.configure(policy, ctx.fiber)` — the
|
|
58
|
+
* `owner` argument matters, see `index.ts`.
|
|
59
|
+
*/
|
|
60
|
+
export const CONNECT_PRESENTATION = { auto: false };
|
|
61
|
+
/**
|
|
62
|
+
* The shared cross-ESM volatile protocol (`cosmokit`'s `Symbol.for` key).
|
|
63
|
+
*
|
|
64
|
+
* Looked up by symbol rather than by importing `@deepseek-ai/cosmokit`: the
|
|
65
|
+
* host may hand us refs created by *its* copy of the library, and `Symbol.for`
|
|
66
|
+
* is the one identifier that is identical across copies. Sniffing the key (as
|
|
67
|
+
* cosmokit's own `isVolatile` does) is more forgiving than `instanceof`, which
|
|
68
|
+
* would fail across an ESM/CJS duplicate.
|
|
69
|
+
*/
|
|
70
|
+
const VOLATILE_WRITE = Symbol.for("cosmokit.volatile.write");
|
|
71
|
+
/** Whether a parsed config value is a volatile reference rather than plain data. */
|
|
72
|
+
export function isConfigRef(value) {
|
|
73
|
+
return typeof value === "object" && value !== null && VOLATILE_WRITE in value;
|
|
63
74
|
}
|
|
64
75
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* and a field that the pane exposes can never be silently unrepresentable in
|
|
69
|
-
* `settings.yaml`.
|
|
76
|
+
* Copy a ref-carrying config into plain data: every reference replaced by its
|
|
77
|
+
* current snapshot, recursively, so callers can hand the result to code that
|
|
78
|
+
* only understands plain objects (the adapters, the settings pane, tests).
|
|
70
79
|
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
80
|
+
* The copy is *fresh* rather than the snapshot itself, deliberately: snapshots
|
|
81
|
+
* are deeply frozen, and both `ChannelRuntime` (which spreads a channel's
|
|
82
|
+
* config into a new object) and the pane (which holds a form to edit) want
|
|
83
|
+
* mutable data. Cycles in ordinary config are tolerated via `seen`; a snapshot
|
|
84
|
+
* cannot contain references (the loader commits plain data), but the walk
|
|
85
|
+
* treats them uniformly so it does not matter.
|
|
86
|
+
*
|
|
87
|
+
* **A key that materializes to `undefined` is dropped, not copied.** Every
|
|
88
|
+
* declared volatile leaf is present in the parsed config even when the profile
|
|
89
|
+
* never set it — `z.object({transport: z.any().volatile()})` resolves an absent
|
|
90
|
+
* `transport` to a reference to `undefined` — so a faithful copy would hand the
|
|
91
|
+
* adapters `{transport: undefined, language: undefined, …}`. That is not the
|
|
92
|
+
* same as absent: `ChannelRuntime` resolves a channel as
|
|
93
|
+
* `{...channelDefaults, ...overrides}`, and since `language` is a key of *both*
|
|
94
|
+
* tables, a channel's own `language: undefined` would mask the shared
|
|
95
|
+
* `channelDefaults.language` every other channel still gets. Config here is
|
|
96
|
+
* JSON-shaped (a profile entry, a YAML document, the settings RPC), where
|
|
97
|
+
* `undefined` can only ever mean "this key was not set", so dropping it restores
|
|
98
|
+
* exactly the shape a plain `z.any()` field used to produce.
|
|
75
99
|
*/
|
|
76
|
-
export
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
100
|
+
export function materializeConfig(value) {
|
|
101
|
+
return walk(value, new WeakMap());
|
|
102
|
+
}
|
|
103
|
+
function walk(value, seen) {
|
|
104
|
+
if (value === null || typeof value !== "object")
|
|
105
|
+
return value;
|
|
106
|
+
if (isConfigRef(value))
|
|
107
|
+
return walk(value.get(), seen);
|
|
108
|
+
const known = seen.get(value);
|
|
109
|
+
if (known !== undefined)
|
|
110
|
+
return known;
|
|
111
|
+
if (Array.isArray(value)) {
|
|
112
|
+
const out = [];
|
|
113
|
+
seen.set(value, out);
|
|
114
|
+
for (const item of value)
|
|
115
|
+
out.push(walk(item, seen));
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
const out = {};
|
|
119
|
+
seen.set(value, out);
|
|
120
|
+
for (const [key, child] of Object.entries(value)) {
|
|
121
|
+
const materialized = walk(child, seen);
|
|
122
|
+
if (materialized !== undefined)
|
|
123
|
+
out[key] = materialized;
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
84
127
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
128
|
+
* The volatile half of the plugin `Config`, derived from the same field tables
|
|
129
|
+
* the settings pane renders. Deriving rather than restating them is the point:
|
|
130
|
+
* a field added to `CHANNEL_CONFIG_FIELDS` becomes user-editable *and*
|
|
131
|
+
* hot-appliable in one edit, and a field the pane offers can never be missing
|
|
132
|
+
* from the schema (a write of an undeclared path is refused by the host).
|
|
87
133
|
*
|
|
88
|
-
* `
|
|
89
|
-
* `
|
|
134
|
+
* Every leaf is `z.any()` on purpose. A stricter node would let a stale value
|
|
135
|
+
* in a profile — a `webhookPort` written as a string, a `dmMode` from a version
|
|
136
|
+
* that spelled it differently — abort config validation and keep the bridge
|
|
137
|
+
* from loading at all. The pane's own `coerceConfigValue` is what keeps types
|
|
138
|
+
* honest; the schema's job here is only to say "these paths are live-editable".
|
|
90
139
|
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
140
|
+
* `channels` is a loose `z.array(z.string())` for the same reason, and it is
|
|
141
|
+
* safe because `ChannelRuntime` skips a name it has no adapter for (with a log
|
|
142
|
+
* line) instead of throwing. Its explicit `.default([...CHANNELS])` is load
|
|
143
|
+
* bearing, not cosmetic: a volatile *array* resolves an absent key to `[]`
|
|
144
|
+
* rather than `undefined`, so a profile that never set `channels` would
|
|
145
|
+
* otherwise materialize an empty list and start no adapter at all, where the
|
|
146
|
+
* documented default — and the pre-volatile behaviour — is every channel. A
|
|
147
|
+
* default also keeps `replace()`'s reset target honest: an omitted `channels`
|
|
148
|
+
* in a section resets to all channels, not to none. `[...CHANNELS]` rather than
|
|
149
|
+
* `CHANNELS` so the schema cannot hand out the module's own array.
|
|
150
|
+
*/
|
|
151
|
+
export function paneConfigFields() {
|
|
152
|
+
const fields = {
|
|
153
|
+
channels: z.array(z.string()).default([...CHANNELS]).volatile(),
|
|
154
|
+
};
|
|
155
|
+
const defaults = {};
|
|
156
|
+
for (const field of CHANNEL_DEFAULT_FIELDS)
|
|
157
|
+
defaults[field.key] = z.any().volatile();
|
|
158
|
+
fields.channelDefaults = z.object(defaults);
|
|
159
|
+
for (const name of CHANNELS) {
|
|
160
|
+
const channel = {};
|
|
161
|
+
for (const field of CHANNEL_CONFIG_FIELDS[name])
|
|
162
|
+
channel[field.key] = z.any().volatile();
|
|
163
|
+
if (Object.keys(channel).length > 0)
|
|
164
|
+
fields[name] = z.object(channel);
|
|
165
|
+
}
|
|
166
|
+
return fields;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Project a config onto the pane's field set: declared, non-secret keys only.
|
|
170
|
+
*
|
|
171
|
+
* Two callers, one guard. For a **read** the input is a materialized snapshot
|
|
172
|
+
* of our own config (a profile may legitimately carry `appSecret`, and it must
|
|
173
|
+
* not travel out through the snapshot the pane receives); for a **write** the
|
|
174
|
+
* input is untrusted JSON from the settings RPC, and an undeclared key would
|
|
175
|
+
* otherwise be preserved into the profile by schemastery's passthrough. Both
|
|
176
|
+
* are the same projection, so both get the same answer.
|
|
95
177
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
178
|
+
* `channels` is emitted unconditionally on the write path because an absent
|
|
179
|
+
* array resolves to `[]` (schemastery's array default), which would read as
|
|
180
|
+
* "activate nothing". Unknown channel names are dropped rather than refused:
|
|
181
|
+
* a name this version does not know is not a reason to reject the whole save.
|
|
99
182
|
*/
|
|
100
|
-
export function sectionOf(config) {
|
|
183
|
+
export function sectionOf(config, options = {}) {
|
|
101
184
|
const source = (config !== null && typeof config === "object" ? config : {});
|
|
102
|
-
const section = {
|
|
185
|
+
const section = {};
|
|
186
|
+
const rawChannels = source.channels;
|
|
187
|
+
if (Array.isArray(rawChannels)) {
|
|
188
|
+
section.channels = rawChannels.filter((name) => CHANNELS.includes(name));
|
|
189
|
+
}
|
|
190
|
+
else if (options.defaultChannels !== false) {
|
|
191
|
+
section.channels = [...CHANNELS];
|
|
192
|
+
}
|
|
103
193
|
const defaults = {};
|
|
104
194
|
const rawDefaults = (source.channelDefaults ?? {});
|
|
105
195
|
for (const field of CHANNEL_DEFAULT_FIELDS) {
|
|
@@ -121,80 +211,77 @@ export function sectionOf(config) {
|
|
|
121
211
|
return section;
|
|
122
212
|
}
|
|
123
213
|
/**
|
|
124
|
-
*
|
|
214
|
+
* Layer one section over another: for each channel and for the shared defaults,
|
|
215
|
+
* the override's own keys win and the base's surviving keys are kept.
|
|
216
|
+
*
|
|
217
|
+
* This exists because of how `replace()` treats an omission — see the module
|
|
218
|
+
* doc. A caller that has a section in force and only wants to change part of it
|
|
219
|
+
* must merge, never pass the part alone: `feishu: { transport }` resets every
|
|
220
|
+
* other declared `feishu` field, and a section without `channels` resets the
|
|
221
|
+
* channel list itself, which switches every adapter off.
|
|
222
|
+
*/
|
|
223
|
+
export function mergeSections(base, override) {
|
|
224
|
+
const merged = {};
|
|
225
|
+
const channels = override.channels ?? base.channels;
|
|
226
|
+
if (channels !== undefined)
|
|
227
|
+
merged.channels = [...channels];
|
|
228
|
+
const defaults = { ...base.channelDefaults, ...override.channelDefaults };
|
|
229
|
+
if (Object.keys(defaults).length > 0)
|
|
230
|
+
merged.channelDefaults = defaults;
|
|
231
|
+
for (const name of CHANNELS) {
|
|
232
|
+
const fields = { ...base[name], ...override[name] };
|
|
233
|
+
if (Object.keys(fields).length > 0)
|
|
234
|
+
merged[name] = fields;
|
|
235
|
+
}
|
|
236
|
+
return merged;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Wire the plugin's config references to the host's settings service.
|
|
125
240
|
*
|
|
126
|
-
* Never throws
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
241
|
+
* Never throws. A host without `SettingsForms`, a context where the entry id
|
|
242
|
+
* cannot be resolved (a bare unit-test context, or a plugin mounted outside the
|
|
243
|
+
* loader) and a refused `replace` all degrade to `live: false` with one warning
|
|
244
|
+
* line — a settings integration that cannot work must never be the reason a
|
|
245
|
+
* bridge fails to start.
|
|
130
246
|
*/
|
|
131
247
|
export function installConnectSection(options) {
|
|
132
|
-
const { settings,
|
|
133
|
-
const entrySection = sectionOf(entry);
|
|
248
|
+
const { settings, config, ns, onChange } = options;
|
|
134
249
|
const warn = (message) => {
|
|
135
250
|
options.owner.logger?.warn?.(`connect: ${message}`);
|
|
136
251
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
settings
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
onChange: () => onChange(source()),
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
// Two reachable causes, both handled the same way:
|
|
154
|
-
// - a stored section that fails the schema (a hand-edited settings.yaml);
|
|
155
|
-
// - the namespace is already registered by an earlier fiber. `register`
|
|
156
|
-
// is an effect on the *settings service*, which outlives a plugin
|
|
157
|
-
// reload, so a live config reload lands here.
|
|
158
|
-
// `get()` returns the previously resolved value in the second case, which
|
|
159
|
-
// keeps the user's saved settings effective — only the live watch is gone
|
|
160
|
-
// until the process restarts.
|
|
161
|
-
const resolved = readRegistered(settings);
|
|
162
|
-
if (resolved !== undefined) {
|
|
163
|
-
warn(`settings namespace "${CONNECT_SETTINGS_NS}" is already registered ` +
|
|
164
|
-
`(the plugin reloaded without a host restart); using the saved section — ` +
|
|
165
|
-
`restart dsh to re-enable live settings updates`);
|
|
166
|
-
onChange(resolved);
|
|
167
|
-
return { live: false, section: resolved };
|
|
252
|
+
const read = () => sectionOf(materializeConfig(config));
|
|
253
|
+
const section = read();
|
|
254
|
+
const replace = settings?.replace?.bind(settings);
|
|
255
|
+
if (replace === undefined || ns === undefined) {
|
|
256
|
+
// Two different situations, one outcome. No settings service at all is the
|
|
257
|
+
// normal bare-context case and needs no line. A *present* service with no
|
|
258
|
+
// resolvable entry id is a real misconfiguration: the pane would silently
|
|
259
|
+
// stop persisting, so say so once.
|
|
260
|
+
if (settings !== undefined && ns === undefined) {
|
|
261
|
+
warn("settings service is present but this plugin's profile entry id could not be resolved; " +
|
|
262
|
+
"the settings pane will fall back to its state file");
|
|
168
263
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
onChange(entrySection);
|
|
172
|
-
return { live: false, section: entrySection };
|
|
264
|
+
onChange(section);
|
|
265
|
+
return { live: false, section };
|
|
173
266
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}),
|
|
267
|
+
const handle = {
|
|
268
|
+
read,
|
|
269
|
+
write: async (value) => {
|
|
270
|
+
// Materialize first so the write path is shape-agnostic: handed this
|
|
271
|
+
// plugin's own ref-carrying `config` (a plausible caller mistake), a raw
|
|
272
|
+
// `sectionOf` would see `channels` as a reference rather than an array,
|
|
273
|
+
// read it as absent and project *every* channel — turning an unrelated
|
|
274
|
+
// save into "enable all adapters". Cheap, and it is a save, not a hot path.
|
|
275
|
+
await replace(ns, sectionOf(materializeConfig(value)));
|
|
276
|
+
// The loader commits the volatile paths into these references and emits
|
|
277
|
+
// `loader/volatile-update`; reconciling here as well makes a write take
|
|
278
|
+
// effect even on a host that does not dispatch it. A repeat apply of the
|
|
279
|
+
// same values is a no-op (`ChannelRuntime` diffs before it restarts
|
|
280
|
+
// anything), so the belt is free.
|
|
281
|
+
onChange(read());
|
|
282
|
+
},
|
|
191
283
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
function readRegistered(settings) {
|
|
195
|
-
const value = settings.get?.(CONNECT_SETTINGS_NS);
|
|
196
|
-
if (value === null || typeof value !== "object")
|
|
197
|
-
return undefined;
|
|
198
|
-
return value;
|
|
284
|
+
onChange(section);
|
|
285
|
+
return { live: true, section, handle };
|
|
199
286
|
}
|
|
200
287
|
//# sourceMappingURL=namespace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../src/settings/namespace.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../src/settings/namespace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAqC,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEpF;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA4B,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAE7E;;;;;;;;GAQG;AACH,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAQ7D,oFAAoF;AACpF,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,cAAc,IAAI,KAAK,CAAC;AAChF,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,iBAAiB,CAAI,KAAQ;IAC3C,OAAO,IAAI,CAAC,KAAK,EAAE,IAAI,OAAO,EAAE,CAAM,CAAC;AACzC,CAAC;AAED,SAAS,IAAI,CAAI,KAAQ,EAAE,IAA8B;IACvD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,IAAI,WAAW,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC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M,CAAC;IAC3B,8FAA8F;IAC9F,IAAI,EAAE,OAAO,CAAC;CACf;AAED,8CAA8C;AAC9C,wBAAgB,cAAc,CAAC,QAAQ,EAAE,gBAAgB,GAAG,YAAY,CA8BvE;AASD,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAU3E;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,EAAE,CAM9G"}
|
|
@@ -64,9 +64,18 @@ export function coerceConfigValue(kind, raw) {
|
|
|
64
64
|
export function snapshotToForm(snapshot) {
|
|
65
65
|
const config = snapshot.config ?? {};
|
|
66
66
|
const channels = (snapshot.enabled ?? []);
|
|
67
|
+
// Seeded for *every* channel the pane knows, not only the enabled ones. A
|
|
68
|
+
// save is a whole-section replace: a declared channel block the payload omits
|
|
69
|
+
// is reset to its inherited value (see `namespace.ts`). Seeding from
|
|
70
|
+
// `enabled` alone therefore meant that switching a channel off and saving —
|
|
71
|
+
// for any reason, even one unrelated to that channel — silently reset every
|
|
72
|
+
// declared field of it (`transport`, `dmMode`, `webhookPort`, …), with
|
|
73
|
+
// nothing in the UI to suggest it. Rendering a switched-off channel's stored
|
|
74
|
+
// values is also simply more honest than showing it blank.
|
|
67
75
|
const channelConfigs = {};
|
|
68
|
-
for (const ch of
|
|
76
|
+
for (const ch of Object.keys(CHANNEL_CONFIG_FIELDS)) {
|
|
69
77
|
channelConfigs[ch] = (config[ch] ?? {});
|
|
78
|
+
}
|
|
70
79
|
return {
|
|
71
80
|
channels,
|
|
72
81
|
channelDefaults: (config.channelDefaults ?? {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-model.js","sourceRoot":"","sources":["../../src/settings/settings-model.ts"],"names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AAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -25,6 +25,19 @@ export interface SettingsServiceOptions {
|
|
|
25
25
|
* after a user plugin), so the handle does not exist yet at construction time.
|
|
26
26
|
*/
|
|
27
27
|
live?: () => LiveConnectSection | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Called after a credential write lands in the store, so the running adapters
|
|
30
|
+
* pick the new secret up.
|
|
31
|
+
*
|
|
32
|
+
* Writing the store is not enough on its own: an adapter holds the secret it
|
|
33
|
+
* was started with, and the only thing that re-applies one is the plugin's
|
|
34
|
+
* `reconcile` — which the settings namespace fires on a *config* write. The
|
|
35
|
+
* pane saves config and credentials as two separate calls, so without this
|
|
36
|
+
* hook a rotated `appSecret` stayed inert until the next host restart while
|
|
37
|
+
* the pane reported 「已保存」 — the user's fix for a broken bot would appear
|
|
38
|
+
* to have done nothing.
|
|
39
|
+
*/
|
|
40
|
+
onCredentialsSaved?: () => void;
|
|
28
41
|
}
|
|
29
42
|
/**
|
|
30
43
|
* Build a settings service backed by a JSON state file. `get`/`status` read the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-service.d.ts","sourceRoot":"","sources":["../../src/settings/settings-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"settings-service.d.ts","sourceRoot":"","sources":["../../src/settings/settings-service.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAElF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,sBAAsB;IACrC,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,YAAY,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC,6EAA6E;IAC7E,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,2CAA2C;IAC3C,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,kBAAkB,GAAG,SAAS,CAAC;IAC5C;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AA6CD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,sBAA2B,GAAG,eAAe,CA6J3F"}
|