@qilin-agent/client-ui-settings-plugins 0.0.0-stage → 3.1.3
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 +52 -0
- package/README.md +112 -2
- package/README.zh.md +113 -0
- package/lib/client.js +2173 -0
- package/lib/index.js +13 -0
- package/lib/types/client/AgentLoopCard.d.ts +12 -0
- package/lib/types/client/BashCard.d.ts +12 -0
- package/lib/types/client/GitCard.d.ts +12 -0
- package/lib/types/client/PluginConfigForm.d.ts +34 -0
- package/lib/types/client/PluginsSettingsSection.d.ts +27 -0
- package/lib/types/client/SubagentCard.d.ts +12 -0
- package/lib/types/client/SubagentLimitsFields.d.ts +14 -0
- package/lib/types/client/SubagentModelSelectionFields.d.ts +14 -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 +69 -0
- package/lib/types/client/git-card-controller.d.ts +69 -0
- package/lib/types/client/index.d.ts +26 -0
- package/lib/types/client/locales.d.ts +8 -0
- package/lib/types/client/subagent-card-controller.d.ts +32 -0
- package/lib/types/client/subagent-limits-card-controller.d.ts +33 -0
- package/lib/types/client/subagent-model-selection-card-controller.d.ts +129 -0
- package/lib/types/client/web-search-card-controller.d.ts +93 -0
- package/lib/types/index.d.ts +11 -0
- package/package.json +66 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Shared presentation and actions for the two Host-owned Subagent settings sections. */
|
|
2
|
+
import type { CardShell } from './card-form.ts';
|
|
3
|
+
import type { SubagentLimitsCardFace, SubagentLimitsCardState } from './subagent-limits-card-controller.ts';
|
|
4
|
+
import type { SubagentModelSelectionCardFace, SubagentModelSelectionCardState } from './subagent-model-selection-card-controller.ts';
|
|
5
|
+
/** Both existing form sources and the actions exposed by one Subagent card. */
|
|
6
|
+
export interface SubagentCardFace {
|
|
7
|
+
hooks: SubagentLimitsCardFace['hooks'] & SubagentModelSelectionCardFace['hooks'];
|
|
8
|
+
editLimit: SubagentLimitsCardFace['edit'];
|
|
9
|
+
resetLimit: SubagentLimitsCardFace['resetField'];
|
|
10
|
+
toggleEnabled: SubagentModelSelectionCardFace['toggleEnabled'];
|
|
11
|
+
toggleModel: SubagentModelSelectionCardFace['toggleModel'];
|
|
12
|
+
retryCatalog: SubagentModelSelectionCardFace['retryCatalog'];
|
|
13
|
+
/** Save valid drafts through their owning namespace controllers. */
|
|
14
|
+
save: () => void;
|
|
15
|
+
/** Discard both drafts without changing persisted settings. */
|
|
16
|
+
discard: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Derive the shared card state without duplicating either form's subscriptions.
|
|
20
|
+
* @param limits - Current delegation-limit form.
|
|
21
|
+
* @param models - Current model-authorization form.
|
|
22
|
+
* @returns Availability and settlement across the sections this Host serves.
|
|
23
|
+
*/
|
|
24
|
+
export declare function subagentCardShell(limits: SubagentLimitsCardState, models: SubagentModelSelectionCardState): CardShell;
|
|
25
|
+
/**
|
|
26
|
+
* Compose one card from the existing forms; each write retains its namespace revision fence.
|
|
27
|
+
* @param limits - Limit form source and actions.
|
|
28
|
+
* @param models - Model form source and actions.
|
|
29
|
+
* @returns Framework-bound sources and shared save/discard actions.
|
|
30
|
+
*/
|
|
31
|
+
export declare function subagentCardFace(limits: SubagentLimitsCardFace, models: SubagentModelSelectionCardFace): SubagentCardFace;
|
|
32
|
+
//# sourceMappingURL=subagent-card-controller.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Staged delegation limits backed by the Host's subagent settings section. */
|
|
2
|
+
import type { SnapshotStore } from '@qilin-agent/client-store';
|
|
3
|
+
import type { ConfigForm } from '@qilin-agent/client-ui-settings/client';
|
|
4
|
+
import { type CardActions, type CardFieldState, type CardShell } from './card-form.ts';
|
|
5
|
+
/** Host-owned delegation defaults and live capacity. */
|
|
6
|
+
export interface SubagentLimitsSettings {
|
|
7
|
+
maxDepth: number;
|
|
8
|
+
maxActiveSubagents: number;
|
|
9
|
+
}
|
|
10
|
+
/** Effective values and drafts presented by the limits card. */
|
|
11
|
+
export interface SubagentLimitsCardState extends CardShell {
|
|
12
|
+
maxDepth: CardFieldState;
|
|
13
|
+
maxActiveSubagents: CardFieldState;
|
|
14
|
+
}
|
|
15
|
+
/** Actions and observable state bound by the slot renderer. */
|
|
16
|
+
export interface SubagentLimitsCardFace extends CardActions {
|
|
17
|
+
hooks: {
|
|
18
|
+
subagentLimitsCard: SnapshotStore<SubagentLimitsCardState>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** Bind two independently resettable limits to one staged settings form. */
|
|
22
|
+
export declare class SubagentLimitsCardController {
|
|
23
|
+
private readonly form;
|
|
24
|
+
private readonly store;
|
|
25
|
+
/** @param scope - The Host's `subagent` settings section. */
|
|
26
|
+
constructor(scope: ConfigForm<SubagentLimitsSettings>);
|
|
27
|
+
/**
|
|
28
|
+
* Bind the limits editor to the slot renderer.
|
|
29
|
+
* @returns The limits snapshot and staged write actions.
|
|
30
|
+
*/
|
|
31
|
+
inject(): SubagentLimitsCardFace;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=subagent-limits-card-controller.d.ts.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/** Staged editor for the Host-owned subagent model allowlist. */
|
|
2
|
+
import type { Context as ClientContext } from '@qilin-agent/kylin';
|
|
3
|
+
import type { ModelProviderGroup } from '@qilin-agent/api-remotes/client';
|
|
4
|
+
import { type SnapshotStore } from '@qilin-agent/client-store';
|
|
5
|
+
import type { ConfigForm } from '@qilin-agent/client-ui-settings/client';
|
|
6
|
+
import type { CardShell } from './card-form.ts';
|
|
7
|
+
/** Namespace of the Host-owned subagent model-selection preference. */
|
|
8
|
+
export declare const SUBAGENT_MODEL_SELECTION_NS = "subagent-model-selection";
|
|
9
|
+
/** One exact provider/model route stored as user authorization. */
|
|
10
|
+
export interface AllowedSubagentModel {
|
|
11
|
+
provider: string;
|
|
12
|
+
model: string;
|
|
13
|
+
}
|
|
14
|
+
/** Settings fields stored for subagent model selection. */
|
|
15
|
+
export interface SubagentModelSelectionSettings {
|
|
16
|
+
/** Whether model-facing child route selection applies to new Sessions. */
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
/** Exact child routes offered to newly composed top-level Sessions. */
|
|
19
|
+
allowedModels: AllowedSubagentModel[];
|
|
20
|
+
}
|
|
21
|
+
/** One catalog row joined with a stored route that may no longer be advertised. */
|
|
22
|
+
export interface SubagentModelCandidate extends AllowedSubagentModel {
|
|
23
|
+
/** Stable opaque identity used only for lookup. */
|
|
24
|
+
key: string;
|
|
25
|
+
/** Adapter-owned provider display name. */
|
|
26
|
+
providerName: string;
|
|
27
|
+
/** Adapter-owned model display name. */
|
|
28
|
+
modelName: string;
|
|
29
|
+
/** Whether the current adapter catalog advertises this exact route. */
|
|
30
|
+
available: boolean;
|
|
31
|
+
/** Whether the current draft authorizes this route. */
|
|
32
|
+
selected: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** State rendered by the staged allowlist card. */
|
|
35
|
+
export interface SubagentModelSelectionCardState extends CardShell {
|
|
36
|
+
/** Whether the draft enables model-facing child route selection. */
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
/** Live catalog joined with stored routes. */
|
|
39
|
+
candidates: readonly SubagentModelCandidate[];
|
|
40
|
+
/** Adapter-directory request state. */
|
|
41
|
+
catalogStatus: 'idle' | 'loading' | 'ready' | 'error';
|
|
42
|
+
/** Whether any provider-local catalog request failed. */
|
|
43
|
+
catalogPartial: boolean;
|
|
44
|
+
/** Whether a newer Host revision invalidated the current draft. */
|
|
45
|
+
conflicted: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Registration-side face for the subagent model-selection card. */
|
|
48
|
+
export interface SubagentModelSelectionCardFace {
|
|
49
|
+
hooks: {
|
|
50
|
+
/** Card snapshot bound by the renderer as useSubagentModelSelectionCard. */
|
|
51
|
+
subagentModelSelectionCard: SnapshotStore<SubagentModelSelectionCardState>;
|
|
52
|
+
};
|
|
53
|
+
/** Stage the enabled state; enabling also loads the adapter directory. */
|
|
54
|
+
toggleEnabled: () => void;
|
|
55
|
+
/** Stage one exact route as allowed or denied. */
|
|
56
|
+
toggleModel: (key: string) => void;
|
|
57
|
+
/** Retry the adapter directory. */
|
|
58
|
+
retryCatalog: () => void;
|
|
59
|
+
/** Persist the switch and exact routes as one revision-fenced mutation. */
|
|
60
|
+
save: () => void;
|
|
61
|
+
/** Drop the staged enabled state and route choices. */
|
|
62
|
+
discard: () => void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Stable identity for one exact route; callers resolve it by lookup and never parse it.
|
|
66
|
+
* @param route - Provider/model route to identify.
|
|
67
|
+
* @returns Opaque key for lookup within the card.
|
|
68
|
+
*/
|
|
69
|
+
export declare function subagentModelKey(route: AllowedSubagentModel): string;
|
|
70
|
+
/**
|
|
71
|
+
* Join live adapter metadata with stored routes that remain removable after disappearance.
|
|
72
|
+
* @param groups - Current model directory grouped by provider.
|
|
73
|
+
* @param stored - Routes in the effective settings value.
|
|
74
|
+
* @param selected - Opaque route keys selected in the current draft.
|
|
75
|
+
* @returns Candidate rows for the card.
|
|
76
|
+
*/
|
|
77
|
+
export declare function subagentModelCandidates(groups: readonly ModelProviderGroup[], stored: readonly AllowedSubagentModel[], selected: ReadonlySet<string>): SubagentModelCandidate[];
|
|
78
|
+
/** Bridges one settings scope and the live adapter directory onto a staged card. */
|
|
79
|
+
export declare class SubagentModelSelectionCardController {
|
|
80
|
+
private readonly scope;
|
|
81
|
+
private readonly ctx;
|
|
82
|
+
private catalogGroups;
|
|
83
|
+
private catalogPartial;
|
|
84
|
+
private catalogStatus;
|
|
85
|
+
private draftEnabled;
|
|
86
|
+
private draftRoutes;
|
|
87
|
+
private draftRevision;
|
|
88
|
+
private saving;
|
|
89
|
+
private failed;
|
|
90
|
+
private conflicted;
|
|
91
|
+
private disposed;
|
|
92
|
+
private saveGeneration;
|
|
93
|
+
private catalogGeneration;
|
|
94
|
+
private readonly store;
|
|
95
|
+
private readonly unsubscribe;
|
|
96
|
+
/**
|
|
97
|
+
* @param scope - bound `subagent-model-selection` settings scope.
|
|
98
|
+
* @param ctx - the card plugin's context, whose `remote.session` namespace
|
|
99
|
+
* answers the Host model catalog.
|
|
100
|
+
*/
|
|
101
|
+
constructor(scope: ConfigForm<SubagentModelSelectionSettings>, ctx: ClientContext);
|
|
102
|
+
/** Stop observing settings and suppress late directory/write settlements. */
|
|
103
|
+
dispose(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Build the renderer face for this card.
|
|
106
|
+
* @returns The snapshot and staged card actions injected into the renderer.
|
|
107
|
+
*/
|
|
108
|
+
inject(): SubagentModelSelectionCardFace;
|
|
109
|
+
private currentRoutes;
|
|
110
|
+
private currentEnabled;
|
|
111
|
+
private selected;
|
|
112
|
+
private enabled;
|
|
113
|
+
private beginDraft;
|
|
114
|
+
private toggleEnabled;
|
|
115
|
+
private toggleModel;
|
|
116
|
+
private clearDraft;
|
|
117
|
+
private discard;
|
|
118
|
+
private candidates;
|
|
119
|
+
private desiredRoutes;
|
|
120
|
+
private save;
|
|
121
|
+
/** Invalidate and reload model candidates after a Host model input changes. */
|
|
122
|
+
refreshCatalog(): void;
|
|
123
|
+
/** Drop Host-specific candidates and drafts, then reload after reconnecting. */
|
|
124
|
+
resetConnection(): void;
|
|
125
|
+
private loadCatalog;
|
|
126
|
+
private projection;
|
|
127
|
+
private publish;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=subagent-model-selection-card-controller.d.ts.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The web-search card's staged form over the `web-search-deepseek` settings
|
|
3
|
+
* namespace.
|
|
4
|
+
*
|
|
5
|
+
* The key is the one control that does not live in the section: its literal
|
|
6
|
+
* never rides a response, so the card learns only whether one is configured
|
|
7
|
+
* and writes it through the credentials domain, addressed by the reference the
|
|
8
|
+
* section names. It is still staged with the rest of the form, so one save
|
|
9
|
+
* covers everything the card shows.
|
|
10
|
+
*/
|
|
11
|
+
import type { Context as ClientContext } from '@qilin-agent/kylin';
|
|
12
|
+
import type { SnapshotStore } from '@qilin-agent/client-store';
|
|
13
|
+
import type { ConfigForm } from '@qilin-agent/client-ui-settings/client';
|
|
14
|
+
import { type CardActions, type CardFieldState, type CardShell } from './card-form.ts';
|
|
15
|
+
/**
|
|
16
|
+
* Namespace of the DeepSeek search provider. Spelled here rather than
|
|
17
|
+
* imported: a client package must not depend on a Host package.
|
|
18
|
+
*/
|
|
19
|
+
export declare const WEB_SEARCH_NS = "web-search-deepseek";
|
|
20
|
+
/** The search-provider fields this card edits. */
|
|
21
|
+
export interface WebSearchSettings {
|
|
22
|
+
/** Credential reference naming the environment key. */
|
|
23
|
+
apiKeyEnv?: string;
|
|
24
|
+
/** Provider endpoint; blank inherits the provider default. */
|
|
25
|
+
baseURL?: string;
|
|
26
|
+
/** Maximum searches served within one request. */
|
|
27
|
+
maxUses?: number;
|
|
28
|
+
}
|
|
29
|
+
/** What the web-search card renders. */
|
|
30
|
+
export interface WebSearchCardState extends CardShell {
|
|
31
|
+
/** Provider endpoint. */
|
|
32
|
+
baseURL: CardFieldState;
|
|
33
|
+
/** Searches allowed per request. */
|
|
34
|
+
maxUses: CardFieldState;
|
|
35
|
+
/** The staged credential, which starts blank on every load. */
|
|
36
|
+
apiKey: CardFieldState;
|
|
37
|
+
/** Whether the Host reports a credential configured for the referenced key. */
|
|
38
|
+
apiKeyConfigured: boolean;
|
|
39
|
+
/** Whether the credentials domain accepts a write for it; false disables the control. */
|
|
40
|
+
apiKeyWritable: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** The registration-side face the web-search card's slot entry injects. */
|
|
43
|
+
export interface WebSearchCardFace extends CardActions {
|
|
44
|
+
hooks: {
|
|
45
|
+
/** Card snapshot bound by the renderer as useWebSearchCard. */
|
|
46
|
+
webSearchCard: SnapshotStore<WebSearchCardState>;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Bridges the `web-search-deepseek` scope and the credentials domain onto the card. */
|
|
50
|
+
export declare class WebSearchCardController {
|
|
51
|
+
private readonly scope;
|
|
52
|
+
private readonly ctx;
|
|
53
|
+
private readonly form;
|
|
54
|
+
private readonly store;
|
|
55
|
+
private credential;
|
|
56
|
+
/**
|
|
57
|
+
* @param scope - the bound settings scope for the `web-search-deepseek` namespace.
|
|
58
|
+
* @param ctx - the card plugin's context, whose `remote.credentials` namespace
|
|
59
|
+
* answers for the credential the section references.
|
|
60
|
+
*/
|
|
61
|
+
constructor(scope: ConfigForm<WebSearchSettings>, ctx: ClientContext);
|
|
62
|
+
private projection;
|
|
63
|
+
/**
|
|
64
|
+
* Ask the credentials domain about the reference the section currently names.
|
|
65
|
+
*
|
|
66
|
+
* The answer is stored with the reference it describes: `apiKeyEnv` can
|
|
67
|
+
* change between the request and its response, and two reads can settle out
|
|
68
|
+
* of order, so a response is published only while it still answers for the
|
|
69
|
+
* reference in force.
|
|
70
|
+
*/
|
|
71
|
+
private readCredential;
|
|
72
|
+
/**
|
|
73
|
+
* Re-read after the Host reports a change to the reference this card watches.
|
|
74
|
+
*
|
|
75
|
+
* A key can be written from somewhere else — the Models page addresses the
|
|
76
|
+
* same reference — and the settings section does not change when it is, so
|
|
77
|
+
* without this the badge keeps reporting a state the Host already replaced.
|
|
78
|
+
* @param ref - the reference the Host reports as changed.
|
|
79
|
+
*/
|
|
80
|
+
refreshCredential(ref: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Build the face the card's slot registration injects.
|
|
83
|
+
* @returns the card's snapshot and its form actions.
|
|
84
|
+
*/
|
|
85
|
+
inject(): WebSearchCardFace;
|
|
86
|
+
/**
|
|
87
|
+
* Write the staged key, then re-read whether the Host now holds one.
|
|
88
|
+
* @param value - the staged credential literal.
|
|
89
|
+
* @returns whether the Host reports a configured credential afterwards.
|
|
90
|
+
*/
|
|
91
|
+
private writeKey;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=web-search-card-controller.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugins settings surface, node half. The empty apply exists so the plugin
|
|
3
|
+
* appears in the host cordis.yml / Loader; the browser half owns the section
|
|
4
|
+
* and its configurable tab through exports["./client"], discovered from the
|
|
5
|
+
* package.json qilin.client declaration. Every section this page edits is owned
|
|
6
|
+
* by the Host plugin that registered it, so this package registers no
|
|
7
|
+
* namespace of its own.
|
|
8
|
+
*/
|
|
9
|
+
/** Host plugin body — no host-side behavior for this surface plugin. */
|
|
10
|
+
export declare function apply(): void;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/client-ui-settings-plugins",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Plugins settings section with feature-owned tabs and configurable host-plane plugin cards",
|
|
4
|
+
"version": "3.1.3",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/kkutysllb/QiLin.git",
|
|
11
|
+
"directory": "packages/client/ui-settings-plugins"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "lib/index.js",
|
|
18
|
+
"types": "lib/types/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./lib/types/index.d.ts",
|
|
22
|
+
"default": "./lib/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./client": {
|
|
25
|
+
"types": "./lib/types/client/index.d.ts",
|
|
26
|
+
"default": "./lib/client.js"
|
|
27
|
+
},
|
|
28
|
+
"./src/*": "./src/*",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"qilin": {
|
|
32
|
+
"client": {
|
|
33
|
+
"inject": [
|
|
34
|
+
"@qilin-agent/client-locale",
|
|
35
|
+
"@qilin-agent/client-ui-settings",
|
|
36
|
+
"@qilin-agent/api-remotes"
|
|
37
|
+
],
|
|
38
|
+
"platform": "web"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@qilin-agent/kylin": "~4.0.3"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/react": "~18.3.1",
|
|
47
|
+
"clsx": "^2.0.0",
|
|
48
|
+
"react": "^18.2.0",
|
|
49
|
+
"@qilin-agent/kylin": "~4.0.3",
|
|
50
|
+
"@qilin-agent/api-remotes": "3.1.3",
|
|
51
|
+
"@qilin-agent/client-locale": "3.1.3",
|
|
52
|
+
"@qilin-agent/client-store": "3.1.3",
|
|
53
|
+
"@qilin-agent/client-ui-plugin-manager": "3.1.3",
|
|
54
|
+
"@qilin-agent/client-test-runtime": "3.1.3",
|
|
55
|
+
"@qilin-agent/client-ui-primitives": "3.1.3",
|
|
56
|
+
"@qilin-agent/client-ui-renderer": "3.1.3",
|
|
57
|
+
"@qilin-agent/client-ui-slots": "3.1.3",
|
|
58
|
+
"@qilin-agent/client-ui-settings": "3.1.3"
|
|
59
|
+
},
|
|
60
|
+
"files": [
|
|
61
|
+
"lib/index.js",
|
|
62
|
+
"lib/client.js",
|
|
63
|
+
"lib/types/**/*.d.ts"
|
|
64
|
+
],
|
|
65
|
+
"scripts": {
|
|
66
|
+
"bundle": "tsdown",
|
|
67
|
+
"watch": "tsdown --watch"
|
|
68
|
+
}
|
|
6
69
|
}
|