@qilin-agent/client-ui-agent-preset 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 +43 -0
- package/README.md +91 -2
- package/README.zh.md +92 -0
- package/lib/client.js +2546 -0
- package/lib/index.js +11 -0
- package/lib/types/client/AgentPresetLabel.d.ts +30 -0
- package/lib/types/client/AgentPresetSeat.d.ts +40 -0
- package/lib/types/client/AgentPresetSection.d.ts +63 -0
- package/lib/types/client/CreatePluginMenuItem.d.ts +21 -0
- package/lib/types/client/index.d.ts +36 -0
- package/lib/types/client/locales.d.ts +10 -0
- package/lib/types/client/seat-store.d.ts +121 -0
- package/lib/types/client/section-store.d.ts +212 -0
- package/lib/types/client/settings-store.d.ts +119 -0
- package/lib/types/index.d.ts +9 -0
- package/package.json +78 -3
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-preset roster store shared by the display surfaces.
|
|
3
|
+
*
|
|
4
|
+
* Options come from one `agentPresets.list` call. Writes target the settings
|
|
5
|
+
* namespace fields the host resolves at creation; the management section is
|
|
6
|
+
* the surface that writes them.
|
|
7
|
+
*/
|
|
8
|
+
import type { Context as ClientContext } from '@qilin-agent/kylin';
|
|
9
|
+
import { type SnapshotStore } from '@qilin-agent/client-store';
|
|
10
|
+
import type { AgentPresetRoster } from '@qilin-agent/agent-presets/types';
|
|
11
|
+
/** The agent-preset settings namespace on the host wire. */
|
|
12
|
+
export declare const AGENT_PRESET_SETTINGS_NS = "agent-presets";
|
|
13
|
+
/**
|
|
14
|
+
* Persist one preset as the default for sessions created later.
|
|
15
|
+
*
|
|
16
|
+
* The default is a settings field rather than a preset property; the
|
|
17
|
+
* management section writes it here — one home for which namespace and field
|
|
18
|
+
* the host resolves at session creation.
|
|
19
|
+
* @param ctx - the browser plugin context carrying the Remote namespaces.
|
|
20
|
+
* @param id - the preset to make default.
|
|
21
|
+
* @returns the failure message, or undefined once the write landed.
|
|
22
|
+
*/
|
|
23
|
+
export declare function writeDefaultPreset(ctx: ClientContext, id: string): Promise<string | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Persist whether new-session surfaces expose preset selection.
|
|
26
|
+
* @param ctx - the browser plugin context carrying the Remote namespaces.
|
|
27
|
+
* @param enabled - whether the picker should be exposed.
|
|
28
|
+
* @returns the failure message, or undefined once the write landed.
|
|
29
|
+
*/
|
|
30
|
+
export declare function writeModeSelectionEnabled(ctx: ClientContext, enabled: boolean): Promise<string | undefined>;
|
|
31
|
+
/** One selectable preset. */
|
|
32
|
+
export interface AgentPresetOption {
|
|
33
|
+
/** Preset id, written to Settings and the label's fallback. */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Whether the preset ships with the deployment or was authored locally. */
|
|
36
|
+
trust: 'system' | 'user';
|
|
37
|
+
/** Display name the preset published, absent when it published none. */
|
|
38
|
+
name?: string;
|
|
39
|
+
/** One sentence on what the preset is for. */
|
|
40
|
+
description?: string;
|
|
41
|
+
}
|
|
42
|
+
/** One roster entry exactly as the host reports it. */
|
|
43
|
+
export type RosterPreset = AgentPresetRoster['presets'][number];
|
|
44
|
+
/** The roster, or the message to show in its place. */
|
|
45
|
+
export type RosterRead = {
|
|
46
|
+
ok: true;
|
|
47
|
+
value: AgentPresetRoster;
|
|
48
|
+
} | {
|
|
49
|
+
ok: false;
|
|
50
|
+
error: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Read the roster, turning a refusal into the message every surface shows.
|
|
54
|
+
* @param ctx - the browser plugin context carrying the Remote namespaces.
|
|
55
|
+
* @returns the roster, or the message to show in its place.
|
|
56
|
+
*/
|
|
57
|
+
export declare function readRoster(ctx: ClientContext): Promise<RosterRead>;
|
|
58
|
+
/**
|
|
59
|
+
* The opening move every roster-backed surface makes: refuse a read that is
|
|
60
|
+
* already in flight, mark the store loading, then read.
|
|
61
|
+
*
|
|
62
|
+
* A surface that gets `undefined` returns without touching its snapshot
|
|
63
|
+
* further — either another read owns it, or this one already wrote the
|
|
64
|
+
* failure. What differs between surfaces starts after this.
|
|
65
|
+
* @param ctx - the browser plugin context carrying the Remote namespaces.
|
|
66
|
+
* @param store - the surface's own snapshot store.
|
|
67
|
+
* @returns the roster, or undefined when the caller should return.
|
|
68
|
+
*/
|
|
69
|
+
export declare function beginRosterRead<S extends {
|
|
70
|
+
status: string;
|
|
71
|
+
error: string | null;
|
|
72
|
+
}>(ctx: ClientContext, store: SnapshotStore<S>): Promise<AgentPresetRoster | undefined>;
|
|
73
|
+
/**
|
|
74
|
+
* The roster entries as the pickers render them: healthy presets only.
|
|
75
|
+
*
|
|
76
|
+
* The chip exists to choose the NEXT session's composition, and a broken
|
|
77
|
+
* preset cannot compose one — offering it would defer the discovery of that
|
|
78
|
+
* fact to a failed session start. The management section renders the full
|
|
79
|
+
* roster (broken rows included) from its own store instead.
|
|
80
|
+
*
|
|
81
|
+
* The chip, the header label, and the management section all show the same
|
|
82
|
+
* facts, and `exactOptionalPropertyTypes` makes "absent" and "present as
|
|
83
|
+
* undefined" different shapes — so the spread dance belongs in one place rather than
|
|
84
|
+
* once per store.
|
|
85
|
+
* @param presets - the roster the host answered with.
|
|
86
|
+
* @returns one option per selectable preset, in roster order.
|
|
87
|
+
*/
|
|
88
|
+
export declare function presetOptions(presets: readonly {
|
|
89
|
+
id: string;
|
|
90
|
+
trust: 'system' | 'user';
|
|
91
|
+
name?: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
broken?: string;
|
|
94
|
+
}[]): AgentPresetOption[];
|
|
95
|
+
/** Agent-preset roster snapshot for the display surfaces. */
|
|
96
|
+
export interface AgentPresetSettingsState {
|
|
97
|
+
status: 'idle' | 'loading' | 'ready' | 'unavailable' | 'error';
|
|
98
|
+
error: string | null;
|
|
99
|
+
options: readonly AgentPresetOption[];
|
|
100
|
+
}
|
|
101
|
+
/** Reads the roster for the surfaces that only display it. */
|
|
102
|
+
export declare class AgentPresetSettingsController {
|
|
103
|
+
private readonly ctx;
|
|
104
|
+
/** Roster snapshot the renderer subscribes to. */
|
|
105
|
+
readonly store: SnapshotStore<AgentPresetSettingsState>;
|
|
106
|
+
/**
|
|
107
|
+
* @param ctx - the browser plugin context (the roster read).
|
|
108
|
+
*/
|
|
109
|
+
constructor(ctx: ClientContext);
|
|
110
|
+
private set;
|
|
111
|
+
/**
|
|
112
|
+
* Load the roster. An empty roster means the deployment composes no
|
|
113
|
+
* presets, which is a valid deployment rather than a failure — the
|
|
114
|
+
* surfaces report `unavailable` and render nothing.
|
|
115
|
+
* @returns once the snapshot reflects the host.
|
|
116
|
+
*/
|
|
117
|
+
load(): Promise<void>;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=settings-store.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-preset surface plugin, node half. The empty apply exists so the plugin
|
|
3
|
+
* appears in the host cordis.yml / Loader; the browser half ships the
|
|
4
|
+
* General-settings row through exports["./client"], discovered from the
|
|
5
|
+
* package.json qilin.client declaration.
|
|
6
|
+
*/
|
|
7
|
+
/** Host plugin body — no host-side behavior for this surface plugin. */
|
|
8
|
+
export declare function apply(): void;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qilin-agent/client-ui-agent-preset",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Agent-preset surfaces: the default for later sessions, this session's seat, and the composition editor",
|
|
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-agent-preset"
|
|
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/api-session-controller",
|
|
35
|
+
"@qilin-agent/client-connection",
|
|
36
|
+
"@qilin-agent/client-locale",
|
|
37
|
+
"@qilin-agent/client-ui-conversation",
|
|
38
|
+
"@qilin-agent/client-ui-session",
|
|
39
|
+
"@qilin-agent/client-ui-settings",
|
|
40
|
+
"@qilin-agent/client-ui-workspace",
|
|
41
|
+
"@qilin-agent/api-remotes"
|
|
42
|
+
],
|
|
43
|
+
"platform": "web"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@qilin-agent/kylin": "~4.0.3"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/react": "~18.3.1",
|
|
52
|
+
"react": "^18.2.0",
|
|
53
|
+
"@qilin-agent/api-remotes": "3.1.3",
|
|
54
|
+
"@qilin-agent/api-session-controller": "3.1.3",
|
|
55
|
+
"@qilin-agent/agent-presets": "3.1.3",
|
|
56
|
+
"@qilin-agent/client-connection": "3.1.3",
|
|
57
|
+
"@qilin-agent/client-locale": "3.1.3",
|
|
58
|
+
"@qilin-agent/client-store": "3.1.3",
|
|
59
|
+
"@qilin-agent/client-test-runtime": "3.1.3",
|
|
60
|
+
"@qilin-agent/client-ui-conversation": "3.1.3",
|
|
61
|
+
"@qilin-agent/client-ui-plugin-manager": "3.1.3",
|
|
62
|
+
"@qilin-agent/client-ui-primitives": "3.1.3",
|
|
63
|
+
"@qilin-agent/client-ui-slots": "3.1.3",
|
|
64
|
+
"@qilin-agent/client-ui-settings": "3.1.3",
|
|
65
|
+
"@qilin-agent/util-values": "3.1.3",
|
|
66
|
+
"@qilin-agent/kylin": "~4.0.3",
|
|
67
|
+
"@qilin-agent/session": "3.1.3",
|
|
68
|
+
"@qilin-agent/client-ui-renderer": "3.1.3",
|
|
69
|
+
"@qilin-agent/client-ui-session": "3.1.3",
|
|
70
|
+
"@qilin-agent/client-ui-workspace": "3.1.3"
|
|
71
|
+
},
|
|
72
|
+
"files": [
|
|
73
|
+
"lib/index.js",
|
|
74
|
+
"lib/client.js",
|
|
75
|
+
"lib/types/**/*.d.ts"
|
|
76
|
+
],
|
|
77
|
+
"scripts": {
|
|
78
|
+
"bundle": "tsdown",
|
|
79
|
+
"watch": "tsdown --watch"
|
|
80
|
+
}
|
|
6
81
|
}
|