@prettier-ai/dsh-client-ui-settings-plugins 0.1.2-alpha.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/LICENSE +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +108 -0
- package/README.zh.md +108 -0
- package/lib/client.js +1837 -0
- package/lib/index.js +13 -0
- package/lib/invariant.js +24 -0
- package/lib/types/client/AgentLoopCard.d.ts +12 -0
- package/lib/types/client/BashCard.d.ts +12 -0
- package/lib/types/client/ConfigurablePluginsTab.d.ts +19 -0
- package/lib/types/client/PluginCard.d.ts +42 -0
- package/lib/types/client/PluginsSettingsSection.d.ts +27 -0
- package/lib/types/client/SubagentModelSelectionCard.d.ts +12 -0
- package/lib/types/client/WebSearchCard.d.ts +16 -0
- package/lib/types/client/agent-loop-card-controller.d.ts +43 -0
- package/lib/types/client/bash-card-controller.d.ts +45 -0
- package/lib/types/client/card-form.d.ts +171 -0
- package/lib/types/client/fields.d.ts +61 -0
- package/lib/types/client/index.d.ts +29 -0
- package/lib/types/client/locales.d.ts +8 -0
- package/lib/types/client/slot-contract.d.ts +31 -0
- package/lib/types/client/subagent-model-selection-card-controller.d.ts +127 -0
- package/lib/types/client/tab-store.d.ts +65 -0
- package/lib/types/client/web-search-card-controller.d.ts +94 -0
- package/lib/types/index.d.ts +11 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +81 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region lib/types/index.js
|
|
2
|
+
/**
|
|
3
|
+
* Plugins settings surface, node half. The empty apply exists so the plugin
|
|
4
|
+
* appears in the host cordis.yml / Loader; the browser half owns the section
|
|
5
|
+
* and its configurable tab through exports["./client"], discovered from the
|
|
6
|
+
* package.json dsh.client declaration. Every section this page edits is owned
|
|
7
|
+
* by the Host plugin that registered it, so this package registers no
|
|
8
|
+
* namespace of its own.
|
|
9
|
+
*/
|
|
10
|
+
/** Host plugin body — no host-side behavior for this surface plugin. */
|
|
11
|
+
function apply() {}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { apply };
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/**
|
|
3
|
+
* Package-owned invariant companion for `@prettier-ai/dsh-client-ui-settings-plugins`.
|
|
4
|
+
* @module @prettier-ai/dsh-client-ui-settings-plugins/invariant
|
|
5
|
+
*/
|
|
6
|
+
const PACKAGE_NAME = "@prettier-ai/dsh-client-ui-settings-plugins";
|
|
7
|
+
/** Cordis companion plugin name. */
|
|
8
|
+
const name = "client-ui-settings-plugins-invariant";
|
|
9
|
+
/** Service required before the companion can reserve package ownership. */
|
|
10
|
+
const inject = ["invariants"];
|
|
11
|
+
/**
|
|
12
|
+
* No runtime invariant: this is a browser-side settings surface whose node half owns no event
|
|
13
|
+
* stream or mutable runtime data; the layering and write refusals are Host contracts covered by
|
|
14
|
+
* the owning plugins and the api-proxy.
|
|
15
|
+
*/
|
|
16
|
+
const install = () => {};
|
|
17
|
+
/**
|
|
18
|
+
* Register this package's invariant companion.
|
|
19
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
20
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
21
|
+
*/
|
|
22
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
23
|
+
//#endregion
|
|
24
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The agent loop's card: how many tool calls one step may run at once. */
|
|
2
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@prettier-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { AgentLoopCardFace } from './agent-loop-card-controller.ts';
|
|
4
|
+
/** Props the renderer binds for the agent-loop card. */
|
|
5
|
+
export type AgentLoopCardProps = PropsRuntime<'settings.plugin.item'> & PropsLocale<'settings.plugins'> & InjectFace<AgentLoopCardFace>;
|
|
6
|
+
/**
|
|
7
|
+
* Render the agent-loop card.
|
|
8
|
+
* @param props - locale copy, the card snapshot, and its form actions.
|
|
9
|
+
* @returns the card.
|
|
10
|
+
*/
|
|
11
|
+
export declare function AgentLoopCard(props: AgentLoopCardProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=AgentLoopCard.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** The shell plugin's card: the limits every command the agent runs is bound by. */
|
|
2
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@prettier-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { BashCardFace } from './bash-card-controller.ts';
|
|
4
|
+
/** Props the renderer binds for the shell card. */
|
|
5
|
+
export type BashCardProps = PropsRuntime<'settings.plugin.item'> & PropsLocale<'settings.plugins'> & InjectFace<BashCardFace>;
|
|
6
|
+
/**
|
|
7
|
+
* Render the shell card.
|
|
8
|
+
* @param props - locale copy, the card snapshot, and its form actions.
|
|
9
|
+
* @returns the card.
|
|
10
|
+
*/
|
|
11
|
+
export declare function BashCard(props: BashCardProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=BashCard.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configurable Host plugins contributed to the shared Plugins section.
|
|
3
|
+
*
|
|
4
|
+
* The tab enumerates settings namespaces but never interprets one — a card
|
|
5
|
+
* arrives through `settings.plugin.item` keyed by the namespace it edits, so a
|
|
6
|
+
* plugin that ships a browser half owns its own card and this tab only decides
|
|
7
|
+
* which keys to dispatch.
|
|
8
|
+
*/
|
|
9
|
+
import type { InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime } from '@prettier-ai/dsh-client-ui-slots';
|
|
10
|
+
import type { ConfigurablePluginsTabFace } from './tab-store.ts';
|
|
11
|
+
/** Props the renderer binds for the configurable tab. */
|
|
12
|
+
export type ConfigurablePluginsTabProps = PropsRuntime<'settings.plugins.tab'> & PropsLocale<'settings.plugins'> & PropsRenderSlots<'settings.plugin.item'> & InjectFace<ConfigurablePluginsTabFace>;
|
|
13
|
+
/**
|
|
14
|
+
* Render cards registered by plugins that expose editable settings.
|
|
15
|
+
* @param props - locale copy, slot rendering, and the namespaces to dispatch.
|
|
16
|
+
* @returns the card list, or the empty line once the Host has answered.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ConfigurablePluginsTab(props: ConfigurablePluginsTabProps): import("react").JSX.Element | null;
|
|
19
|
+
//# sourceMappingURL=ConfigurablePluginsTab.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One plugin's card: a header naming the plugin and what its settings govern,
|
|
3
|
+
* disclosing that plugin's controls in place, with the save that writes them.
|
|
4
|
+
*
|
|
5
|
+
* The header is its own button rather than a shared disclosure row because a
|
|
6
|
+
* card stacks its name over its description, while that row lays the two side
|
|
7
|
+
* by side — the layout, not the behavior, is what differs. Disclosure is
|
|
8
|
+
* card-local state: which card a user has open is a reading gesture, not
|
|
9
|
+
* something the Host or the section has any stake in. Staged edits outlive
|
|
10
|
+
* collapsing, so the header marks a card holding unsaved edits.
|
|
11
|
+
*
|
|
12
|
+
* A card renders nothing while its namespace is unavailable: a deployment that
|
|
13
|
+
* does not compose the owning plugin should show no trace of it, rather than a
|
|
14
|
+
* disabled card the user cannot act on.
|
|
15
|
+
*/
|
|
16
|
+
import { type ReactNode } from 'react';
|
|
17
|
+
import type { CardShell } from './card-form.ts';
|
|
18
|
+
import type { PluginsSettingsLocaleKey } from './locales.ts';
|
|
19
|
+
/** Card chrome shared by every plugin section. */
|
|
20
|
+
export interface PluginCardProps {
|
|
21
|
+
/** Locale reader for this section's copy. */
|
|
22
|
+
t: (key: PluginsSettingsLocaleKey) => string;
|
|
23
|
+
/** Locale key of the plugin's name. */
|
|
24
|
+
titleKey: PluginsSettingsLocaleKey;
|
|
25
|
+
/** Locale key of the line describing what this plugin's settings govern. */
|
|
26
|
+
descriptionKey: PluginsSettingsLocaleKey;
|
|
27
|
+
/** The card's form state: availability, writability, and what a save would do. */
|
|
28
|
+
state: CardShell;
|
|
29
|
+
/** Write every staged edit. */
|
|
30
|
+
onSave: () => void;
|
|
31
|
+
/** Drop every staged edit. */
|
|
32
|
+
onDiscard: () => void;
|
|
33
|
+
/** The plugin's controls. */
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Render one plugin card.
|
|
38
|
+
* @param props - the plugin's copy keys, its form state, and its controls.
|
|
39
|
+
* @returns the card, or nothing when the namespace is unavailable.
|
|
40
|
+
*/
|
|
41
|
+
export declare function PluginCard(props: PluginCardProps): import("react").JSX.Element | null;
|
|
42
|
+
//# sourceMappingURL=PluginCard.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Plugins settings section: localized tabs around feature-owned pages. */
|
|
2
|
+
import type { HostObservable, InjectFace, PropsLocale, PropsRenderSlots, PropsRuntime } from '@prettier-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { PluginsSettingsLocaleKey } from './locales.ts';
|
|
4
|
+
/** One tab projected from a `settings.plugins.tab` contribution. */
|
|
5
|
+
export interface PluginsSettingsTabEntry {
|
|
6
|
+
id: string;
|
|
7
|
+
order: number;
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
|
+
/** Registration-side business face for the section. */
|
|
11
|
+
export interface PluginsSettingsSectionInjected {
|
|
12
|
+
hooks: {
|
|
13
|
+
/** Ordered, locale-aware projection of the Plugins tab ledger. */
|
|
14
|
+
tabs: HostObservable<readonly PluginsSettingsTabEntry[]>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Props the renderer binds for the section. */
|
|
18
|
+
export type PluginsSettingsSectionProps = PropsRuntime<'settings.section'> & PropsLocale<'settings.plugins'> & PropsRenderSlots<'settings.plugins.tab'> & InjectFace<PluginsSettingsSectionInjected>;
|
|
19
|
+
/** Render one Plugins page whose contents arrive from feature-owned tabs. */
|
|
20
|
+
export declare function PluginsSettingsSection({ t, renderSlot, useTabs }: PluginsSettingsSectionProps): import("react").JSX.Element;
|
|
21
|
+
declare module '@prettier-ai/dsh-client-ui-slots' {
|
|
22
|
+
interface LocaleNamespaceMap {
|
|
23
|
+
/** Plugins section, configurable-tab, and card copy. */
|
|
24
|
+
'settings.plugins': PluginsSettingsLocaleKey;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=PluginsSettingsSection.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** User control for model-selectable subagent delegation in new sessions. */
|
|
2
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@prettier-ai/dsh-client-ui-slots';
|
|
3
|
+
import type { SubagentModelSelectionCardFace } from './subagent-model-selection-card-controller.ts';
|
|
4
|
+
/** Props the renderer binds for the subagent model-selection card. */
|
|
5
|
+
export type SubagentModelSelectionCardProps = PropsRuntime<'settings.plugin.item'> & PropsLocale<'settings.plugins'> & InjectFace<SubagentModelSelectionCardFace>;
|
|
6
|
+
/**
|
|
7
|
+
* Render the default-off preference and its exact adapter-route choices.
|
|
8
|
+
* @param props - locale copy, the card snapshot, and its toggle action.
|
|
9
|
+
* @returns the preference card, or nothing when the namespace is unavailable.
|
|
10
|
+
*/
|
|
11
|
+
export declare function SubagentModelSelectionCard(props: SubagentModelSelectionCardProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=SubagentModelSelectionCard.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The web-search provider's card: its endpoint, its per-request search budget,
|
|
3
|
+
* and the key — which is written through the credentials domain, never into
|
|
4
|
+
* the settings section, so the literal never rides a response.
|
|
5
|
+
*/
|
|
6
|
+
import type { InjectFace, PropsLocale, PropsRuntime } from '@prettier-ai/dsh-client-ui-slots';
|
|
7
|
+
import type { WebSearchCardFace } from './web-search-card-controller.ts';
|
|
8
|
+
/** Props the renderer binds for the web-search card. */
|
|
9
|
+
export type WebSearchCardProps = PropsRuntime<'settings.plugin.item'> & PropsLocale<'settings.plugins'> & InjectFace<WebSearchCardFace>;
|
|
10
|
+
/**
|
|
11
|
+
* Render the web-search card.
|
|
12
|
+
* @param props - locale copy, the card snapshot, and its form actions.
|
|
13
|
+
* @returns the card.
|
|
14
|
+
*/
|
|
15
|
+
export declare function WebSearchCard(props: WebSearchCardProps): import("react").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=WebSearchCard.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** The agent-loop card's staged form over the `agent-loop` settings namespace. */
|
|
2
|
+
import type { SnapshotStore } from '@prettier-ai/dsh-client-store';
|
|
3
|
+
import type { SettingsScope } from '@prettier-ai/dsh-client-ui-settings/client';
|
|
4
|
+
import { type CardActions, type CardFieldState, type CardShell } from './card-form.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Namespace of the agent loop's user-owned settings. Spelled here rather than
|
|
7
|
+
* imported: a client package must not depend on a Host package.
|
|
8
|
+
*/
|
|
9
|
+
export declare const AGENT_LOOP_NS = "agent-loop";
|
|
10
|
+
/**
|
|
11
|
+
* The agent-loop fields this card edits. The Host section carries only this
|
|
12
|
+
* field — the composed `agents` array is deliberately not part of it.
|
|
13
|
+
*/
|
|
14
|
+
export interface AgentLoopSettings {
|
|
15
|
+
/** Upper bound on parallel-safe tool calls in flight per step. */
|
|
16
|
+
maxParallelToolCalls?: number;
|
|
17
|
+
}
|
|
18
|
+
/** What the agent-loop card renders. */
|
|
19
|
+
export interface AgentLoopCardState extends CardShell {
|
|
20
|
+
/** Parallel tool-call cap. */
|
|
21
|
+
maxParallelToolCalls: CardFieldState;
|
|
22
|
+
}
|
|
23
|
+
/** The registration-side face the agent-loop card's slot entry injects. */
|
|
24
|
+
export interface AgentLoopCardFace extends CardActions {
|
|
25
|
+
hooks: {
|
|
26
|
+
/** Card snapshot bound by the renderer as useAgentLoopCard. */
|
|
27
|
+
agentLoopCard: SnapshotStore<AgentLoopCardState>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Bridges the `agent-loop` scope onto the card's staged form. */
|
|
31
|
+
export declare class AgentLoopCardController {
|
|
32
|
+
private readonly form;
|
|
33
|
+
private readonly store;
|
|
34
|
+
/** @param scope - the bound settings scope for the `agent-loop` namespace. */
|
|
35
|
+
constructor(scope: SettingsScope<AgentLoopSettings>);
|
|
36
|
+
private projection;
|
|
37
|
+
/**
|
|
38
|
+
* Build the face the card's slot registration injects.
|
|
39
|
+
* @returns the card's snapshot and its form actions.
|
|
40
|
+
*/
|
|
41
|
+
inject(): AgentLoopCardFace;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=agent-loop-card-controller.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** The shell card's staged form over the `bash` settings namespace. */
|
|
2
|
+
import type { SnapshotStore } from '@prettier-ai/dsh-client-store';
|
|
3
|
+
import type { SettingsScope } from '@prettier-ai/dsh-client-ui-settings/client';
|
|
4
|
+
import { type CardActions, type CardFieldState, type CardShell } from './card-form.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Namespace of the shell capability. Spelled here rather than imported: a
|
|
7
|
+
* client package must not depend on a Host package, and the executor families
|
|
8
|
+
* that own it spell the same value.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SHELL_NS = "shell";
|
|
11
|
+
/** The shell fields this card edits — a subset of the served schema by design. */
|
|
12
|
+
export interface BashSettings {
|
|
13
|
+
/** Foreground command timeout in milliseconds. */
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
/** Per-stream in-memory output cap in bytes. */
|
|
16
|
+
maxOutputBytes?: number;
|
|
17
|
+
}
|
|
18
|
+
/** What the shell card renders. */
|
|
19
|
+
export interface BashCardState extends CardShell {
|
|
20
|
+
/** Command timeout in milliseconds. */
|
|
21
|
+
timeoutMs: CardFieldState;
|
|
22
|
+
/** Per-stream output cap in bytes. */
|
|
23
|
+
maxOutputBytes: CardFieldState;
|
|
24
|
+
}
|
|
25
|
+
/** The registration-side face the shell card's slot entry injects. */
|
|
26
|
+
export interface BashCardFace extends CardActions {
|
|
27
|
+
hooks: {
|
|
28
|
+
/** Card snapshot bound by the renderer as useBashCard. */
|
|
29
|
+
bashCard: SnapshotStore<BashCardState>;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** Bridges the `bash` scope onto the shell card's staged form. */
|
|
33
|
+
export declare class BashCardController {
|
|
34
|
+
private readonly form;
|
|
35
|
+
private readonly store;
|
|
36
|
+
/** @param scope - the bound settings scope for the `bash` namespace. */
|
|
37
|
+
constructor(scope: SettingsScope<BashSettings>);
|
|
38
|
+
private projection;
|
|
39
|
+
/**
|
|
40
|
+
* Build the face the card's slot registration injects.
|
|
41
|
+
* @returns the card's snapshot and its form actions.
|
|
42
|
+
*/
|
|
43
|
+
inject(): BashCardFace;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=bash-card-controller.d.ts.map
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared form model behind every plugin card.
|
|
3
|
+
*
|
|
4
|
+
* A card stages what the user types and writes it only when they save. Each
|
|
5
|
+
* settings write is a durable, revision-fenced document mutation, so a control
|
|
6
|
+
* that committed as it settled turned one edit into a write the user never
|
|
7
|
+
* asked for and could not preview; staged text makes what is on screen exactly
|
|
8
|
+
* what a save would store.
|
|
9
|
+
*
|
|
10
|
+
* A field shows its effective value — the user layer over the composition
|
|
11
|
+
* layer over the schema default — and whether the user layer carries it. That
|
|
12
|
+
* presence, not a value comparison, is what marks a field overridden: an
|
|
13
|
+
* override equal to the composition default is still an override.
|
|
14
|
+
*/
|
|
15
|
+
import { type SnapshotStore } from '@prettier-ai/dsh-client-store';
|
|
16
|
+
import type { SettingsScope } from '@prettier-ai/dsh-client-ui-settings/client';
|
|
17
|
+
/** The write one field's staged text performs when the card is saved. */
|
|
18
|
+
export type FieldWrite = {
|
|
19
|
+
kind: 'set';
|
|
20
|
+
value: unknown;
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'clear';
|
|
23
|
+
};
|
|
24
|
+
/** How one section field converts between its stored value and its draft text. */
|
|
25
|
+
export interface CardFieldSpec {
|
|
26
|
+
/** Field name inside the namespace section. */
|
|
27
|
+
field: string;
|
|
28
|
+
/** Render a stored value as draft text; the empty string when the section carries none. */
|
|
29
|
+
format: (value: unknown) => string;
|
|
30
|
+
/**
|
|
31
|
+
* The write this draft text stages, or undefined when the text is not a
|
|
32
|
+
* value this field accepts — which blocks the save rather than discarding it.
|
|
33
|
+
*/
|
|
34
|
+
parse: (text: string) => FieldWrite | undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A control whose value is written outside the settings section. A credential
|
|
38
|
+
* literal never rides a response, so its draft has nothing to seed from: it is
|
|
39
|
+
* blank until typed, and a blank draft writes nothing.
|
|
40
|
+
*/
|
|
41
|
+
export interface CardSecretSpec {
|
|
42
|
+
/** Field name addressing this control inside the card's form. */
|
|
43
|
+
field: string;
|
|
44
|
+
/** Write the staged text; resolves to whether the Host accepted it. */
|
|
45
|
+
write: (text: string) => Promise<boolean>;
|
|
46
|
+
}
|
|
47
|
+
/** One field as a card's control renders it. */
|
|
48
|
+
export interface CardFieldState {
|
|
49
|
+
/** Draft text the control renders. */
|
|
50
|
+
text: string;
|
|
51
|
+
/**
|
|
52
|
+
* Whether saving would leave a user-layer entry for this field. A staged
|
|
53
|
+
* edit answers for itself, so the badge previews the save rather than
|
|
54
|
+
* reporting a state the pending edit already contradicts.
|
|
55
|
+
*/
|
|
56
|
+
overridden: boolean;
|
|
57
|
+
/** Whether the draft is not a value this field accepts, which blocks saving. */
|
|
58
|
+
invalid: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** Form state every plugin card shares. */
|
|
61
|
+
export interface CardShell {
|
|
62
|
+
/** False while the namespace is not served to this client; the card renders nothing. */
|
|
63
|
+
available: boolean;
|
|
64
|
+
/** Whether the Host document accepts writes. */
|
|
65
|
+
writable: boolean;
|
|
66
|
+
/** Whether the form holds edits that a save would write. */
|
|
67
|
+
dirty: boolean;
|
|
68
|
+
/** Whether any staged draft is invalid, which blocks the save. */
|
|
69
|
+
invalid: boolean;
|
|
70
|
+
/** Whether a save is crossing the wire. */
|
|
71
|
+
saving: boolean;
|
|
72
|
+
/** Whether the last save did not land as staged; cleared by the next edit or save. */
|
|
73
|
+
failed: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** The write actions every plugin card's slot entry injects. */
|
|
76
|
+
export interface CardActions {
|
|
77
|
+
/** Stage draft text for one field. */
|
|
78
|
+
edit: (field: string, text: string) => void;
|
|
79
|
+
/** Stage a clear, so saving lets the field re-inherit the composition layer. */
|
|
80
|
+
resetField: (field: string) => void;
|
|
81
|
+
/** Write every staged edit, then re-seed from what the Host accepted. */
|
|
82
|
+
save: () => void;
|
|
83
|
+
/** Drop every staged edit. */
|
|
84
|
+
discard: () => void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A whole-number field. An empty draft clears the field; any other draft that
|
|
88
|
+
* is not a finite number blocks the save.
|
|
89
|
+
* @param field - field name inside the namespace section.
|
|
90
|
+
* @returns the field's conversion spec.
|
|
91
|
+
*/
|
|
92
|
+
export declare function numberField(field: string): CardFieldSpec;
|
|
93
|
+
/**
|
|
94
|
+
* A free-text field. An empty draft clears the field, so emptying the control
|
|
95
|
+
* and saving is the same gesture as resetting it.
|
|
96
|
+
* @param field - field name inside the namespace section.
|
|
97
|
+
* @returns the field's conversion spec.
|
|
98
|
+
*/
|
|
99
|
+
export declare function textField(field: string): CardFieldSpec;
|
|
100
|
+
/**
|
|
101
|
+
* Stages one card's edits over one settings namespace and writes them on save.
|
|
102
|
+
*
|
|
103
|
+
* The form publishes through a snapshot store because slot components read
|
|
104
|
+
* through a snapshot selector, while both the scope and the local drafts
|
|
105
|
+
* change underneath; every projection is rebuilt from the two together.
|
|
106
|
+
*/
|
|
107
|
+
export declare class CardForm<T> {
|
|
108
|
+
private readonly scope;
|
|
109
|
+
private readonly specs;
|
|
110
|
+
private readonly secretSpecs;
|
|
111
|
+
private readonly staged;
|
|
112
|
+
private readonly listeners;
|
|
113
|
+
private saving;
|
|
114
|
+
private failed;
|
|
115
|
+
/**
|
|
116
|
+
* @param scope - the bound settings scope for this card's namespace.
|
|
117
|
+
* @param specs - the section fields this card edits.
|
|
118
|
+
* @param secrets - the card's write-only controls, written outside the section.
|
|
119
|
+
*/
|
|
120
|
+
constructor(scope: SettingsScope<T>, specs: CardFieldSpec[], secrets?: CardSecretSpec[]);
|
|
121
|
+
/**
|
|
122
|
+
* Publish a projection of this form, rebuilt whenever the scope or a draft changes.
|
|
123
|
+
* @param project - build the card's state from the form's current reads.
|
|
124
|
+
* @returns the store the card's component reads through its bound selector.
|
|
125
|
+
*/
|
|
126
|
+
bind<S>(project: () => S): SnapshotStore<S>;
|
|
127
|
+
/**
|
|
128
|
+
* Read the card-level state: what the Host serves, and what a save would do.
|
|
129
|
+
* @returns the form state every card shares.
|
|
130
|
+
*/
|
|
131
|
+
shell(): CardShell;
|
|
132
|
+
/**
|
|
133
|
+
* Read one control's state.
|
|
134
|
+
* @param field - field name of a section field or of a write-only control.
|
|
135
|
+
* @returns the draft text, whether a save would leave an override, and whether it is invalid.
|
|
136
|
+
*/
|
|
137
|
+
field(field: string): CardFieldState;
|
|
138
|
+
/**
|
|
139
|
+
* Build the edit, reset, save, and discard actions bound to this form.
|
|
140
|
+
* @returns the actions a card's slot entry injects.
|
|
141
|
+
*/
|
|
142
|
+
actions(): CardActions;
|
|
143
|
+
/**
|
|
144
|
+
* Write every staged edit, then re-seed from what the Host accepted.
|
|
145
|
+
*
|
|
146
|
+
* The Host is the only authority on whether a value was accepted — its
|
|
147
|
+
* validators own the constraints no schema can express — so the outcome is
|
|
148
|
+
* read back from the section rather than predicted here. A save that did not
|
|
149
|
+
* land keeps its drafts, so the user can correct them instead of retyping.
|
|
150
|
+
* @returns settlement after every write and the read-back.
|
|
151
|
+
*/
|
|
152
|
+
save(): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Every staged edit a save would write. An entry whose draft is not a value
|
|
155
|
+
* its field accepts carries no write: the form is still dirty, and the save
|
|
156
|
+
* refuses rather than dropping the edit.
|
|
157
|
+
* @returns the planned writes, in the order the fields were staged.
|
|
158
|
+
*/
|
|
159
|
+
private plan;
|
|
160
|
+
private clear;
|
|
161
|
+
private store;
|
|
162
|
+
private stage;
|
|
163
|
+
private spec;
|
|
164
|
+
private snapshotOf;
|
|
165
|
+
private sectionValue;
|
|
166
|
+
private baseValue;
|
|
167
|
+
private userLayer;
|
|
168
|
+
private stored;
|
|
169
|
+
private publish;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=card-form.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-written controls for the plugin configuration forms. Each renders one
|
|
3
|
+
* field's label, its staged text, whether saving would leave an override, and
|
|
4
|
+
* — when one stands — the reset that stages a clear back to the composition
|
|
5
|
+
* layer. Nothing here writes: a control reports what the user typed, and the
|
|
6
|
+
* card's save is the single point where a draft becomes a document mutation.
|
|
7
|
+
*/
|
|
8
|
+
/** What every field control needs regardless of its value type. */
|
|
9
|
+
export interface FieldProps {
|
|
10
|
+
/** Stable id associating the label with its control. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Visible label. */
|
|
13
|
+
label: string;
|
|
14
|
+
/** One-line explanation rendered under the control. */
|
|
15
|
+
hint: string;
|
|
16
|
+
/** Draft text this control renders. */
|
|
17
|
+
text: string;
|
|
18
|
+
/** True when saving would leave a user-layer entry for this field. */
|
|
19
|
+
overridden: boolean;
|
|
20
|
+
/** True when the draft is not a value this field accepts. */
|
|
21
|
+
invalid: boolean;
|
|
22
|
+
/** Copy for the overridden badge. */
|
|
23
|
+
overriddenLabel: string;
|
|
24
|
+
/** Copy for the reset control. */
|
|
25
|
+
resetLabel: string;
|
|
26
|
+
/** Copy shown in place of the hint while the draft is invalid. */
|
|
27
|
+
invalidLabel: string;
|
|
28
|
+
/** Disables every control (read-only document, or an unavailable namespace). */
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
/** Stage draft text. */
|
|
31
|
+
onEdit: (text: string) => void;
|
|
32
|
+
/** Stage a clear so the field re-inherits the composition layer. */
|
|
33
|
+
onReset: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A staged value field. `numeric` only hints the keypad: which drafts a field
|
|
37
|
+
* accepts is decided by its spec, so the control never silently rewrites what
|
|
38
|
+
* the user typed.
|
|
39
|
+
* @param props - the field's copy, its staged text, and the edit actions.
|
|
40
|
+
* @returns the labelled control.
|
|
41
|
+
*/
|
|
42
|
+
export declare function ValueField(props: FieldProps & {
|
|
43
|
+
/** Hints a numeric keypad without narrowing what the control accepts. */
|
|
44
|
+
numeric?: boolean;
|
|
45
|
+
/** Placeholder shown while the draft is empty. */
|
|
46
|
+
placeholder?: string;
|
|
47
|
+
}): import("react").JSX.Element;
|
|
48
|
+
/**
|
|
49
|
+
* A write-only credential control. The value never rides a response, so the
|
|
50
|
+
* control reports only whether one is configured and starts blank; a blank
|
|
51
|
+
* draft writes nothing, which keeps the stored key rather than clearing it.
|
|
52
|
+
* @param props - the field's copy, its staged text, and the configured state.
|
|
53
|
+
* @returns the labelled control.
|
|
54
|
+
*/
|
|
55
|
+
export declare function SecretField(props: Pick<FieldProps, 'id' | 'label' | 'hint' | 'text' | 'disabled' | 'onEdit'> & {
|
|
56
|
+
/** Whether the Host reports a configured credential for this reference. */
|
|
57
|
+
configured: boolean;
|
|
58
|
+
/** Copy describing the configured state. */
|
|
59
|
+
stateLabel: string;
|
|
60
|
+
}): import("react").JSX.Element;
|
|
61
|
+
//# sourceMappingURL=fields.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugins settings surface, browser half — one section whose feature-owned
|
|
3
|
+
* tabs include configurable Host plugin cards and read-only inventory.
|
|
4
|
+
*
|
|
5
|
+
* The section declares `settings.plugins.tab`; its own `configurable` tab then
|
|
6
|
+
* declares `settings.plugin.item` and renders whatever cards were registered
|
|
7
|
+
* into it. The cards this package ships are the host-plane sections the
|
|
8
|
+
* deployment already exposes; each binds its namespace through the client
|
|
9
|
+
* settings scope, which keeps them unaware of one another and of other tabs.
|
|
10
|
+
*/
|
|
11
|
+
import type { Context as ClientContext } from '@prettier-ai/cordis';
|
|
12
|
+
export type { PluginsSettingsSectionInjected, PluginsSettingsSectionProps } from './PluginsSettingsSection.tsx';
|
|
13
|
+
export type { ConfigurablePluginsTabProps } from './ConfigurablePluginsTab.tsx';
|
|
14
|
+
export type { ConfigurablePluginsTabFace, ConfigurablePluginsTabState } from './tab-store.ts';
|
|
15
|
+
export type { PluginCardProps } from './PluginCard.tsx';
|
|
16
|
+
export type { SettingsPluginItemOwnerProps } from './slot-contract.ts';
|
|
17
|
+
export type { FieldProps } from './fields.tsx';
|
|
18
|
+
export type { CardActions, CardFieldSpec, CardFieldState, CardSecretSpec, CardShell, } from './card-form.ts';
|
|
19
|
+
export type { AgentLoopCardFace, AgentLoopCardState } from './agent-loop-card-controller.ts';
|
|
20
|
+
export type { BashCardFace, BashCardState } from './bash-card-controller.ts';
|
|
21
|
+
export type { WebSearchCardFace, WebSearchCardState } from './web-search-card-controller.ts';
|
|
22
|
+
/** Required services (cordis fiber inject). */
|
|
23
|
+
export declare const inject: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Mount the plugin configuration section and the cards this package ships.
|
|
26
|
+
* @param ctx - the browser plugin context.
|
|
27
|
+
*/
|
|
28
|
+
export declare function apply(ctx: ClientContext): void;
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Locale bundles for the plugin configuration section and its plugin cards. */
|
|
2
|
+
/** Locale keys these surfaces render. */
|
|
3
|
+
export type PluginsSettingsLocaleKey = 'nav' | 'title' | 'intro' | 'tabs' | 'configurableTab' | 'empty' | 'overridden' | 'reset' | 'readOnly' | 'expand' | 'collapse' | 'save' | 'saving' | 'discard' | 'unsaved' | 'saveFailed' | 'invalidNumber' | 'bashTitle' | 'bashDescription' | 'bashTimeoutMs' | 'bashTimeoutMsHint' | 'bashMaxOutputBytes' | 'bashMaxOutputBytesHint' | 'agentLoopTitle' | 'agentLoopDescription' | 'agentLoopMaxParallel' | 'agentLoopMaxParallelHint' | 'webSearchTitle' | 'webSearchDescription' | 'webSearchApiKey' | 'webSearchApiKeyHint' | 'webSearchApiKeySet' | 'webSearchApiKeyUnset' | 'webSearchBaseUrl' | 'webSearchBaseUrlHint' | 'webSearchMaxUses' | 'webSearchMaxUsesHint' | 'subagentModelSelectionTitle' | 'subagentModelSelectionDescription' | 'subagentModelSelectionToggle' | 'subagentModelSelectionChoose' | 'subagentModelSelectionAllowed' | 'subagentModelSelectionLoading' | 'subagentModelSelectionLoadFailed' | 'subagentModelSelectionRetry' | 'subagentModelSelectionPartial' | 'subagentModelSelectionUnavailable' | 'subagentModelSelectionUnavailableGroup' | 'subagentModelSelectionEmpty' | 'subagentModelSelectionRequired' | 'subagentModelSelectionConflict' | 'subagentModelSelectionOff';
|
|
4
|
+
/** English copy. */
|
|
5
|
+
export declare const en: Record<PluginsSettingsLocaleKey, string>;
|
|
6
|
+
/** Simplified Chinese copy. */
|
|
7
|
+
export declare const zh: Record<PluginsSettingsLocaleKey, string>;
|
|
8
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `settings.plugin.item` slot type — one plugin's card inside the
|
|
3
|
+
* configurable-plugins tab, keyed by the settings namespace the card edits.
|
|
4
|
+
* Options: `key` (the namespace). A card draws its own internals; the tab only
|
|
5
|
+
* decides which namespaces to dispatch and stacks what comes back.
|
|
6
|
+
*
|
|
7
|
+
* Keying on the namespace is what lets a plugin distributed outside this
|
|
8
|
+
* repository contribute a card: it registers its own settings namespace on the
|
|
9
|
+
* Host and its own card under that key in the browser, and the tab pairs the
|
|
10
|
+
* two without ever learning what the namespace means.
|
|
11
|
+
*
|
|
12
|
+
* TYPE HOME RATIONALE: the tab declares this slot at runtime, and a plugin
|
|
13
|
+
* registering its own card already depends on this package for the slot's
|
|
14
|
+
* declaration. The type therefore lives with its declarer.
|
|
15
|
+
*/
|
|
16
|
+
declare module '@prettier-ai/dsh-client-ui-slots' {
|
|
17
|
+
interface SlotMap {
|
|
18
|
+
/** One plugin's card inside the plugin configuration section (see module JSDoc). */
|
|
19
|
+
'settings.plugin.item': {
|
|
20
|
+
kind: 'keyed';
|
|
21
|
+
scope: 'root';
|
|
22
|
+
owner: SettingsPluginItemOwnerProps;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Owner share of a plugin card (the section supplies nothing). */
|
|
27
|
+
export interface SettingsPluginItemOwnerProps {
|
|
28
|
+
/** Marker field: card owner props are intentionally empty. */
|
|
29
|
+
children?: never;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=slot-contract.d.ts.map
|