@deepseek-ai/dsh-api-settings-controller 0.1.2-alpha.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.
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Host Remote owner for the configuration surfaces over the settings-domain
3
+ * seams. Two namespaces: `settings`, the redacted reads and writes of
4
+ * `ctx.settings`, owned by the class below; and `credentials`, mounted from
5
+ * here as its own plugin.
6
+ *
7
+ * @module @deepseek-ai/dsh-api-settings-controller
8
+ */
9
+ import { Context } from '@deepseek-ai/cordis';
10
+ import Schema from '@deepseek-ai/schemastery';
11
+ import type { SettingsDescribeValue, SettingsNamespaceView, SettingsPathOpView } from '@deepseek-ai/dsh-settings/types';
12
+ import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
13
+ import type { JsonValue } from '@deepseek-ai/dsh-util-values';
14
+ import type { AgentPresetDirectoryOpenValue, SettingsDocumentOpenValue } from './types.ts';
15
+ export { CredentialsController } from './credentials.ts';
16
+ export type * from './types.ts';
17
+ /** Native document-opening policy. */
18
+ export interface Config {
19
+ /** Override platform desktop-opener detection. */
20
+ readonly nativeOpen?: boolean;
21
+ }
22
+ /** Host integrations replaceable by direct unit tests. */
23
+ export interface SettingsControllerInternals {
24
+ readonly openPath?: (path: string, signal: AbortSignal) => Promise<void>;
25
+ readonly openTextFile?: (path: string, signal: AbortSignal) => Promise<void>;
26
+ readonly canOpenPath?: () => boolean;
27
+ }
28
+ declare module '@deepseek-ai/cordis' {
29
+ interface Context {
30
+ /** Host owner of the `settings` Remote namespace. */
31
+ settingsController: SettingsController;
32
+ }
33
+ }
34
+ /**
35
+ * Host service backing the generated `ctx.remote.settings` namespace. Every
36
+ * remote read uses `redactSecrets: true`, so a `role('secret')` field cannot
37
+ * ride a response. Writes expose the settings service's merge, replacement,
38
+ * and path-addressed operations, and classify every provider refusal as
39
+ * `settings/conflict` or `settings/rejected` with the service's message.
40
+ */
41
+ export declare class SettingsController extends TypertRemoteService {
42
+ static Config: Schema<Config>;
43
+ private readonly openPath;
44
+ private readonly openTextFile;
45
+ private readonly canOpenPath;
46
+ /**
47
+ * Register the settings namespace and mount the credentials namespace beside
48
+ * it. Both namespaces stay registered when a provider is absent so calls can
49
+ * return the configuration API's actionable missing-provider diagnostic.
50
+ * @param ctx - Host context where settings and credential providers may be mounted.
51
+ */
52
+ constructor(ctx: Context, config?: Config, internals?: SettingsControllerInternals);
53
+ /**
54
+ * Describe every registered namespace for a configuration page: redacted
55
+ * layered values plus the serialized schema the page renders its form from.
56
+ * @returns provider writability, local-document presence, and one view per namespace.
57
+ * @throws RemoteError when no settings provider is mounted.
58
+ */
59
+ describe(): SettingsDescribeValue;
60
+ /**
61
+ * Report whether this deployment can open an authored Agent preset directory natively.
62
+ * @returns true when the matching open operation is available.
63
+ */
64
+ canOpenAgentPresetDirectory(): boolean;
65
+ /**
66
+ * Merge a patch into one namespace's stored user section.
67
+ * @param ns - namespace key to write.
68
+ * @param patch - fields to merge into the user section.
69
+ * @param expectedRevision - revision the caller read; `undefined` writes unconditionally.
70
+ * @returns the namespace's redacted view after the write.
71
+ * @throws RemoteError when the request is invalid, no provider is mounted, or the provider refuses the write.
72
+ */
73
+ update(ns: string, patch: Record<string, JsonValue>, expectedRevision: number | undefined): Promise<SettingsNamespaceView>;
74
+ /**
75
+ * Replace one namespace's stored user section wholesale.
76
+ * @param ns - namespace key to write.
77
+ * @param section - complete replacement user section.
78
+ * @param expectedRevision - revision the caller read; `undefined` writes unconditionally.
79
+ * @returns the namespace's redacted view after the write.
80
+ * @throws RemoteError when the request is invalid, no provider is mounted, or the provider refuses the write.
81
+ */
82
+ replace(ns: string, section: Record<string, JsonValue>, expectedRevision: number | undefined): Promise<SettingsNamespaceView>;
83
+ /**
84
+ * Apply path-addressed edits to one namespace's user section, resolved against
85
+ * the section as stored rather than against whatever the caller last read,
86
+ * then answer with that namespace's new redacted view.
87
+ * @param ns - namespace key to write.
88
+ * @param ops - the edits to apply, in order.
89
+ * @param expectedRevision - revision the caller read; `undefined` writes unconditionally.
90
+ * @returns the namespace's redacted view after the write.
91
+ * @throws RemoteError when the request is invalid, no provider is mounted, or the provider refuses the write.
92
+ */
93
+ mutate(ns: string, ops: SettingsPathOpView[], expectedRevision: number | undefined): Promise<SettingsNamespaceView>;
94
+ /**
95
+ * Materialize the provider-owned settings document and open it in a native text editor.
96
+ * @param signal - caller lifetime; abort terminates preparation or the native command.
97
+ * @returns confirmation after the native opener accepts the document.
98
+ * @throws RemoteError when no document exists, preparation fails, or opening fails.
99
+ */
100
+ openSettingsDocument(signal: AbortSignal): Promise<SettingsDocumentOpenValue>;
101
+ /**
102
+ * Open one user-authored Agent preset directory or return its path when no native opener exists.
103
+ * @param agentPreset - preset id resolved against Host-owned roots.
104
+ * @param signal - caller lifetime; abort terminates the native command.
105
+ * @returns an opened confirmation or the resolved directory for text display.
106
+ * @throws RemoteError when the preset is missing, read-only, invalid, or cannot be opened.
107
+ */
108
+ openAgentPresetDirectory(agentPreset: string, signal: AbortSignal): Promise<AgentPresetDirectoryOpenValue>;
109
+ private write;
110
+ /** Resolve the optional provider or report how to supply it. */
111
+ private provider;
112
+ }
113
+ export default SettingsController;
114
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,317 @@
1
+ /**
2
+ * Host Remote owner for the configuration surfaces over the settings-domain
3
+ * seams. Two namespaces: `settings`, the redacted reads and writes of
4
+ * `ctx.settings`, owned by the class below; and `credentials`, mounted from
5
+ * here as its own plugin.
6
+ *
7
+ * @module @deepseek-ai/dsh-api-settings-controller
8
+ */
9
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
10
+ var useValue = arguments.length > 2;
11
+ for (var i = 0; i < initializers.length; i++) {
12
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
13
+ }
14
+ return useValue ? value : void 0;
15
+ };
16
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
17
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
18
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
19
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
20
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
21
+ var _, done = false;
22
+ for (var i = decorators.length - 1; i >= 0; i--) {
23
+ var context = {};
24
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
25
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
26
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
27
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
28
+ if (kind === "accessor") {
29
+ if (result === void 0) continue;
30
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
31
+ if (_ = accept(result.get)) descriptor.get = _;
32
+ if (_ = accept(result.set)) descriptor.set = _;
33
+ if (_ = accept(result.init)) initializers.unshift(_);
34
+ }
35
+ else if (_ = accept(result)) {
36
+ if (kind === "field") initializers.unshift(_);
37
+ else descriptor[key] = _;
38
+ }
39
+ }
40
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
41
+ done = true;
42
+ };
43
+ import { dirname } from 'node:path';
44
+ import Schema from '@deepseek-ai/schemastery';
45
+ import { canOpenNativePath, openNativePath, openNativeTextFile, } from '@deepseek-ai/dsh-native-command';
46
+ import { Remote, RemoteError, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
47
+ import { z } from 'zod';
48
+ import { CredentialsController } from "./credentials.js";
49
+ export { CredentialsController } from "./credentials.js";
50
+ const settingsNamespaceRequestSchema = z.object({ ns: z.string().min(1) });
51
+ /** Read abort state afresh after an awaited provider or opener call. */
52
+ function isAborted(signal) {
53
+ return signal.aborted;
54
+ }
55
+ /**
56
+ * Project one redacted descriptor onto its wire view, field by field. The
57
+ * Gateway returns a business result without decoding it, so a provider whose
58
+ * descriptor carried extra enumerable properties would otherwise serialize them
59
+ * to the caller.
60
+ * @param descriptor - one descriptor read under `redactSecrets`.
61
+ * @returns the same facts with nothing else attached.
62
+ */
63
+ function namespaceView(descriptor) {
64
+ return {
65
+ ns: String(descriptor.ns),
66
+ schema: descriptor.schema,
67
+ value: descriptor.value,
68
+ ...descriptor.base === undefined ? {} : { base: descriptor.base },
69
+ ...descriptor.user === undefined ? {} : { user: descriptor.user },
70
+ applies: descriptor.applies,
71
+ secrets: (descriptor.secrets ?? []).map(secret => ({ path: [...secret.path], set: secret.set })),
72
+ revision: descriptor.revision,
73
+ };
74
+ }
75
+ /**
76
+ * Host service backing the generated `ctx.remote.settings` namespace. Every
77
+ * remote read uses `redactSecrets: true`, so a `role('secret')` field cannot
78
+ * ride a response. Writes expose the settings service's merge, replacement,
79
+ * and path-addressed operations, and classify every provider refusal as
80
+ * `settings/conflict` or `settings/rejected` with the service's message.
81
+ */
82
+ let SettingsController = (() => {
83
+ let _classSuper = TypertRemoteService;
84
+ let _instanceExtraInitializers = [];
85
+ let _describe_decorators;
86
+ let _canOpenAgentPresetDirectory_decorators;
87
+ let _update_decorators;
88
+ let _replace_decorators;
89
+ let _mutate_decorators;
90
+ let _openSettingsDocument_decorators;
91
+ let _openAgentPresetDirectory_decorators;
92
+ return class SettingsController extends _classSuper {
93
+ static {
94
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
95
+ _describe_decorators = [Remote];
96
+ _canOpenAgentPresetDirectory_decorators = [Remote];
97
+ _update_decorators = [Remote];
98
+ _replace_decorators = [Remote];
99
+ _mutate_decorators = [Remote];
100
+ _openSettingsDocument_decorators = [Remote];
101
+ _openAgentPresetDirectory_decorators = [Remote];
102
+ __esDecorate(this, null, _describe_decorators, { kind: "method", name: "describe", static: false, private: false, access: { has: obj => "describe" in obj, get: obj => obj.describe }, metadata: _metadata }, null, _instanceExtraInitializers);
103
+ __esDecorate(this, null, _canOpenAgentPresetDirectory_decorators, { kind: "method", name: "canOpenAgentPresetDirectory", static: false, private: false, access: { has: obj => "canOpenAgentPresetDirectory" in obj, get: obj => obj.canOpenAgentPresetDirectory }, metadata: _metadata }, null, _instanceExtraInitializers);
104
+ __esDecorate(this, null, _update_decorators, { kind: "method", name: "update", static: false, private: false, access: { has: obj => "update" in obj, get: obj => obj.update }, metadata: _metadata }, null, _instanceExtraInitializers);
105
+ __esDecorate(this, null, _replace_decorators, { kind: "method", name: "replace", static: false, private: false, access: { has: obj => "replace" in obj, get: obj => obj.replace }, metadata: _metadata }, null, _instanceExtraInitializers);
106
+ __esDecorate(this, null, _mutate_decorators, { kind: "method", name: "mutate", static: false, private: false, access: { has: obj => "mutate" in obj, get: obj => obj.mutate }, metadata: _metadata }, null, _instanceExtraInitializers);
107
+ __esDecorate(this, null, _openSettingsDocument_decorators, { kind: "method", name: "openSettingsDocument", static: false, private: false, access: { has: obj => "openSettingsDocument" in obj, get: obj => obj.openSettingsDocument }, metadata: _metadata }, null, _instanceExtraInitializers);
108
+ __esDecorate(this, null, _openAgentPresetDirectory_decorators, { kind: "method", name: "openAgentPresetDirectory", static: false, private: false, access: { has: obj => "openAgentPresetDirectory" in obj, get: obj => obj.openAgentPresetDirectory }, metadata: _metadata }, null, _instanceExtraInitializers);
109
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
110
+ }
111
+ static Config = Schema.object({ nativeOpen: Schema.boolean() });
112
+ openPath = __runInitializers(this, _instanceExtraInitializers);
113
+ openTextFile;
114
+ canOpenPath;
115
+ /**
116
+ * Register the settings namespace and mount the credentials namespace beside
117
+ * it. Both namespaces stay registered when a provider is absent so calls can
118
+ * return the configuration API's actionable missing-provider diagnostic.
119
+ * @param ctx - Host context where settings and credential providers may be mounted.
120
+ */
121
+ constructor(ctx, config = {}, internals = {}) {
122
+ super(ctx, 'settingsController', { namespace: 'settings' });
123
+ this.openPath = internals.openPath ?? openNativePath;
124
+ this.openTextFile = internals.openTextFile ?? openNativeTextFile;
125
+ this.canOpenPath = internals.canOpenPath
126
+ ?? (() => config.nativeOpen ?? (internals.openPath !== undefined || canOpenNativePath()));
127
+ ctx.plugin(CredentialsController);
128
+ }
129
+ /**
130
+ * Describe every registered namespace for a configuration page: redacted
131
+ * layered values plus the serialized schema the page renders its form from.
132
+ * @returns provider writability, local-document presence, and one view per namespace.
133
+ * @throws RemoteError when no settings provider is mounted.
134
+ */
135
+ describe() {
136
+ const settings = this.provider();
137
+ return {
138
+ writable: settings.writable,
139
+ hasDocument: settings.documentPath !== undefined,
140
+ namespaces: settings.describe({ redactSecrets: true }).map(namespaceView),
141
+ };
142
+ }
143
+ /**
144
+ * Report whether this deployment can open an authored Agent preset directory natively.
145
+ * @returns true when the matching open operation is available.
146
+ */
147
+ canOpenAgentPresetDirectory() {
148
+ return this.canOpenPath();
149
+ }
150
+ /**
151
+ * Merge a patch into one namespace's stored user section.
152
+ * @param ns - namespace key to write.
153
+ * @param patch - fields to merge into the user section.
154
+ * @param expectedRevision - revision the caller read; `undefined` writes unconditionally.
155
+ * @returns the namespace's redacted view after the write.
156
+ * @throws RemoteError when the request is invalid, no provider is mounted, or the provider refuses the write.
157
+ */
158
+ update(ns, patch, expectedRevision) {
159
+ return this.write(ns, 'update', patch, expectedRevision);
160
+ }
161
+ /**
162
+ * Replace one namespace's stored user section wholesale.
163
+ * @param ns - namespace key to write.
164
+ * @param section - complete replacement user section.
165
+ * @param expectedRevision - revision the caller read; `undefined` writes unconditionally.
166
+ * @returns the namespace's redacted view after the write.
167
+ * @throws RemoteError when the request is invalid, no provider is mounted, or the provider refuses the write.
168
+ */
169
+ replace(ns, section, expectedRevision) {
170
+ return this.write(ns, 'replace', section, expectedRevision);
171
+ }
172
+ /**
173
+ * Apply path-addressed edits to one namespace's user section, resolved against
174
+ * the section as stored rather than against whatever the caller last read,
175
+ * then answer with that namespace's new redacted view.
176
+ * @param ns - namespace key to write.
177
+ * @param ops - the edits to apply, in order.
178
+ * @param expectedRevision - revision the caller read; `undefined` writes unconditionally.
179
+ * @returns the namespace's redacted view after the write.
180
+ * @throws RemoteError when the request is invalid, no provider is mounted, or the provider refuses the write.
181
+ */
182
+ async mutate(ns, ops, expectedRevision) {
183
+ return this.write(ns, 'mutate', ops, expectedRevision);
184
+ }
185
+ /**
186
+ * Materialize the provider-owned settings document and open it in a native text editor.
187
+ * @param signal - caller lifetime; abort terminates preparation or the native command.
188
+ * @returns confirmation after the native opener accepts the document.
189
+ * @throws RemoteError when no document exists, preparation fails, or opening fails.
190
+ */
191
+ async openSettingsDocument(signal) {
192
+ const settings = this.provider();
193
+ if (isAborted(signal))
194
+ throw new RemoteError('gateway/cancelled', 'settings document open was aborted', {});
195
+ let path;
196
+ try {
197
+ path = await settings.prepareDocument();
198
+ }
199
+ catch (error) {
200
+ if (isAborted(signal))
201
+ throw new RemoteError('gateway/cancelled', 'settings document preparation was aborted', {});
202
+ throw new RemoteError('gateway/internal', `settings document preparation failed: ${messageOf(error)}`, {}, { cause: error });
203
+ }
204
+ if (path === undefined) {
205
+ throw new RemoteError('gateway/internal', 'settings provider has no local document to open', {});
206
+ }
207
+ if (isAborted(signal))
208
+ throw new RemoteError('gateway/cancelled', 'settings document open was aborted', {});
209
+ try {
210
+ await this.openTextFile(path, signal);
211
+ return { opened: true };
212
+ }
213
+ catch (error) {
214
+ if (isAborted(signal))
215
+ throw new RemoteError('gateway/cancelled', 'settings document open was aborted', {});
216
+ throw new RemoteError('gateway/internal', `path open failed: ${messageOf(error)}`, {}, { cause: error });
217
+ }
218
+ }
219
+ /**
220
+ * Open one user-authored Agent preset directory or return its path when no native opener exists.
221
+ * @param agentPreset - preset id resolved against Host-owned roots.
222
+ * @param signal - caller lifetime; abort terminates the native command.
223
+ * @returns an opened confirmation or the resolved directory for text display.
224
+ * @throws RemoteError when the preset is missing, read-only, invalid, or cannot be opened.
225
+ */
226
+ async openAgentPresetDirectory(agentPreset, signal) {
227
+ if (agentPreset.length === 0) {
228
+ throw new RemoteError('gateway/bad-request', 'agent preset id must not be empty', {});
229
+ }
230
+ const presets = this.ctx.get('agentPresets');
231
+ if (presets === undefined) {
232
+ throw new RemoteError('agent-preset/not-found', 'this deployment composes no agent presets', { agentPreset, available: [] });
233
+ }
234
+ const preset = await presets.resolve(agentPreset);
235
+ if (preset.trust !== 'user') {
236
+ throw new RemoteError('agent-preset/read-only', `agent-presets: preset "${preset.id}" cannot be written: it ships with the deployment`, { agentPreset: preset.id, reason: 'it ships with the deployment' });
237
+ }
238
+ const directory = dirname(preset.path);
239
+ if (!this.canOpenPath())
240
+ return { opened: false, path: directory };
241
+ try {
242
+ await this.openPath(directory, signal);
243
+ return { opened: true };
244
+ }
245
+ catch (error) {
246
+ if (signal.aborted)
247
+ throw new RemoteError('gateway/cancelled', 'path open was aborted', {});
248
+ throw new RemoteError('gateway/internal', `path open failed: ${messageOf(error)}`, {}, { cause: error });
249
+ }
250
+ }
251
+ async write(ns, mode, input, expectedRevision) {
252
+ const parsed = settingsNamespaceRequestSchema.safeParse({ ns });
253
+ if (!parsed.success) {
254
+ throw new RemoteError('gateway/bad-request', `invalid payload for settings.${mode}`, { issues: parsed.error.issues });
255
+ }
256
+ const settings = this.provider();
257
+ const namespace = parsed.data.ns;
258
+ try {
259
+ if (mode === 'update')
260
+ await settings.update(namespace, input, expectedRevision);
261
+ else if (mode === 'replace')
262
+ await settings.replace(namespace, input, expectedRevision);
263
+ else
264
+ await settings.mutate(namespace, input, expectedRevision);
265
+ }
266
+ catch (error) {
267
+ throw rejected(ns, error);
268
+ }
269
+ const descriptor = settings.describe({ redactSecrets: true }).find(candidate => candidate.ns === namespace);
270
+ if (descriptor === undefined) {
271
+ // The write committed but the namespace vanished before this read: only a
272
+ // concurrent registrant disposal can produce it.
273
+ throw new RemoteError('gateway/internal', `settings namespace "${ns}" was disposed after the ${mode}`, {});
274
+ }
275
+ return namespaceView(descriptor);
276
+ }
277
+ /** Resolve the optional provider or report how to supply it. */
278
+ provider() {
279
+ const settings = this.ctx.get('settings');
280
+ if (settings === undefined) {
281
+ throw new RemoteError('gateway/internal', 'settings service is absent: this deployment does not mount a settings provider (e.g. @deepseek-ai/dsh-settings-file) in its composition', {});
282
+ }
283
+ return settings;
284
+ }
285
+ };
286
+ })();
287
+ export { SettingsController };
288
+ function messageOf(error) {
289
+ return error instanceof Error ? error.message : String(error);
290
+ }
291
+ function settingsConflictOf(error) {
292
+ if (typeof error !== 'object' || error === null)
293
+ return undefined;
294
+ if (Reflect.get(error, 'code') !== 'SETTINGS_CONFLICT'
295
+ || typeof Reflect.get(error, 'message') !== 'string'
296
+ || typeof Reflect.get(error, 'expected') !== 'number'
297
+ || typeof Reflect.get(error, 'actual') !== 'number')
298
+ return undefined;
299
+ return error;
300
+ }
301
+ /**
302
+ * Classify one seam refusal. A stale writer is its own outcome, not a malformed
303
+ * request: the client must re-read and re-apply rather than treat the write as
304
+ * invalid.
305
+ * @param ns - the namespace the write addressed.
306
+ * @param error - whatever the seam threw.
307
+ * @returns the failure to raise for that refusal.
308
+ */
309
+ function rejected(ns, error) {
310
+ const conflict = settingsConflictOf(error);
311
+ if (conflict !== undefined) {
312
+ return new RemoteError('settings/conflict', conflict.message, { ns, expected: conflict.expected, actual: conflict.actual }, { cause: error });
313
+ }
314
+ return new RemoteError('settings/rejected', messageOf(error), { ns }, { cause: error });
315
+ }
316
+ export default SettingsController;
317
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ /** Package-owned invariant companion. @module @deepseek-ai/dsh-api-settings-controller/invariant */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ /** Cordis companion plugin name. */
4
+ export declare const name = "api-settings-controller-invariant";
5
+ /** Service required before the companion can reserve package ownership. */
6
+ export declare const inject: string[];
7
+ /** Register this package's invariant companion. */
8
+ export declare const apply: (ctx: Context) => Promise<() => void>;
9
+ //# sourceMappingURL=invariant.d.ts.map
@@ -0,0 +1,15 @@
1
+ /** Package-owned invariant companion. @module @deepseek-ai/dsh-api-settings-controller/invariant */
2
+ const PACKAGE_NAME = '@deepseek-ai/dsh-api-settings-controller';
3
+ /** Cordis companion plugin name. */
4
+ export const name = 'api-settings-controller-invariant';
5
+ /** Service required before the companion can reserve package ownership. */
6
+ export const inject = ['invariants'];
7
+ /**
8
+ * No runtime invariant: the settings and credential seams own storage and
9
+ * update events, while this package only projects their methods onto the wire.
10
+ */
11
+ const install = () => { };
12
+ /** Register this package's invariant companion. */
13
+ export const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
14
+ /* jscpd:ignore-end */
15
+ //# sourceMappingURL=invariant.js.map
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Browser-safe failure vocabulary of the configuration surfaces this package
3
+ * serves. The redacted views themselves live with their seam in
4
+ * `@deepseek-ai/dsh-settings/types`, whose Cordis event declarations already
5
+ * register that file for the Client compilation face.
6
+ *
7
+ * @module @deepseek-ai/dsh-api-settings-controller/types
8
+ */
9
+ declare module '@deepseek-ai/dsh-typert-protocol' {
10
+ interface RemoteErrorDetailsMap {
11
+ /**
12
+ * Every seam refusal that is not a stale write: an unregistered or malformed
13
+ * namespace, a read-only provider, schema validation, storage.
14
+ */
15
+ 'settings/rejected': {
16
+ readonly ns: string;
17
+ };
18
+ /**
19
+ * The stored revision moved after the caller read it. Its own outcome rather
20
+ * than an invalid request: the caller must re-read and re-apply.
21
+ */
22
+ 'settings/conflict': {
23
+ readonly ns: string;
24
+ readonly expected: number;
25
+ readonly actual: number;
26
+ };
27
+ /**
28
+ * The provider refused a valid credential write, for example because a
29
+ * read-only source shadows the reference. The details name only the
30
+ * reference, never the value.
31
+ */
32
+ 'credential/rejected': {
33
+ readonly ref: string;
34
+ };
35
+ }
36
+ }
37
+ /** Confirmation that the settings document was handed to the native editor. */
38
+ export interface SettingsDocumentOpenValue {
39
+ readonly opened: true;
40
+ }
41
+ /** Result of opening or revealing one locally authored Agent preset directory. */
42
+ export type AgentPresetDirectoryOpenValue = {
43
+ readonly opened: true;
44
+ } | {
45
+ readonly opened: false;
46
+ readonly path: string;
47
+ };
48
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Browser-safe failure vocabulary of the configuration surfaces this package
3
+ * serves. The redacted views themselves live with their seam in
4
+ * `@deepseek-ai/dsh-settings/types`, whose Cordis event declarations already
5
+ * register that file for the Client compilation face.
6
+ *
7
+ * @module @deepseek-ai/dsh-api-settings-controller/types
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=types.js.map
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@deepseek-ai/dsh-api-settings-controller",
3
+ "description": "Remote owner for the configuration surfaces over the settings-domain seams",
4
+ "version": "0.1.2-alpha.2",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
11
+ "directory": "packages/api/settings-controller"
12
+ },
13
+ "type": "module",
14
+ "main": "lib/index.js",
15
+ "types": "lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./invariant": {
22
+ "types": "./lib/types/invariant.d.ts",
23
+ "default": "./lib/invariant.js"
24
+ },
25
+ "./types": {
26
+ "types": "./lib/types/types.d.ts",
27
+ "default": "./lib/types/types.js"
28
+ },
29
+ "./typert": {
30
+ "types": "./lib/typert.host.d.ts",
31
+ "default": "./lib/typert.host.js"
32
+ },
33
+ "./remote": {
34
+ "types": "./lib/typert.remote-client.d.ts",
35
+ "default": "./lib/typert.remote-client.js"
36
+ },
37
+ "./src/*": "./src/*",
38
+ "./package.json": "./package.json"
39
+ },
40
+ "files": [
41
+ "lib/index.js",
42
+ "lib/invariant.js",
43
+ "lib/types/**/*.js",
44
+ "lib/types/**/*.d.ts",
45
+ "lib/typert.host.js",
46
+ "lib/typert.host.d.ts",
47
+ "lib/typert.remote-client.js",
48
+ "lib/typert.remote-client.d.ts"
49
+ ],
50
+ "license": "MIT",
51
+ "dependencies": {
52
+ "zod": "^4.4.3",
53
+ "@deepseek-ai/schemastery": "^3.18.2"
54
+ },
55
+ "peerDependencies": {
56
+ "@deepseek-ai/cordis": "^4.0.2",
57
+ "@deepseek-ai/dsh-credentials": "^0.1.2-alpha.2",
58
+ "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2",
59
+ "@deepseek-ai/dsh-native-command": "^0.1.2-alpha.2",
60
+ "@deepseek-ai/dsh-session": "^0.1.2-alpha.2",
61
+ "@deepseek-ai/dsh-settings": "^0.1.2-alpha.2",
62
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.2-alpha.2",
63
+ "@deepseek-ai/dsh-agent-presets": "^0.1.2-alpha.2"
64
+ },
65
+ "devDependencies": {
66
+ "@deepseek-ai/cordis": "^4.0.2",
67
+ "@deepseek-ai/dsh-agent-presets": "^0.1.2-alpha.2",
68
+ "@deepseek-ai/dsh-credentials": "^0.1.2-alpha.2",
69
+ "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2",
70
+ "@deepseek-ai/dsh-native-command": "^0.1.2-alpha.2",
71
+ "@deepseek-ai/dsh-settings": "^0.1.2-alpha.2",
72
+ "@deepseek-ai/dsh-typert-protocol": "^0.1.2-alpha.2",
73
+ "@deepseek-ai/dsh-session": "^0.1.2-alpha.2"
74
+ }
75
+ }