@huanlin/dsh-plugin-aigc-canvas 0.1.10 → 0.2.1

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/lib/config.d.ts CHANGED
@@ -1,14 +1,17 @@
1
1
  /**
2
2
  * Serializable configuration and defaults for the AIGC canvas host half.
3
3
  * The `providers` array holds one or more AIGC provider configs (name /
4
- * endpoint / apiKey / instructions), editable at runtime through the DSH
5
- * GUI settings page; cordis.yml `config:` is the first-boot seed only.
4
+ * endpoint / apiKey / instructions). Since dsh 0.1.7-rc.1 the editable
5
+ * fields are `.volatile()` members of the entry's profile-owned Cordis
6
+ * Config (DSH-0.1.7-J1-04): the composition `config:` in cordis.patch.yml is
7
+ * the first-boot seed only, and runtime edits persist per profile under the
8
+ * entry id `dsh-aigc-canvas` through the settings service.
6
9
  *
7
10
  * @module @huanlin/dsh-plugin-aigc-canvas/config
8
11
  */
9
12
  import z from '@deepseek-ai/schemastery';
10
- /** Provider id pattern: lowercase letters, digits, hyphens; must start with a letter. */
11
- export declare const PROVIDER_ID_PATTERN: RegExp;
13
+ import type { Volatile } from '@deepseek-ai/cordis';
14
+ export { PROVIDER_ID_PATTERN, validateProviderId } from './provider-shape.js';
12
15
  /** How the aigc_http_request tool attaches the provider apiKey to requests. */
13
16
  export interface AigcProviderAuth {
14
17
  /**
@@ -34,7 +37,7 @@ export interface AigcProvider {
34
37
  name: string;
35
38
  /** Provider API endpoint URL. `stub://aigc-backend` = the built-in stub. */
36
39
  endpoint: string;
37
- /** Provider API key (stored in memory only; set via GUI or cordis.yml). */
40
+ /** Provider API key (persisted with the entry config in cordis.patch.yml; set via GUI or seed). */
38
41
  apiKey: string;
39
42
  /** Free-form usage instructions the agent reads via aigc_get_provider_info. */
40
43
  instructions: string;
@@ -52,8 +55,29 @@ export interface AigcCanvasConfig {
52
55
  /** Maximum media bytes to write to disk per generated asset. */
53
56
  mediaSizeLimit?: number;
54
57
  }
55
- /** Schemastery schema for the plugin configuration. */
56
- export declare const Config: z<AigcCanvasConfig>;
58
+ /**
59
+ * The live Cordis config the Loader passes to `apply`.
60
+ *
61
+ * `providers` is `.volatile()`: the field arrives as a stable reference whose
62
+ * `.get()` always returns the latest accepted value (a committed settings
63
+ * edit updates it in place without remounting the plugin). The other fields
64
+ * are composition-seed knobs resolved once at load.
65
+ */
66
+ export interface AigcEntryConfig {
67
+ /** Live provider list reference; `.get()` returns the latest accepted value. */
68
+ providers?: Volatile<readonly AigcProvider[]>;
69
+ requestTimeoutMs?: number;
70
+ mediaSizeLimit?: number;
71
+ }
72
+ /**
73
+ * Schemastery schema for the plugin's profile-owned Config.
74
+ *
75
+ * `providers` is `.volatile()` (dsh 0.1.7-rc.1 DSH-0.1.7-J1-04): the settings
76
+ * service enumerates the entry's volatile fields for the configuration form,
77
+ * and a committed edit updates the running reference in place. The numeric
78
+ * knobs stay non-volatile (cordis.patch.yml seed only).
79
+ */
80
+ export declare const Config: z<AigcEntryConfig>;
57
81
  /** A fully-resolved provider (all fields guaranteed). */
58
82
  export interface ResolvedAigcProvider extends AigcProvider {
59
83
  name: string;
@@ -71,7 +95,21 @@ export interface ResolvedAigcConfig {
71
95
  }
72
96
  /** Returns true when the provider endpoint points at the built-in stub backend. */
73
97
  export declare function isStubEndpoint(endpoint: string): boolean;
74
- /** Validate a provider id; returns an error message or undefined if valid. */
75
- export declare function validateProviderId(id: string): string | undefined;
76
- /** Apply direct-call defaults after Loader schema validation has normally run. */
77
- export declare function resolveAigcConfig(config: AigcCanvasConfig | undefined): ResolvedAigcConfig;
98
+ /**
99
+ * Normalize a raw provider list (the volatile reference's latest snapshot, a
100
+ * legacy imported document, or a hand-edited override) into resolved
101
+ * providers. Non-object entries are skipped; duplicate ids keep the first
102
+ * occurrence (insertion order preserved).
103
+ * @param raw - the raw list value.
104
+ * @returns the resolved providers, in order, deduplicated by id.
105
+ */
106
+ export declare function resolveAigcProviders(raw: unknown): readonly ResolvedAigcProvider[];
107
+ /**
108
+ * Resolve the apply-time seed config (direct-call defaults after Loader
109
+ * schema validation has normally run). The provider list reads the live
110
+ * volatile reference; when it resolves empty at load, the default stub is
111
+ * seeded so the tools always have one provider.
112
+ * @param config - the entry config the Loader passed to `apply`.
113
+ * @returns the fully defaulted seed settings.
114
+ */
115
+ export declare function resolveAigcConfig(config: AigcEntryConfig | undefined): ResolvedAigcConfig;
@@ -84,6 +84,28 @@ export interface AigcLoaderEntry {
84
84
  export interface AigcLoader {
85
85
  entries(): Iterable<AigcLoaderEntry>;
86
86
  }
87
+ /**
88
+ * The settings service face this plugin uses (mirror of
89
+ * `@deepseek-ai/dsh-settings` `SettingsForms`, dsh 0.1.7-rc.1). Restated
90
+ * structurally like the other faces above so the third-party resolution
91
+ * tree typechecks without a dependency on the DSH package.
92
+ */
93
+ export interface AigcSettingsForms {
94
+ /** Register the calling plugin instance's settings-page policy. */
95
+ configure(presentation: {
96
+ auto?: boolean;
97
+ }, owner?: AigcCordisFiber): () => void;
98
+ /** Merge editable (volatile) fields into one entry's profile config. */
99
+ update(ns: string, patch: object, expectedRevision?: number): Promise<void>;
100
+ }
101
+ /**
102
+ * Structural slice of the DSH-vendored cordis `Fiber`: `configure` keys its
103
+ * presentation policy by fiber identity, and the plugin only ever passes
104
+ * `ctx.fiber` through.
105
+ */
106
+ export interface AigcCordisFiber {
107
+ readonly uid: number | null;
108
+ }
87
109
  /**
88
110
  * The tools service face restated.
89
111
  * Mirrored here exactly like better-sidebar does — the dual-cordis-instance
@@ -101,6 +123,10 @@ declare module 'cordis' {
101
123
  sessions: AigcSessionStore;
102
124
  agents: AigcAgentRegistry;
103
125
  loader: AigcLoader;
126
+ /** The profile-owned settings forms service (dsh 0.1.7-rc.1); undefined when no settings provider is mounted. */
127
+ settings: AigcSettingsForms;
128
+ /** The plugin instance's fiber (DSH-vendored cordis). */
129
+ fiber: AigcCordisFiber;
104
130
  /**
105
131
  * The host-side AIGC canvas registry: holds the per-session element
106
132
  * table (prompts + generated assets) and edges. Provided by the host
@@ -0,0 +1,22 @@
1
+ /**
2
+ * entry-identity.ts — the identity triple that binds this plugin's three
3
+ * naming surfaces together. Keeping them in one dependency-free module lets
4
+ * a unit test pin them against `cordis.patch.yml` and `package.json`
5
+ * (a mismatched `plugins.row.config` key fails silently: the row's configure
6
+ * entry simply never appears).
7
+ *
8
+ * - ENTRY_ID: the profile entry id — the `id` of the insert row in
9
+ * `cordis.patch.yml`. The Host serves the entry's volatile config under
10
+ * it, so it keys `ctx.configForms.get` and `settings.update`.
11
+ * - PACKAGE_NAME: the bundle's npm package name — the row's `name` field.
12
+ * - ROW_CONFIG_KEY: the Plugins page `plugins.row.config` slot key,
13
+ * `<package name>#<row id>` with the row id passed through verbatim.
14
+ *
15
+ * @module @huanlin/dsh-plugin-aigc-canvas/entry-identity
16
+ */
17
+ /** Profile entry id (= the `cordis.patch.yml` insert row id / settings namespace). */
18
+ export declare const ENTRY_ID = "dsh-aigc-canvas";
19
+ /** Bundle package name (the Loader resolves the row's module through it). */
20
+ export declare const PACKAGE_NAME = "@huanlin/dsh-plugin-aigc-canvas";
21
+ /** `plugins.row.config` key: the bundle's package name `#` the patch row id. */
22
+ export declare const ROW_CONFIG_KEY = "@huanlin/dsh-plugin-aigc-canvas#dsh-aigc-canvas";
package/lib/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { Context } from './context-types.js';
2
- import { Config, type AigcCanvasConfig, type AigcProvider, type ResolvedAigcConfig, type ResolvedAigcProvider } from './config.js';
3
- export { Config };
4
- export type { AigcCanvasConfig, AigcProvider, ResolvedAigcConfig, ResolvedAigcProvider };
2
+ import { Config, type AigcEntryConfig, type AigcProvider, type ResolvedAigcConfig, type ResolvedAigcProvider } from './config.js';
3
+ import { SETTINGS_NAMESPACE } from './settings.js';
4
+ export { Config, SETTINGS_NAMESPACE };
5
+ export type { AigcCanvasConfig } from './config.js';
6
+ export type { AigcEntryConfig, AigcProvider, ResolvedAigcConfig, ResolvedAigcProvider };
5
7
  export type { Context } from './context-types.js';
6
8
  export type { AigcCanvasService, AigcElement, AigcEdge, AigcCanvasState, AigcElementKind, } from './canvas-registry.js';
7
9
  /** Plugin identity for cordis.yml rows. */
@@ -9,4 +11,4 @@ export declare const name = "dsh-aigc-canvas";
9
11
  /** Services required before mounting. */
10
12
  export declare const inject: string[];
11
13
  /** Plugin body. */
12
- export declare function apply(ctx: Context, config?: AigcCanvasConfig): void;
14
+ export declare function apply(ctx: Context, config?: AigcEntryConfig): void;