@huanlin/dsh-plugin-sidebar-brand-text 0.6.1 → 0.6.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.
@@ -1,38 +1,39 @@
1
- /**
2
- * sidebar-brand-text — browser half.
3
- *
4
- * Two registrations:
5
- * - `settings.plugin.item` keyed slot (key `sidebar-brand-text`) — a card
6
- * in the Plugin Config page with two text inputs (name + revision).
7
- * Reads/writes through the `/sbbt/api` HTTP route via the shared
8
- * `BrandTextSettingsController`.
9
- * - `sidebar.brand.name` single slot — renders the configured brand name
10
- * text and optional revision badge. Reads from the same controller
11
- * store via `useSnapshot`, so a save in the card is instantly
12
- * reflected in the sidebar.
13
- *
14
- * The mark slot (`sidebar.brand.mark`) is deliberately NOT registered:
15
- * the fish logo stays in place unless another plugin (e.g.
16
- * `ui-brand-official`) replaces it.
17
- *
18
- * @module @huanlin/dsh-plugin-sidebar-brand-text/client
19
- */
20
- import type { Context as ClientContext } from '@deepseek-ai/cordis';
21
- import { type BrandTextKey } from './locales.ts';
22
- declare module '@deepseek-ai/dsh-client-ui-slots' {
23
- interface LocaleNamespaceMap {
24
- /** The settings card labels. */
25
- 'dsh-plugin-sidebar-brand-text': BrandTextKey;
26
- }
27
- }
28
- /** Required services: slots + locale + sessions (sessions drives the title writer). */
29
- export declare const inject: string[];
30
- /**
31
- * Client plugin body: register the brand-name slot occupant, the settings
32
- * card, the locale dictionary, and the stylesheet.
33
- *
34
- * A single `BrandTextSettingsController` is shared between the card and
35
- * the brand text so a save is instantly reflected in the sidebar.
36
- * @param ctx - client root context.
37
- */
38
- export declare function apply(ctx: ClientContext): void;
1
+ /**
2
+ * sidebar-brand-text — browser half.
3
+ *
4
+ * Two registrations:
5
+ * - `plugins.row.config` keyed slot (key
6
+ * `@huanlin/dsh-plugin-sidebar-brand-text#sidebar-brand-text`) — the
7
+ * plugin's configuration page on the Plugins page, with two text inputs
8
+ * (name + revision). Reads/writes through the `/sbbt/api` HTTP route via
9
+ * the shared `BrandTextSettingsController`.
10
+ * - `sidebar.brand.name` single slot — renders the configured brand name
11
+ * text and optional revision badge. Reads from the same controller
12
+ * store via `useSnapshot`, so a save in the card is instantly
13
+ * reflected in the sidebar.
14
+ *
15
+ * The mark slot (`sidebar.brand.mark`) is deliberately NOT registered:
16
+ * the fish logo stays in place unless another plugin (e.g.
17
+ * `ui-brand-official`) replaces it.
18
+ *
19
+ * @module @huanlin/dsh-plugin-sidebar-brand-text/client
20
+ */
21
+ import type { Context as ClientContext } from '@deepseek-ai/cordis';
22
+ import { type BrandTextKey } from './locales.ts';
23
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
24
+ interface LocaleNamespaceMap {
25
+ /** The settings card labels. */
26
+ 'dsh-plugin-sidebar-brand-text': BrandTextKey;
27
+ }
28
+ }
29
+ /** Required services: slots + locale + sessions (sessions drives the title writer). */
30
+ export declare const inject: string[];
31
+ /**
32
+ * Client plugin body: register the brand-name slot occupant, the settings
33
+ * card, the locale dictionary, and the stylesheet.
34
+ *
35
+ * A single `BrandTextSettingsController` is shared between the card and
36
+ * the brand text so a save is instantly reflected in the sidebar.
37
+ * @param ctx - client root context.
38
+ */
39
+ export declare function apply(ctx: ClientContext): void;
@@ -1,29 +1,34 @@
1
- import type { BrandTextState } from './controller.ts';
2
- import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
3
- /** Minimal face of `sessions.list` we depend on (ISessions.list slice). */
4
- interface SessionListSnapshot {
5
- current: string | undefined;
6
- byId: Record<string, {
7
- title?: string;
8
- } | undefined>;
9
- }
10
- /** Minimal face of the `sessions` service we depend on. */
11
- interface SessionsLike {
12
- readonly list: {
13
- getSnapshot(): SessionListSnapshot;
14
- subscribe(fn: () => void): () => void;
15
- };
16
- }
17
- /** Disposer returned by {@link startTitleWriter}. */
18
- export type TitleWriterDisposer = () => void;
19
- /**
20
- * Start overriding `document.title` with the configured brand name.
21
- *
22
- * @param sessions - the cordis `sessions` service (read-only face).
23
- * @param store - the shared `BrandTextSettingsController` store; the title
24
- * updates when the config changes (card save) as well as when the current
25
- * session changes.
26
- * @returns a disposer that tears down all subscriptions and the observer.
27
- */
28
- export declare function startTitleWriter(sessions: SessionsLike | undefined, store: SnapshotStore<BrandTextState>): TitleWriterDisposer;
29
- export {};
1
+ import type { BrandTextState } from './controller.ts';
2
+ import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
3
+ /** Minimal face of `sessions.list` we depend on.
4
+ *
5
+ * rc.1's `ISessions.list` snapshot (`SessionListState`) carries `byId` only:
6
+ * the selected-session id moved out of the sessions domain. `current` is kept
7
+ * optional so the writer still accepts the rc.1 snapshot; when it is absent the
8
+ * title falls back to the brand name alone. */
9
+ interface SessionListSnapshot {
10
+ current?: string | undefined;
11
+ byId: Record<string, {
12
+ title?: string;
13
+ } | undefined>;
14
+ }
15
+ /** Minimal face of the `sessions` service we depend on. */
16
+ interface SessionsLike {
17
+ readonly list: {
18
+ getSnapshot(): SessionListSnapshot;
19
+ subscribe(fn: () => void): () => void;
20
+ };
21
+ }
22
+ /** Disposer returned by {@link startTitleWriter}. */
23
+ export type TitleWriterDisposer = () => void;
24
+ /**
25
+ * Start overriding `document.title` with the configured brand name.
26
+ *
27
+ * @param sessions - the cordis `sessions` service (read-only face).
28
+ * @param store - the shared `BrandTextSettingsController` store; the title
29
+ * updates when the config changes (card save) as well as when the current
30
+ * session changes.
31
+ * @returns a disposer that tears down all subscriptions and the observer.
32
+ */
33
+ export declare function startTitleWriter(sessions: SessionsLike | undefined, store: SnapshotStore<BrandTextState>): TitleWriterDisposer;
34
+ export {};
@@ -9,9 +9,19 @@
9
9
  * @module @huanlin/dsh-plugin-sidebar-brand-text/config
10
10
  */
11
11
  import z from '@deepseek-ai/schemastery';
12
+ import type { Volatile } from '@deepseek-ai/cordis';
12
13
  import type { BrandTextConfig } from './types.ts';
13
- /** Schemastery schema for the composition entry and the settings namespace. */
14
- export declare const Config: z<BrandTextConfig>;
14
+ /**
15
+ * Volatile Cordis config the loader passes to {@link apply}: each editable
16
+ * field is a stable reference whose `.get()` returns the latest accepted
17
+ * value. `Settings` enumerates these fields for the profile-owned form.
18
+ */
19
+ export interface BrandTextEntryConfig {
20
+ name: Volatile<string>;
21
+ revision: Volatile<string>;
22
+ }
23
+ /** Schemastery schema for the composition entry (live-editable via `.volatile()`). */
24
+ export declare const Config: z<BrandTextEntryConfig>;
15
25
  /**
16
26
  * Resolve a raw config object into a complete {@link BrandTextConfig}.
17
27
  *
@@ -16,7 +16,7 @@
16
16
  */
17
17
  import type { Context } from '@deepseek-ai/cordis';
18
18
  import { Config } from './config.ts';
19
- import type { BrandTextConfig } from './types.ts';
19
+ import type { BrandTextEntryConfig } from './config.ts';
20
20
  export declare const name = "sidebar-brand-text";
21
21
  /** `webServer` is required for the HTTP gateway that backs the settings card. */
22
22
  export declare const inject: string[];
@@ -27,6 +27,6 @@ export { Config };
27
27
  * Plugin body: install the settings bridge and register the HTTP gateway.
28
28
  *
29
29
  * @param ctx - host context carrying `webServer`.
30
- * @param config - resolved config (seed values).
30
+ * @param config - the entry's volatile Cordis config.
31
31
  */
32
- export declare function apply(ctx: Context, config: BrandTextConfig): void;
32
+ export declare function apply(ctx: Context, config: BrandTextEntryConfig): void;
@@ -1,31 +1,37 @@
1
- /**
2
- * Host-side settings bridge for `sidebar-brand-text`.
3
- *
4
- * Mirrors the ego-browser / dsh-plugin-interpreters pattern: a `source()`
5
- * thunk the HTTP gateway reads in-process, plus an `onChange()` subscription.
6
- * The settings service is reached through `ctx.inject(['settings'], ...)` so a
7
- * composition without a settings provider still loads (entry-source fallback,
8
- * no persistence). Multi-fiber dedupe is handled by catching the
9
- * `"already registered"` rejection.
10
- *
11
- * @module @huanlin/dsh-plugin-sidebar-brand-text/settings
12
- */
13
- import type { Context } from '@deepseek-ai/cordis';
14
- import type { BrandTextConfig } from './types.ts';
15
- /** Settings namespace under which brand-text config persists. */
16
- export declare const SETTINGS_NAMESPACE: "sidebar-brand-text";
17
- /** Bridge returned by {@link installBrandTextSettings}. */
18
- export interface BrandTextSettingsBridge {
19
- /** Read the current resolved config (entry source or settings layer). */
20
- source(): BrandTextConfig;
21
- /** Subscribe to config changes (live re-registration follows every commit). */
22
- onChange(callback: () => void): () => void;
23
- }
24
- /**
25
- * Install the `sidebar-brand-text` settings namespace and return the bridge.
26
- *
27
- * @param ctx - host context.
28
- * @param entry - raw composition-layer config seed.
29
- * @returns the settings bridge.
30
- */
31
- export declare function installBrandTextSettings(ctx: Context, entry: BrandTextConfig): BrandTextSettingsBridge;
1
+ /**
2
+ * Host-side settings bridge for `sidebar-brand-text`.
3
+ *
4
+ * dsh 0.1.7-rc.1 moved plugin configuration into the profile-owned Cordis
5
+ * `Config`: the fields are marked `.volatile()` (see `config.ts`), so the
6
+ * loader commits live references without remounting. The namespace-registration API
7
+ * is gone; a plugin only declares the presentation policy for its own page.
8
+ *
9
+ * This bridge exposes a `source()` thunk the `/sbbt/api` gateway reads
10
+ * in-process. Each call reads the current volatile reference, so the gateway
11
+ * always serves the latest accepted value. The value persists in the active
12
+ * profile's `cordis.patch.yml` under the entry's `config` (the entry id is the
13
+ * composition row id declared in `cordis.patch.yml`).
14
+ *
15
+ * @module @huanlin/dsh-plugin-sidebar-brand-text/settings
16
+ */
17
+ import type { Context } from '@deepseek-ai/cordis';
18
+ import type { BrandTextEntryConfig } from './config.ts';
19
+ import type { BrandTextConfig } from './types.ts';
20
+ /** The composition row id: the settings namespace / profile entry id. */
21
+ export declare const SETTINGS_NAMESPACE: "sidebar-brand-text";
22
+ /** Bridge returned by {@link installBrandTextSettings}. */
23
+ export interface BrandTextSettingsBridge {
24
+ /** Read the current resolved config from the entry's volatile references. */
25
+ source(): BrandTextConfig;
26
+ }
27
+ /**
28
+ * Declare the plugin's settings presentation policy and return the bridge.
29
+ *
30
+ * `auto: false` suppresses a schema-generated page: this plugin ships its own
31
+ * form through the `plugins.row.config` slot on the Plugins page.
32
+ *
33
+ * @param ctx - host context.
34
+ * @param config - the entry's volatile Cordis config.
35
+ * @returns the settings bridge.
36
+ */
37
+ export declare function installBrandTextSettings(ctx: Context, config: BrandTextEntryConfig): BrandTextSettingsBridge;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huanlin/dsh-plugin-sidebar-brand-text",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,8 +37,8 @@
37
37
  "@deepseek-ai/dsh-api-session-controller",
38
38
  "@deepseek-ai/dsh-client-locale",
39
39
  "@deepseek-ai/dsh-client-store",
40
+ "@deepseek-ai/dsh-client-ui-plugin-manager",
40
41
  "@deepseek-ai/dsh-client-ui-renderer",
41
- "@deepseek-ai/dsh-client-ui-settings-plugins",
42
42
  "@deepseek-ai/dsh-client-ui-sidebar",
43
43
  "@deepseek-ai/dsh-client-ui-slots"
44
44
  ],
@@ -47,15 +47,15 @@
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@deepseek-ai/cordis": "^4.0.1",
50
- "@deepseek-ai/dsh-api-session-controller": "^0.1.5-rc.1",
51
- "@deepseek-ai/dsh-client-locale": "^0.1.5-rc.1",
52
- "@deepseek-ai/dsh-client-store": "^0.1.5-rc.1",
53
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.1",
54
- "@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.5-rc.1",
55
- "@deepseek-ai/dsh-client-ui-sidebar": "^0.1.5-rc.1",
56
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.1",
57
- "@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
58
- "@deepseek-ai/schemastery": "^3.18.1",
50
+ "@deepseek-ai/dsh-api-session-controller": "^0.1.7-rc.1",
51
+ "@deepseek-ai/dsh-client-locale": "^0.1.7-rc.1",
52
+ "@deepseek-ai/dsh-client-store": "^0.1.7-rc.1",
53
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "^0.1.7-rc.1",
54
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.7-rc.1",
55
+ "@deepseek-ai/dsh-client-ui-sidebar": "^0.1.7-rc.1",
56
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.7-rc.1",
57
+ "@deepseek-ai/dsh-settings": "^0.1.7-rc.1",
58
+ "@deepseek-ai/schemastery": "^3.18.4",
59
59
  "react": "^18.2.0"
60
60
  },
61
61
  "peerDependenciesMeta": {
@@ -71,10 +71,10 @@
71
71
  "@deepseek-ai/dsh-client-store": {
72
72
  "optional": true
73
73
  },
74
- "@deepseek-ai/dsh-client-ui-renderer": {
74
+ "@deepseek-ai/dsh-client-ui-plugin-manager": {
75
75
  "optional": true
76
76
  },
77
- "@deepseek-ai/dsh-client-ui-settings-plugins": {
77
+ "@deepseek-ai/dsh-client-ui-renderer": {
78
78
  "optional": true
79
79
  },
80
80
  "@deepseek-ai/dsh-client-ui-sidebar": {
@@ -95,13 +95,12 @@
95
95
  },
96
96
  "devDependencies": {
97
97
  "@deepseek-ai/cordis": "^4.0.1",
98
- "@deepseek-ai/schemastery": "^3.18.1",
98
+ "@deepseek-ai/schemastery": "^3.18.4",
99
99
  "@types/node": "^22.20.1",
100
100
  "@types/react": "~18.3.31",
101
101
  "jsdom": "^26.0.0",
102
102
  "react": "^18.2.0",
103
103
  "react-dom": "^18.2.0",
104
- "schemastery": "^3.18.0",
105
104
  "tsdown": "^0.15.0",
106
105
  "typescript": "^5.9.0",
107
106
  "vitest": "^3.2.0"