@prettier-ai/dsh-client-ui-subagent 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 +116 -0
- package/README.zh.md +116 -0
- package/lib/client.js +866 -0
- package/lib/index.js +11 -0
- package/lib/invariant.js +24 -0
- package/lib/types/client/SubagentHeaderLineage.d.ts +19 -0
- package/lib/types/client/SubagentReadOnlyComposer.d.ts +17 -0
- package/lib/types/client/index.d.ts +19 -0
- package/lib/types/client/locales.d.ts +48 -0
- package/lib/types/client/subagent-lineage.d.ts +21 -0
- package/lib/types/index.d.ts +9 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +90 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region lib/types/index.js
|
|
2
|
+
/**
|
|
3
|
+
* Subagent reference plugin, node half. Pure UI plugin: the empty apply
|
|
4
|
+
* exists so the plugin appears in the host cordis.yml / Loader; the browser
|
|
5
|
+
* half ships via exports["./client"], discovered through the package.json
|
|
6
|
+
* dsh.client declaration.
|
|
7
|
+
*/
|
|
8
|
+
/** Host plugin body — no host-side behavior for this source plugin. */
|
|
9
|
+
function apply() {}
|
|
10
|
+
//#endregion
|
|
11
|
+
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-subagent`.
|
|
4
|
+
* @module @prettier-ai/dsh-client-ui-subagent/invariant
|
|
5
|
+
*/
|
|
6
|
+
const PACKAGE_NAME = "@prettier-ai/dsh-client-ui-subagent";
|
|
7
|
+
/** Cordis companion plugin name. */
|
|
8
|
+
const name = "client-ui-subagent-invariant";
|
|
9
|
+
/** Service required before the companion can reserve package ownership. */
|
|
10
|
+
const inject = ["invariants"];
|
|
11
|
+
/**
|
|
12
|
+
* No runtime invariant: a single slash-source registration whose disposal is
|
|
13
|
+
* proven by the HMR-safety spec — it emits no cordis events and owns no
|
|
14
|
+
* cross-plugin mutable state.
|
|
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,19 @@
|
|
|
1
|
+
import type { SubagentAddress } from '@prettier-ai/dsh-subagent/client';
|
|
2
|
+
import type { SessionId } from '@prettier-ai/dsh-session/types';
|
|
3
|
+
import type { PropsLocale, PropsRuntime } from '@prettier-ai/dsh-client-ui-slots';
|
|
4
|
+
import { NS } from './locales.ts';
|
|
5
|
+
/** Business actions supplied by the slot registration. */
|
|
6
|
+
export interface SubagentCatalogInjected {
|
|
7
|
+
openChild: (address: SubagentAddress) => void;
|
|
8
|
+
refresh: (parentSessionId: SessionId) => void;
|
|
9
|
+
setCatalogOpen: (parentSessionId: SessionId, open: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
/** Full props for the session-header lineage renderer. */
|
|
12
|
+
export type SubagentHeaderLineageProps = PropsRuntime<'conversation.session.header.lineage'> & SubagentCatalogInjected & PropsLocale<typeof NS>;
|
|
13
|
+
/**
|
|
14
|
+
* Render one breadcrumb title together with its subagent navigation.
|
|
15
|
+
* @param props - Breadcrumb title, session standard props, and catalog actions.
|
|
16
|
+
* @returns An ordinary-title descendant count, or a title-and-chevron sibling switcher.
|
|
17
|
+
*/
|
|
18
|
+
export declare function SubagentHeaderLineage({ lineageSessionId, displayTitle, openTitle, useSessions, openChild, refresh, setCatalogOpen, t, }: SubagentHeaderLineageProps): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=SubagentHeaderLineage.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PropsLocale, PropsRuntime } from '@prettier-ai/dsh-client-ui-slots';
|
|
2
|
+
import { NS } from './locales.ts';
|
|
3
|
+
/** Why a catalog-addressed conversation cannot accept human input. */
|
|
4
|
+
export interface SubagentReadOnlyMatch {
|
|
5
|
+
reason: 'one-shot' | 'parent-unavailable';
|
|
6
|
+
}
|
|
7
|
+
/** Full chain props after the read-only subagent selector accepts the owner currency. */
|
|
8
|
+
export type SubagentReadOnlyComposerProps = PropsRuntime<'conversation.composer'> & {
|
|
9
|
+
matched: SubagentReadOnlyMatch;
|
|
10
|
+
} & PropsLocale<typeof NS>;
|
|
11
|
+
/**
|
|
12
|
+
* Explain why the normal composer is unavailable for an addressed child.
|
|
13
|
+
* @param props - selector-owned read-only reason plus standard slot props.
|
|
14
|
+
* @returns A read-only composer replacement.
|
|
15
|
+
*/
|
|
16
|
+
export declare function SubagentReadOnlyComposer({ matched, t, }: Pick<SubagentReadOnlyComposerProps, 'matched' | 't'>): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=SubagentReadOnlyComposer.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Web subagent catalog, navigation, and addressed-session composer owner. */
|
|
2
|
+
import type { Context as ClientContext } from '@prettier-ai/cordis';
|
|
3
|
+
import { type SubagentKey } from './locales.ts';
|
|
4
|
+
declare module '@prettier-ai/dsh-client-ui-slots' {
|
|
5
|
+
interface LocaleNamespaceMap {
|
|
6
|
+
/** Subagent catalog and read-only composer copy. */
|
|
7
|
+
'subagent': SubagentKey;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export type { SubagentCatalogInjected, SubagentHeaderLineageProps, } from './SubagentHeaderLineage.tsx';
|
|
11
|
+
export type { SubagentReadOnlyComposerProps, SubagentReadOnlyMatch, } from './SubagentReadOnlyComposer.tsx';
|
|
12
|
+
/** Required services for conversation slots and session navigation. */
|
|
13
|
+
export declare const inject: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Client plugin body: register the subagent catalog and read-only composer seats.
|
|
16
|
+
* @param ctx - client root context.
|
|
17
|
+
*/
|
|
18
|
+
export declare function apply(ctx: ClientContext): void;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** `subagent` namespace dictionaries. */
|
|
2
|
+
/** Dictionary namespace owned by this plugin. */
|
|
3
|
+
export declare const NS = "subagent";
|
|
4
|
+
/** Simplified Chinese dictionary (the key-set source of truth). */
|
|
5
|
+
export declare const zh: {
|
|
6
|
+
readonly 'diagnostic.corrupt': "会话记录损坏";
|
|
7
|
+
readonly 'diagnostic.unsupported': "子代理记录版本不受支持";
|
|
8
|
+
readonly 'diagnostic.unavailable': "会话记录暂不可用";
|
|
9
|
+
readonly 'duration.seconds': "{seconds}秒";
|
|
10
|
+
readonly 'duration.minutes': "{minutes}分{seconds}秒";
|
|
11
|
+
readonly 'duration.hours': "{hours}小时{minutes}分{seconds}秒";
|
|
12
|
+
readonly 'duration.days': "{days}天";
|
|
13
|
+
readonly 'duration.daysHours': "{days}天{hours}小时";
|
|
14
|
+
readonly 'duration.months': "约{months}个月";
|
|
15
|
+
readonly 'duration.monthsDays': "约{months}个月{days}天";
|
|
16
|
+
readonly 'duration.years': "约{years}年";
|
|
17
|
+
readonly 'duration.yearsMonths': "约{years}年{months}个月";
|
|
18
|
+
readonly 'duration.exactDays': "{days}天{hours}小时{minutes}分{seconds}秒";
|
|
19
|
+
readonly 'duration.exactTitle': "总活跃耗时:{duration}";
|
|
20
|
+
readonly 'tokens.thousand': "{value}K";
|
|
21
|
+
readonly 'tokens.million': "{value}M";
|
|
22
|
+
readonly 'tokens.total': "{value} tok";
|
|
23
|
+
readonly 'loading.label': "正在加载子代理…";
|
|
24
|
+
readonly 'loading.aria': "正在加载子代理";
|
|
25
|
+
readonly 'load.error': "无法加载子代理";
|
|
26
|
+
readonly retry: "重试";
|
|
27
|
+
readonly 'mode.oneShot': "一次性";
|
|
28
|
+
readonly 'mode.continuable': "可继续";
|
|
29
|
+
readonly 'activity.running': "正在运行";
|
|
30
|
+
readonly 'activity.inactive': "当前未运行";
|
|
31
|
+
readonly 'branch.collapse': "收起 {label} 的下级子代理";
|
|
32
|
+
readonly 'branch.expand': "展开 {label} 的下级子代理";
|
|
33
|
+
readonly 'count.total.one': "{count} 个子代理";
|
|
34
|
+
readonly 'count.total.other': "{count} 个子代理";
|
|
35
|
+
readonly 'count.running.one': "{count} 个子代理,正在运行";
|
|
36
|
+
readonly 'count.running.other': "{count} 个子代理,正在运行";
|
|
37
|
+
readonly 'switcher.aria': "切换子代理:{title}";
|
|
38
|
+
readonly 'tree.aria': "子代理会话";
|
|
39
|
+
readonly 'readonly.oneShot.title': "一次性子代理记录";
|
|
40
|
+
readonly 'readonly.title': "此子代理暂时只读";
|
|
41
|
+
readonly 'readonly.oneShot.body': "一次性任务不支持后续消息,可在这里查看完整执行记录。";
|
|
42
|
+
readonly 'readonly.body': "父会话当前不在线,重新打开父会话后即可继续发送消息。";
|
|
43
|
+
};
|
|
44
|
+
/** English dictionary, key-identical to the Chinese source of truth. */
|
|
45
|
+
export declare const en: Record<SubagentKey, string>;
|
|
46
|
+
/** Key domain of the `subagent` namespace (zh is the source of truth). */
|
|
47
|
+
export type SubagentKey = keyof typeof zh;
|
|
48
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** UI Subagent-owned projection of descendant counts from Session summaries. */
|
|
2
|
+
import type { SessionId } from '@prettier-ai/dsh-session/types';
|
|
3
|
+
interface LineageEntry {
|
|
4
|
+
readonly id: SessionId;
|
|
5
|
+
readonly parentId?: SessionId;
|
|
6
|
+
readonly origin?: 'subagent';
|
|
7
|
+
readonly running: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Descendant counts for one possible parent Session. */
|
|
10
|
+
export interface SubagentDescendantSummary {
|
|
11
|
+
readonly count: number;
|
|
12
|
+
readonly runningCount: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Index uninterrupted subagent descendants under each ancestor.
|
|
16
|
+
* @param summaries - Session summaries keyed by id.
|
|
17
|
+
* @returns descendant totals keyed by possible parent id.
|
|
18
|
+
*/
|
|
19
|
+
export declare function indexSubagentDescendants(summaries: Readonly<Record<SessionId, LineageEntry>>): ReadonlyMap<SessionId, SubagentDescendantSummary>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=subagent-lineage.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subagent reference plugin, node half. Pure UI plugin: the empty apply
|
|
3
|
+
* exists so the plugin appears in the host cordis.yml / Loader; the browser
|
|
4
|
+
* half ships via exports["./client"], discovered through the package.json
|
|
5
|
+
* dsh.client declaration.
|
|
6
|
+
*/
|
|
7
|
+
/** Host plugin body — no host-side behavior for this source plugin. */
|
|
8
|
+
export declare function apply(): void;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@prettier-ai/dsh-client-ui-subagent`.
|
|
3
|
+
* @module @prettier-ai/dsh-client-ui-subagent/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@prettier-ai/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "client-ui-subagent-invariant";
|
|
8
|
+
/** Service required before the companion can reserve package ownership. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register this package's invariant companion.
|
|
12
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
+
//# sourceMappingURL=invariant.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prettier-ai/dsh-client-ui-subagent",
|
|
3
|
+
"description": "Subagent conversation catalog, continuation routing UI, and '@' reference source",
|
|
4
|
+
"version": "0.1.2-alpha.1",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/client/ui-subagent"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./client": {
|
|
26
|
+
"types": "./lib/types/client/index.d.ts",
|
|
27
|
+
"default": "./lib/client.js"
|
|
28
|
+
},
|
|
29
|
+
"./src/*": "./src/*",
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
"dsh": {
|
|
33
|
+
"client": {
|
|
34
|
+
"inject": [
|
|
35
|
+
"@prettier-ai/dsh-api-session-controller",
|
|
36
|
+
"@prettier-ai/dsh-client-locale",
|
|
37
|
+
"@prettier-ai/dsh-client-ui-conversation",
|
|
38
|
+
"@prettier-ai/dsh-client-ui-primitives",
|
|
39
|
+
"@prettier-ai/dsh-client-ui-input-trigger"
|
|
40
|
+
],
|
|
41
|
+
"platform": "web"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
|
|
47
|
+
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.1",
|
|
48
|
+
"@prettier-ai/dsh-client-ui-input-trigger": "^0.1.2-alpha.1",
|
|
49
|
+
"@prettier-ai/dsh-subagent": "^0.1.2-alpha.1",
|
|
50
|
+
"@prettier-ai/dsh-token-meter": "^0.1.2-alpha.1",
|
|
51
|
+
"@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
|
|
52
|
+
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
|
|
53
|
+
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.1",
|
|
54
|
+
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1",
|
|
55
|
+
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.1",
|
|
56
|
+
"@prettier-ai/dsh-session": "^0.1.2-alpha.1",
|
|
57
|
+
"@prettier-ai/cordis": "^4.0.1"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/react": "~18.3.1",
|
|
61
|
+
"@types/react-dom": "~18.3.0",
|
|
62
|
+
"react": "^18.2.0",
|
|
63
|
+
"react-dom": "^18.2.0",
|
|
64
|
+
"@prettier-ai/dsh-client-locale": "^0.1.2-alpha.1",
|
|
65
|
+
"@prettier-ai/dsh-client-test-runtime": "^0.1.2-alpha.1",
|
|
66
|
+
"@prettier-ai/dsh-client-ui-input-trigger": "^0.1.2-alpha.1",
|
|
67
|
+
"@prettier-ai/dsh-client-ui-slots": "^0.1.2-alpha.1",
|
|
68
|
+
"@prettier-ai/dsh-client-ui-primitives": "^0.1.2-alpha.1",
|
|
69
|
+
"@prettier-ai/dsh-client-ui-conversation": "^0.1.2-alpha.1",
|
|
70
|
+
"@prettier-ai/dsh-invariants": "^0.1.2-alpha.1",
|
|
71
|
+
"@prettier-ai/dsh-subagent": "^0.1.2-alpha.1",
|
|
72
|
+
"@prettier-ai/dsh-token-meter": "^0.1.2-alpha.1",
|
|
73
|
+
"@prettier-ai/cordis": "^4.0.1",
|
|
74
|
+
"@prettier-ai/dsh-api-session-controller": "^0.1.2-alpha.1",
|
|
75
|
+
"@prettier-ai/dsh-client-connection": "^0.1.2-alpha.1",
|
|
76
|
+
"@prettier-ai/dsh-session": "^0.1.2-alpha.1",
|
|
77
|
+
"@prettier-ai/dsh-client-ui-renderer": "^0.1.2-alpha.1",
|
|
78
|
+
"@prettier-ai/dsh-client-ui-session": "^0.1.2-alpha.1"
|
|
79
|
+
},
|
|
80
|
+
"files": [
|
|
81
|
+
"lib/index.js",
|
|
82
|
+
"lib/invariant.js",
|
|
83
|
+
"lib/client.js",
|
|
84
|
+
"lib/types/**/*.d.ts"
|
|
85
|
+
],
|
|
86
|
+
"scripts": {
|
|
87
|
+
"bundle": "tsdown",
|
|
88
|
+
"watch": "tsdown --watch"
|
|
89
|
+
}
|
|
90
|
+
}
|