@goodandready/dsh-context-lens 0.1.12 → 0.1.13
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 +7 -0
- package/README.ru.md +7 -0
- package/lib/client.js +31 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -165,3 +165,10 @@ Audit fixes (#33–#47, #18):
|
|
|
165
165
|
## Changed in v0.1.12
|
|
166
166
|
|
|
167
167
|
#43: extract shared `StatusPanel` used by LensTab and HeaderChip popover (budget bar, history, refresh).
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## Changed in v0.1.13
|
|
171
|
+
|
|
172
|
+
- **Fix (#50)**: Guard optional `betterSidebar` tab registration via `ctx.inject(['betterSidebar'], ...)` instead of direct property access on Cordis context proxy, resolving `cannot get property "betterSidebar" without inject` on client boot.
|
|
173
|
+
- **Fix (#50)**: Safely guard `_ctx.settingsScope` access in `PluginCard` with try/catch to prevent proxy property errors.
|
|
174
|
+
- **Test**: Added regression test suite simulating strict Cordis Context Proxy behavior.
|
package/README.ru.md
CHANGED
|
@@ -154,3 +154,10 @@ MIT © [GooDAnDReaDY](https://github.com/GooDAnDReaDY)
|
|
|
154
154
|
## Changed in v0.1.12
|
|
155
155
|
|
|
156
156
|
#43: extract shared `StatusPanel` used by LensTab and HeaderChip popover (budget bar, history, refresh).
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
## Changed in v0.1.13
|
|
160
|
+
|
|
161
|
+
- **Fix (#50)**: Безопасная регистрация вкладки BetterSidebar через `ctx.inject(['betterSidebar'], ...)` вместо прямого чтения свойства из Cordis Context Proxy. Устранена ошибка `cannot get property "betterSidebar" without inject` при загрузке клиентской половины в DSH.
|
|
162
|
+
- **Fix (#50)**: Безопасное обращение к `_ctx.settingsScope` в `PluginCard` через try/catch.
|
|
163
|
+
- **Тесты**: Добавлены регрессионные тесты со строгим Cordis Context Proxy.
|
package/lib/client.js
CHANGED
|
@@ -258,8 +258,12 @@ window.__ModuleLoader__.load({
|
|
|
258
258
|
const [budgetWarn, setBudgetWarn] = React.useState(false);
|
|
259
259
|
|
|
260
260
|
const scopeRef = React.useRef(null);
|
|
261
|
-
if (!scopeRef.current && _ctx
|
|
262
|
-
try {
|
|
261
|
+
if (!scopeRef.current && _ctx) {
|
|
262
|
+
try {
|
|
263
|
+
if (_ctx.settingsScope) {
|
|
264
|
+
scopeRef.current = _ctx.settingsScope.bind({ namespace: NS });
|
|
265
|
+
}
|
|
266
|
+
} catch (e) { scopeRef.current = null; }
|
|
263
267
|
}
|
|
264
268
|
const scope = scopeRef.current;
|
|
265
269
|
|
|
@@ -482,18 +486,33 @@ window.__ModuleLoader__.load({
|
|
|
482
486
|
} else {
|
|
483
487
|
try { doRegister(); } catch (e) { console.error('[dsh-context-lens] direct register failed (no inject)', e && e.stack || e); throw e; }
|
|
484
488
|
}
|
|
485
|
-
// BetterSidebar tab (optional, for dsh-better-sidebar)
|
|
486
|
-
if (
|
|
489
|
+
// BetterSidebar tab (optional, for dsh-better-sidebar via ctx.inject)
|
|
490
|
+
if (typeof ctx.inject === 'function') {
|
|
487
491
|
try {
|
|
488
|
-
ctx.
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
492
|
+
ctx.inject(['betterSidebar'], (sctx) => {
|
|
493
|
+
const svc = sctx && sctx.betterSidebar;
|
|
494
|
+
if (!svc || typeof svc.registerTab !== 'function') return;
|
|
495
|
+
try {
|
|
496
|
+
const register = () => svc.registerTab({
|
|
497
|
+
id: 'dsh-context-lens:tab',
|
|
498
|
+
title: () => 'Lens',
|
|
499
|
+
icon: () => React.createElement('span', null, '◐'),
|
|
500
|
+
order: 50,
|
|
501
|
+
component: ({ scope }) => React.createElement(LensTab, { ctx, scope })
|
|
502
|
+
});
|
|
503
|
+
if (typeof sctx.effect === 'function') {
|
|
504
|
+
sctx.effect(register);
|
|
505
|
+
} else if (typeof ctx.effect === 'function') {
|
|
506
|
+
ctx.effect(register);
|
|
507
|
+
} else {
|
|
508
|
+
register();
|
|
509
|
+
}
|
|
510
|
+
} catch (e) {
|
|
511
|
+
console.warn('[dsh-context-lens] betterSidebar registerTab failed', e && e.message || e);
|
|
512
|
+
}
|
|
513
|
+
});
|
|
495
514
|
} catch (e) {
|
|
496
|
-
|
|
515
|
+
// host without betterSidebar declared or inject failure
|
|
497
516
|
}
|
|
498
517
|
}
|
|
499
518
|
// Header chip (#31) — telemetry and token guard in conversation session utilities slot
|
package/package.json
CHANGED