@sparkelf/dsh-bot-agent 0.0.0-stage → 0.2.9-alpha.127

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,70 @@
1
+ /**
2
+ * The same-origin API surface shared by this package's two halves.
3
+ *
4
+ * The Host registers one prefix and dispatches on the trailing method name; the
5
+ * browser calls the same strings. Keeping them in one module stops the halves
6
+ * drifting apart. This module stays dependency-free so both bundles can import
7
+ * it: the Client bundle rejects Node builtins and non-platform packages.
8
+ *
9
+ * @module @sparkelf/dsh-bot-agent/api
10
+ */
11
+ /** Prefix the Host registers and the browser calls. */
12
+ export declare const BOT_API_PREFIX = "/bot-agent/api";
13
+ /** Method names the Host dispatches on. */
14
+ export declare const BOT_API: {
15
+ /** Every bot, built-in first. */
16
+ readonly list: "list";
17
+ /** One bot by id. */
18
+ readonly get: "get";
19
+ /** Create a custom bot. */
20
+ readonly create: "create";
21
+ /** Update a bot's editable fields. */
22
+ readonly update: "update";
23
+ /** Delete a custom bot; the built-in is refused. */
24
+ readonly delete: "delete";
25
+ };
26
+ /** One bot's persona prose, composed into its agent preset's system prompt. */
27
+ export interface BotPresetWire {
28
+ identity: string;
29
+ duties: string;
30
+ workStyle: string;
31
+ replyStyle: string;
32
+ }
33
+ /** A skill or tool black/white list. `all` admits everything; the list is unused. */
34
+ export interface BotPolicyWire {
35
+ mode: 'all' | 'allow' | 'deny';
36
+ list: string[];
37
+ }
38
+ /** Knowledge-base scope. `all` admits the whole library; the paths narrow it. */
39
+ export interface BotKbScopeWire {
40
+ mode: 'all' | 'include' | 'exclude';
41
+ paths: string[];
42
+ }
43
+ /** One bot as the browser receives it. */
44
+ export interface BotWire {
45
+ id: string;
46
+ name: string;
47
+ avatar: string;
48
+ preset: BotPresetWire;
49
+ retrievalSummary: string;
50
+ kbScope: BotKbScopeWire;
51
+ skillPolicy: BotPolicyWire;
52
+ toolPolicy: BotPolicyWire;
53
+ createdAt: number;
54
+ builtin: boolean;
55
+ /** Marketplace template this bot was copied from; absent for hand-made bots. */
56
+ templateId?: string;
57
+ }
58
+ /** Fields a create or update accepts; the Host fills id, createdAt, and builtin. */
59
+ export interface BotDraftWire {
60
+ name: string;
61
+ avatar: string;
62
+ preset: BotPresetWire;
63
+ retrievalSummary: string;
64
+ kbScope?: BotKbScopeWire;
65
+ skillPolicy?: BotPolicyWire;
66
+ toolPolicy?: BotPolicyWire;
67
+ /** Marketplace template id when the draft copies a template. */
68
+ templateId?: string;
69
+ }
70
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1,12 @@
1
+ import type { Bot } from './storage.ts';
2
+ /** Stable id of the built-in bot; also its agent preset id. */
3
+ export declare const BUILTIN_BOT_ID = "bot-super";
4
+ /** Avatar catalog key the built-in renders. */
5
+ export declare const BUILTIN_AVATAR = "super";
6
+ /**
7
+ * The seed record for the built-in super assistant.
8
+ * @param now - creation instant, epoch milliseconds.
9
+ * @returns the built-in bot, marked `builtin`.
10
+ */
11
+ export declare function builtinBot(now: number): Bot;
12
+ //# sourceMappingURL=builtin.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * One bot avatar: the catalog's hue and glyph drawn through the shared
3
+ * {@link HueTile} recipe (rounded tile, gradient, top highlight, hairline).
4
+ * Self-written and offline-safe; the same component serves the grid card, the
5
+ * detail header, the picker, and the session-row seat at the size each surface
6
+ * asks for.
7
+ *
8
+ * @module @sparkelf/dsh-bot-agent/client/BotAvatar
9
+ */
10
+ import type { ReactNode } from 'react';
11
+ /** Props of one avatar render. */
12
+ export interface BotAvatarProps {
13
+ /** Stored avatar key. */
14
+ avatar: string;
15
+ /** Edge length in pixels. */
16
+ size: number;
17
+ /** Accessible name; omitted renders a decorative glyph. */
18
+ label?: string;
19
+ }
20
+ /**
21
+ * Render the avatar tile.
22
+ * @param props - avatar key, edge size, and optional accessible name.
23
+ * @returns the avatar SVG.
24
+ */
25
+ export declare function BotAvatar({ avatar, size, label }: BotAvatarProps): ReactNode;
26
+ //# sourceMappingURL=BotAvatar.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Avatar picker: the curated SVG catalog as a selectable grid.
3
+ *
4
+ * @module @sparkelf/dsh-bot-agent/client/BotAvatarPicker
5
+ */
6
+ import type { ReactNode } from 'react';
7
+ import type { BotLocaleKey } from './locales.ts';
8
+ /** Props of the avatar picker. */
9
+ export interface BotAvatarPickerProps {
10
+ value: string;
11
+ onChange: (key: string) => void;
12
+ t: (key: BotLocaleKey) => string;
13
+ }
14
+ /**
15
+ * Render the avatar catalog as a radio-like grid.
16
+ * @param props - selected key, change callback, and copy resolver.
17
+ * @returns the picker grid.
18
+ */
19
+ export declare function BotAvatarPicker({ value, onChange, t }: BotAvatarPickerProps): ReactNode;
20
+ //# sourceMappingURL=BotAvatarPicker.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Bot detail form: name, avatar, the four persona fields, and the retrieval
3
+ * summary. The parent keys this component by bot id, so the draft seeds from the
4
+ * bot on mount and a selection change remounts a fresh form.
5
+ *
6
+ * @module @sparkelf/dsh-bot-agent/client/BotDetail
7
+ */
8
+ import { type ReactNode } from 'react';
9
+ import type { BotDraftWire, BotWire } from '../api.ts';
10
+ import type { BotLocaleKey } from './locales.ts';
11
+ /** Props of the detail form. */
12
+ export interface BotDetailProps {
13
+ /** The bot being edited, or null for a new one. */
14
+ bot: BotWire | null;
15
+ t: (key: BotLocaleKey) => string;
16
+ saving: boolean;
17
+ onSave: (draft: BotDraftWire) => void;
18
+ onDelete: () => void;
19
+ onStartSession: () => void;
20
+ onBack: () => void;
21
+ }
22
+ /**
23
+ * Render the detail form.
24
+ * @param props - the bot, copy resolver, and action callbacks.
25
+ * @returns the detail form.
26
+ */
27
+ export declare function BotDetail({ bot, t, saving, onSave, onDelete, onStartSession, onBack }: BotDetailProps): ReactNode;
28
+ //# sourceMappingURL=BotDetail.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Agent marketplace: discover built-in template bots and copy one into the
3
+ * user's own agents. Design-referenced from LobeHub (featured horizontal row,
4
+ * category groups with a preview cap, filter pills, debounced search, and the
5
+ * add state machine) with original components, glyphs, and copy.
6
+ *
7
+ * Search follows the client search rule through TextSearchIndex: name matches
8
+ * fuzzily across every language, summary and retrieval text match as substrings.
9
+ * A category facet or a non-empty query collapses the grouped browse into one
10
+ * complete list. Adding copies the template through the host create route and
11
+ * records its template id, so the card then reads as added.
12
+ *
13
+ * @module @sparkelf/dsh-bot-agent/client/BotMarket
14
+ */
15
+ import { type ReactNode } from 'react';
16
+ import type { BotWire } from '../api.ts';
17
+ import { type BotTemplate, type TemplateText } from './templates.ts';
18
+ import type { BotLocaleKey } from './locales.ts';
19
+ /** Props of the marketplace surface. */
20
+ export interface BotMarketProps {
21
+ t: (key: BotLocaleKey) => string;
22
+ /** Resolve a bilingual template string to the active locale. */
23
+ resolveText: (text: TemplateText) => string;
24
+ /** The user's bots, used to mark a template already copied. */
25
+ bots: BotWire[];
26
+ /** Copy a template into a new bot; resolves the draft and refreshes the store. */
27
+ addTemplate: (template: BotTemplate) => Promise<BotWire>;
28
+ /** Open an already-added bot in the My Agents detail form. */
29
+ onOpenBot: (id: string) => void;
30
+ }
31
+ /**
32
+ * Render the marketplace.
33
+ * @param props - copy resolver, locale text resolver, the user's bots, and the add/open callbacks.
34
+ * @returns the featured row and category groups, or one complete list when filtering.
35
+ */
36
+ export declare function BotMarket({ t, resolveText, bots, addTemplate, onOpenBot }: BotMarketProps): ReactNode;
37
+ //# sourceMappingURL=BotMarket.d.ts.map
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Bot management page: a view switcher between the user's agents (a grid of
3
+ * cards and the detail form one opens) and the agent marketplace. Reads the
4
+ * shared bot store; the host fetch and mutation callbacks arrive through the
5
+ * inject face, and selection and view through the store's own actions.
6
+ *
7
+ * @module @sparkelf/dsh-bot-agent/client/BotPanel
8
+ */
9
+ import { type ReactNode } from 'react';
10
+ import type { PropsLocale, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots/client';
11
+ import type { BotDraftWire, BotWire } from '../api.ts';
12
+ import type { BotTemplate, TemplateText } from './templates.ts';
13
+ import type { BotStoreHandle } from './SessionRowAvatar.tsx';
14
+ /** The host callbacks the page drives. */
15
+ export interface BotPanelInjected {
16
+ refresh: () => Promise<void>;
17
+ createBot: (draft: BotDraftWire) => Promise<BotWire>;
18
+ updateBot: (id: string, draft: BotDraftWire) => Promise<BotWire>;
19
+ removeBot: (id: string) => Promise<void>;
20
+ startSession: (presetId: string) => void;
21
+ /** Resolve a bilingual template string to the active locale. */
22
+ resolveText: (text: TemplateText) => string;
23
+ /** Copy a marketplace template into a new bot and refresh the store. */
24
+ addTemplate: (template: BotTemplate) => Promise<BotWire>;
25
+ }
26
+ /** Full page props: the main seat, the shared store, the locale seat, and the host callbacks. */
27
+ export type BotPanelProps = PropsRuntime<'main'> & PropsStore<BotStoreHandle> & PropsLocale<'botAgent'> & BotPanelInjected;
28
+ /**
29
+ * Render the management page.
30
+ * @param props - the seat shares and host callbacks.
31
+ * @returns the marketplace, the grid, or the detail form.
32
+ */
33
+ export declare function BotPanel({ t, useStore, actions, refresh, createBot, updateBot, removeBot, startSession, resolveText, addTemplate }: BotPanelProps): ReactNode;
34
+ //# sourceMappingURL=BotPanel.d.ts.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The sidebar's Agents glyph, from the shared primitives library so the row
3
+ * matches every other sidebar entry.
4
+ *
5
+ * @module @sparkelf/dsh-bot-agent/client/BotPanelIcon
6
+ */
7
+ import type { ReactNode } from 'react';
8
+ import type { PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots/client';
9
+ /**
10
+ * Render the glyph at the size the sidebar asks for.
11
+ * @param props - the sidebar's icon share.
12
+ * @returns the icon element.
13
+ */
14
+ export declare function BotPanelIcon({ size }: PropsRuntime<'sidebar.panellist'>): ReactNode;
15
+ //# sourceMappingURL=BotPanelIcon.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * One hue tile: a rounded SVG square with a vertical hue gradient, a top
3
+ * highlight, a hairline, and a white glyph. Self-written and offline-safe; the
4
+ * shared recipe behind both the bot avatar catalog and the marketplace category
5
+ * color table, following the Plus design reference (radius, hairline, highlight).
6
+ *
7
+ * @module @sparkelf/dsh-bot-agent/client/HueTile
8
+ */
9
+ import { type ReactNode } from 'react';
10
+ /** Props of one hue-tile render. */
11
+ export interface HueTileProps {
12
+ /** Tile hue in degrees. */
13
+ hue: number;
14
+ /** SVG path data drawn in a 24×24 viewBox, filled white over the tile. */
15
+ glyph: string;
16
+ /** Edge length in pixels. */
17
+ size: number;
18
+ /** Accessible name; omitted renders a decorative glyph. */
19
+ label?: string | undefined;
20
+ }
21
+ /**
22
+ * Render the hue tile.
23
+ * @param props - hue, glyph path, edge size, and optional accessible name.
24
+ * @returns the tile SVG.
25
+ */
26
+ export declare function HueTile({ hue, glyph, size, label }: HueTileProps): ReactNode;
27
+ //# sourceMappingURL=HueTile.d.ts.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The session-row avatar seat occupant: draws the bot avatar for a session whose
3
+ * recorded preset names a bot this plugin owns, and nothing otherwise. Reading
4
+ * the shared bot store activates no session.
5
+ *
6
+ * @module @sparkelf/dsh-bot-agent/client/SessionRowAvatar
7
+ */
8
+ import type { ReactNode } from 'react';
9
+ import type { PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots/client';
10
+ import type { createBotStore } from './store.ts';
11
+ /** The shared bot store handle type. */
12
+ export type BotStoreHandle = ReturnType<typeof createBotStore>;
13
+ /** Props of one avatar seat occurrence. */
14
+ export type SessionRowAvatarProps = PropsRuntime<'sidebar.session.row.avatar'> & PropsStore<BotStoreHandle>;
15
+ /**
16
+ * Render the row's bot avatar, or nothing for a preset this plugin does not own.
17
+ * @param props - the row's session identity and preset, plus the shared bot store.
18
+ * @returns the avatar element, or null.
19
+ */
20
+ export declare function SessionRowAvatar({ agentPreset, useStore }: SessionRowAvatarProps): ReactNode;
21
+ //# sourceMappingURL=SessionRowAvatar.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Bot-agent API client: same-origin fetch over the host route family. The host
3
+ * owns the trust fence; this half only calls the shared method names.
4
+ *
5
+ * @module @sparkelf/dsh-bot-agent/client/api
6
+ */
7
+ import { type BotDraftWire, type BotWire } from '../api.ts';
8
+ /** One thrown API error carrying the host's message. */
9
+ export declare class BotApiError extends Error {
10
+ }
11
+ /** Bot CRUD client. */
12
+ export declare class BotApi {
13
+ /** Every bot, built-in first. */
14
+ list(): Promise<BotWire[]>;
15
+ /** Create a custom bot. */
16
+ create(draft: BotDraftWire): Promise<BotWire>;
17
+ /** Update a bot's editable fields. */
18
+ update(id: string, draft: BotDraftWire): Promise<BotWire>;
19
+ /** Delete a custom bot; the host refuses the built-in. */
20
+ remove(id: string): Promise<void>;
21
+ private request;
22
+ }
23
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Self-written SVG avatar catalog. Each key maps to a hue and a glyph; the
3
+ * renderer draws a rounded tile with a top highlight and a hairline, following
4
+ * the Plus design reference. No external image dependency, so avatars render
5
+ * offline. Unknown keys derive a stable hue from the key text.
6
+ *
7
+ * @module @sparkelf/dsh-bot-agent/client/avatars
8
+ */
9
+ /** One avatar definition: a catalog key, its hue, and a 24×24 glyph path. */
10
+ export interface AvatarDef {
11
+ key: string;
12
+ hue: number;
13
+ /** SVG path data drawn in a 24×24 viewBox, filled white over the tile. */
14
+ glyph: string;
15
+ }
16
+ /** The curated picker set. `super` is the built-in assistant's avatar. */
17
+ export declare const AVATARS: readonly AvatarDef[];
18
+ /**
19
+ * Resolve an avatar key to its definition.
20
+ * @param key - the stored avatar key.
21
+ * @returns the catalog definition, or a derived tile for an unknown key.
22
+ */
23
+ export declare function avatarDef(key: string): AvatarDef;
24
+ //# sourceMappingURL=avatars.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Bot agent management — browser half.
3
+ *
4
+ * Contributes the official sidebar entry and the keyed main page it opens, plus
5
+ * the session-row avatar seat occupant. One shared bot store feeds both the page
6
+ * and every row, so a created or edited bot reaches the session list without a
7
+ * second fetch. New sessions bind a bot through the existing preset navigation:
8
+ * the bot's preset id is the durable session binding.
9
+ *
10
+ * @module @sparkelf/dsh-bot-agent/client
11
+ */
12
+ import type { Context } from '@deepseek-ai/cordis';
13
+ import type { MainPanelId } from '@deepseek-ai/dsh-client-ui-layout/client';
14
+ import { type BotLocaleKey } from './locales.ts';
15
+ declare module '@deepseek-ai/dsh-client-ui-slots/client' {
16
+ interface LocaleNamespaceMap {
17
+ /** Bot-agent surface copy. */
18
+ 'botAgent': BotLocaleKey;
19
+ }
20
+ }
21
+ declare module '@deepseek-ai/dsh-api-session-controller/client' {
22
+ interface SessionReferenceSourceMap {
23
+ /** One `@bot` dispatch retaining its target session through the prompt. */
24
+ botDispatch: unknown;
25
+ }
26
+ }
27
+ /** Dictionary namespace owned by this plugin. */
28
+ export declare const NS = "botAgent";
29
+ /** The id shared by the sidebar entry and the main panel it opens. */
30
+ export declare const PANEL_ID: MainPanelId;
31
+ /** Services required by the registrations, the new-session hop, and `@bot` dispatch. */
32
+ export declare const inject: string[];
33
+ /**
34
+ * Contribute the Agents entry, the management page, and the session-row avatar.
35
+ * @param ctx - the browser plugin context.
36
+ */
37
+ export declare function apply(ctx: Context): void;
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Locale-owned copy for the bot-agent surfaces, Chinese and English.
3
+ *
4
+ * @module @sparkelf/dsh-bot-agent/client/locales
5
+ */
6
+ /** Chinese dictionary; its keys type the namespace. */
7
+ export declare const zh: {
8
+ readonly panel: "智能体";
9
+ readonly title: "智能体";
10
+ readonly subtitle: "为会话配置身份、职责与回复风格";
11
+ readonly empty: "还没有智能体";
12
+ readonly create: "新建智能体";
13
+ readonly builtin: "内置";
14
+ readonly fieldName: "名字";
15
+ readonly fieldAvatar: "头像";
16
+ readonly fieldIdentity: "身份";
17
+ readonly fieldDuties: "职责";
18
+ readonly fieldWorkStyle: "工作方式";
19
+ readonly fieldReplyStyle: "回复风格";
20
+ readonly fieldRetrievalSummary: "检索摘要";
21
+ readonly presetSection: "预设";
22
+ readonly retrievalSection: "检索";
23
+ readonly identityPlaceholder: "这个智能体是谁";
24
+ readonly dutiesPlaceholder: "它负责什么";
25
+ readonly workStylePlaceholder: "它如何工作";
26
+ readonly replyStylePlaceholder: "它如何回复";
27
+ readonly retrievalSummaryPlaceholder: "用于路由匹配的场景与能力摘要";
28
+ readonly save: "保存";
29
+ readonly saving: "保存中…";
30
+ readonly cancel: "取消";
31
+ readonly delete: "删除";
32
+ readonly deleteConfirm: "删除该智能体?已有会话保留,但不再显示其头像。";
33
+ readonly startSession: "新建会话";
34
+ readonly back: "返回";
35
+ readonly loading: "加载中…";
36
+ readonly error: "加载失败";
37
+ readonly retry: "重试";
38
+ readonly avatarPicker: "选择头像";
39
+ readonly dutiesFallback: "通用助手";
40
+ readonly saved: "已保存";
41
+ readonly deleted: "已删除";
42
+ readonly nameRequired: "名字不能为空";
43
+ readonly readonlyPolicy: "知识库、技能与工具范围将在后续版本生效";
44
+ readonly mentionGroup: "智能体";
45
+ readonly mentionAttachmentsUnsupported: "派单给「{name}」暂不支持附件";
46
+ readonly mentionNoWorkspace: "当前没有可用的工作区,无法派单";
47
+ readonly tabMine: "我的智能体";
48
+ readonly tabMarket: "智能体市场";
49
+ readonly viewSwitcher: "智能体视图";
50
+ readonly marketSubtitle: "发现预设智能体,一键复制为我的智能体";
51
+ readonly searchPlaceholder: "搜索智能体";
52
+ readonly searchClear: "清除搜索";
53
+ readonly filterAll: "全部";
54
+ readonly featured: "精选";
55
+ readonly viewAll: "查看全部";
56
+ readonly add: "添加";
57
+ readonly adding: "添加中…";
58
+ readonly added: "已添加";
59
+ readonly addFailed: "添加失败";
60
+ readonly marketEmpty: "没有匹配的智能体";
61
+ readonly openInMine: "去我的智能体配置";
62
+ readonly close: "关闭";
63
+ readonly categoryCoding: "编程开发";
64
+ readonly categoryDesign: "设计";
65
+ readonly categoryResearch: "研究调研";
66
+ readonly categoryProduct: "产品";
67
+ readonly categoryOperations: "运营";
68
+ readonly categoryWriting: "写作翻译";
69
+ };
70
+ /** English dictionary, keyed identically. */
71
+ export declare const en: Record<keyof typeof zh, string>;
72
+ /** One copy key of the bot-agent namespace. */
73
+ export type BotLocaleKey = keyof typeof zh;
74
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The `@bot` trigger source: an explicit dispatch picker over the shared bot list.
3
+ *
4
+ * Picking a bot (or typing `@name` and submitting) claims the token as a command
5
+ * whose submit routes the message to a session running that bot's preset — the
6
+ * workspace's reusable blank under the preset, or a newly created one. The
7
+ * built-in super assistant is offered like any other bot. Candidate search follows
8
+ * the shared client search rule over the bot's name and label.
9
+ * @module @sparkelf/dsh-bot-agent/client/mention
10
+ */
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ import type { InputTriggerSource, SubmitOutcome } from '@deepseek-ai/dsh-client-ui-input-trigger/client';
13
+ import type { BotWire } from '../api.ts';
14
+ import type { BotLocaleKey } from './locales.ts';
15
+ /** Everything the `@bot` source reads from its owning plugin. */
16
+ export interface BotMentionDeps {
17
+ /** The hot shared bot list (built-in first). */
18
+ readonly bots: () => readonly BotWire[];
19
+ /** Route one message to a session running the bot's preset. */
20
+ readonly dispatch: (bot: BotWire, args: string, actx: Context) => Promise<SubmitOutcome>;
21
+ /** The bot-agent dictionary translator. */
22
+ readonly t: (key: BotLocaleKey, params?: Record<string, unknown>) => string;
23
+ }
24
+ /**
25
+ * Build the `@bot` source. The claim token carries the bot's display name; the
26
+ * input machine strips it to reach the message, so names with spaces dispatch too.
27
+ * @param deps - the bot list, the dispatch verb, and the copy translator.
28
+ * @returns the trigger source to register on `inputTriggers`.
29
+ */
30
+ export declare function createBotMentionSource(deps: BotMentionDeps): InputTriggerSource;
31
+ //# sourceMappingURL=mention.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Shared bot viewing store: the loaded bot list plus the page's selection and
3
+ * active view. The management page and the session-row avatar seat read the same
4
+ * handle, so a created or edited bot reaches every row without a second fetch.
5
+ * The view and selection survive a panel remount, so switching away and back
6
+ * returns the user to the same place.
7
+ *
8
+ * @module @sparkelf/dsh-bot-agent/client/store
9
+ */
10
+ import { type EngineStoreHandle } from '@deepseek-ai/dsh-client-store';
11
+ import type { BotWire } from '../api.ts';
12
+ /** Load lifecycle of the bot list. */
13
+ export type BotStatus = 'idle' | 'loading' | 'ready' | 'error';
14
+ /** Which surface the management page shows: the user's agents or the marketplace. */
15
+ export type BotView = 'mine' | 'market';
16
+ /** Shared bot viewing state. */
17
+ export interface BotState {
18
+ bots: BotWire[];
19
+ status: BotStatus;
20
+ error: string | null;
21
+ selectedId: string | null;
22
+ view: BotView;
23
+ }
24
+ /** The complete mutation API of the bot store. */
25
+ export type BotActions = {
26
+ setBots: (draft: BotState, bots: BotWire[]) => void;
27
+ setLoading: (draft: BotState) => void;
28
+ setError: (draft: BotState, error: string) => void;
29
+ select: (draft: BotState, id: string | null) => void;
30
+ setView: (draft: BotState, view: BotView) => void;
31
+ };
32
+ /**
33
+ * Create the bot viewing store handle.
34
+ * @returns the store handle shared by the page and the avatar seat.
35
+ */
36
+ export declare function createBotStore(): EngineStoreHandle<BotState, BotActions>;
37
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Agent marketplace catalog: a self-written category color table and the
3
+ * built-in template bots a user copies into their own agents.
4
+ *
5
+ * The marketplace is design-referenced from LobeHub (layout, grouping, and the
6
+ * add state machine) but every glyph, hue, and string here is original; no
7
+ * LobeHub application code is copied. Template text is bilingual so the card
8
+ * reads in the active locale and the search index matches every language. The
9
+ * category tile reuses the avatar hue-tile recipe (gradient, top highlight,
10
+ * hairline) through {@link HueTile}.
11
+ *
12
+ * @module @sparkelf/dsh-bot-agent/client/templates
13
+ */
14
+ import type { BotDraftWire } from '../api.ts';
15
+ /** One bilingual template string; resolved to the active locale on display and on add. */
16
+ export type TemplateText = {
17
+ zh: string;
18
+ en: string;
19
+ };
20
+ /** The marketplace categories, each owning a hue and a glyph in the color table. */
21
+ export type TemplateCategory = 'coding' | 'design' | 'research' | 'product' | 'operations' | 'writing';
22
+ /** One category's tile appearance: a hue and a 24×24 white glyph path. */
23
+ export interface CategoryMeta {
24
+ hue: number;
25
+ glyph: string;
26
+ }
27
+ /**
28
+ * Category → hue + glyph color table, the marketplace's own classification
29
+ * palette (coding indigo, design purple, research blue, product orange,
30
+ * operations green, writing amber). Glyphs are self-written SVG paths.
31
+ */
32
+ export declare const CATEGORY_META: Record<TemplateCategory, CategoryMeta>;
33
+ /** One marketplace template: a copyable agent configuration with bilingual prose. */
34
+ export interface BotTemplate {
35
+ /** Stable template id; recorded on the copied bot as its `templateId`. */
36
+ id: string;
37
+ category: TemplateCategory;
38
+ /** Avatar catalog key the template renders and copies. */
39
+ avatar: string;
40
+ /** Whether the template appears in the featured horizontal row. */
41
+ featured: boolean;
42
+ name: TemplateText;
43
+ /** Duty summary shown on the card and matched by search. */
44
+ summary: TemplateText;
45
+ /** Scenario/capability summary copied into the bot for delegation routing. */
46
+ retrievalSummary: TemplateText;
47
+ preset: {
48
+ identity: TemplateText;
49
+ duties: TemplateText;
50
+ workStyle: TemplateText;
51
+ replyStyle: TemplateText;
52
+ };
53
+ }
54
+ /** The built-in template bots, in display order within each category. */
55
+ export declare const BOT_TEMPLATES: readonly BotTemplate[];
56
+ /**
57
+ * Copy a template into a create draft, resolving every bilingual field through
58
+ * the active locale and recording the template id so the marketplace can mark
59
+ * the copy as added.
60
+ * @param template - the template being added.
61
+ * @param resolve - resolves a bilingual string to the active locale.
62
+ * @returns the draft the create route accepts.
63
+ */
64
+ export declare function templateToDraft(template: BotTemplate, resolve: (text: TemplateText) => string): BotDraftWire;
65
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1,22 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import z from '@deepseek-ai/schemastery';
3
+ /** Stable cordis plugin name. */
4
+ export declare const name = "bot-agent";
5
+ /** Services required before the domain, routes, presets, and policy enforcement can mount. */
6
+ export declare const inject: string[];
7
+ /** Plugin configuration. */
8
+ export interface Config {
9
+ /** Preset whose composition each bot copies; the registry's default when omitted. */
10
+ basePreset?: string;
11
+ /** Minimum retrievalSummary coverage (0..1) for routing a delegation to a bot preset. */
12
+ routingMinCoverage?: number;
13
+ }
14
+ /** Runtime schema for the plugin config. */
15
+ export declare const Config: z<Config>;
16
+ /**
17
+ * Mount the bot domain, built-in seed, presets, and CRUD routes.
18
+ * @param ctx - host context carrying storage, the web server, and the preset registry.
19
+ * @param config - resolved plugin config.
20
+ */
21
+ export declare function apply(ctx: Context, config?: Config): void;
22
+ //# sourceMappingURL=index.d.ts.map