dsh-a2a-groups 0.0.0-stage → 0.1.2

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,144 @@
1
+ /**
2
+ * dsh-a2a — browser half public surface (`exports["./client"]`).
3
+ *
4
+ * This file is documentation-grade only: `client.js` is hand-written
5
+ * JavaScript, not compiled TS. It exists so the Host half (`lib/index.js`) can
6
+ * import the contract with full type checking instead of guessing.
7
+ *
8
+ * Loaded by the Web shell through `window.__ModuleLoader__.load({ id, factory })`;
9
+ * nothing here describes Node-side code.
10
+ */
11
+
12
+ /** Three-letter relative time label, e.g. `立即` / `3 分钟前` / `昨天 14:05`. */
13
+ export type GroupTimeLabel = string;
14
+
15
+ /** One roster member as the panel renders it. */
16
+ export interface A2aGroupMemberView {
17
+ readonly id: string;
18
+ readonly name: string;
19
+ /** Free-form role/kind label; empty string when the Host has none. */
20
+ readonly role: string;
21
+ /** True for the session's own member — rendered as `名字(我)`. */
22
+ readonly self: boolean;
23
+ }
24
+
25
+ /** One feed entry (also used for `lastMessage`). */
26
+ export interface A2aGroupFeedEntryView {
27
+ readonly id: string;
28
+ /** Monotonic sequence within the group; 0 when unknown. */
29
+ readonly seq: number;
30
+ readonly text: string;
31
+ readonly senderName: string;
32
+ /** Epoch milliseconds; 0 when unknown. */
33
+ readonly time: number;
34
+ /** Free-form kind (`chat` / `task` / …); empty string when unknown. */
35
+ readonly kind: string;
36
+ }
37
+
38
+ /** One collaboration group, normalized. */
39
+ export interface A2aGroupView {
40
+ readonly id: string;
41
+ readonly name: string;
42
+ readonly memberCount: number;
43
+ readonly unreadCount: number;
44
+ readonly lastMessage?: A2aGroupFeedEntryView;
45
+ /** Epoch ms of the newest feed entry; 0 when the group has no messages. */
46
+ readonly lastTime: number;
47
+ readonly members: readonly A2aGroupMemberView[];
48
+ /** Newest 20 entries, ascending by time. */
49
+ readonly feed: readonly A2aGroupFeedEntryView[];
50
+ readonly muted: boolean;
51
+ }
52
+
53
+ /** Normalized snapshot the components consume. */
54
+ export interface A2aGroupsSnapshot {
55
+ readonly groups: readonly A2aGroupView[];
56
+ /** Epoch ms the Host produced this snapshot; 0 when unknown. */
57
+ readonly updatedAt: number;
58
+ /** Sum of every group's `unreadCount`. */
59
+ readonly unreadTotal: number;
60
+ /** False when no Host data source was reachable at all. */
61
+ readonly ok: boolean;
62
+ }
63
+
64
+ /**
65
+ * What the Host may hand over. Every field is optional and every alias is
66
+ * accepted, because `readSnapshot` must never throw on malformed input.
67
+ */
68
+ export interface A2aGroupRaw {
69
+ readonly id?: string;
70
+ readonly groupId?: string;
71
+ readonly name?: string;
72
+ readonly title?: string;
73
+ readonly memberCount?: number;
74
+ readonly membersCount?: number;
75
+ readonly unreadCount?: number;
76
+ readonly unread?: number;
77
+ readonly muted?: boolean;
78
+ readonly members?: readonly unknown[];
79
+ readonly feed?: readonly unknown[];
80
+ readonly messages?: readonly unknown[];
81
+ readonly lastMessage?: unknown;
82
+ }
83
+
84
+ /** Accepted container shapes for a snapshot. */
85
+ export type A2aGroupsRaw =
86
+ | readonly A2aGroupRaw[]
87
+ | { readonly groups?: readonly A2aGroupRaw[]; readonly items?: readonly A2aGroupRaw[]; readonly updatedAt?: number };
88
+
89
+ /** The preferred Host seam: `exports.setDataSource({ read, subscribe })`. */
90
+ export interface A2aGroupsDataSource {
91
+ /** Must return the current raw snapshot; may be called on any render. */
92
+ read(): A2aGroupsRaw | undefined;
93
+ /** Optional push channel; the returned function unsubscribes. */
94
+ subscribe?(listener: () => void): void | (() => void);
95
+ }
96
+
97
+ /** Slot service surface this plugin depends on (from `@deepseek-ai/dsh-client-ui-slots`). */
98
+ export interface A2aSlotsService {
99
+ inject(name: string, callback: () => () => void): () => void;
100
+ register(options: Record<string, unknown>, component: unknown): () => void;
101
+ }
102
+
103
+ /** Minimal browser context `apply()` accepts. Only `slots` is required. */
104
+ export interface A2aClientContext {
105
+ readonly slots: A2aSlotsService;
106
+ /** Optional: other services are probed defensively, never assumed. */
107
+ readonly [service: string]: unknown;
108
+ }
109
+
110
+ /** A React component type, kept structural so this file needs no React dependency. */
111
+ export type A2aComponent = (props: Record<string, unknown>) => unknown;
112
+
113
+ /** Sidebar row glyph: receives `{ size, active }` from the shell. */
114
+ export declare const GroupsSidebarIcon: A2aComponent;
115
+ /** Central panel page: receives no props, reads the Host source itself. */
116
+ export declare const GroupsPanel: A2aComponent;
117
+ /** One group card, exported for tests and future reuse. */
118
+ export declare const GroupCard: A2aComponent;
119
+ /** `还没有加入任何群` block, exported for tests. */
120
+ export declare const EmptyState: A2aComponent;
121
+
122
+ /** Sidebar `id` and `main` `key`; the two must stay equal or `layout.selectPanel` throws. */
123
+ export declare const PANEL_ID: "a2a-groups";
124
+ /** Host global the panel reads when no data source is installed. */
125
+ export declare const GLOBAL_KEY: "__DSH_A2A_GROUPS__";
126
+ /** DOM event a Host may dispatch on `window` to force a re-read. */
127
+ export declare const CHANGE_EVENT: "dsh-a2a:groups-changed";
128
+
129
+ /** Services this plugin declares in the Cordis `inject` array. */
130
+ export declare const inject: readonly ["slots"];
131
+
132
+ /** Install (or clear) the Host data source. */
133
+ export declare function setDataSource(source: A2aGroupsDataSource | (() => A2aGroupsRaw | undefined) | null): void;
134
+ /** Normalize anything into a render-safe snapshot. */
135
+ export declare function readSnapshot(raw: unknown): A2aGroupsSnapshot;
136
+ /** Normalize whatever the Host currently exposes. */
137
+ export declare function currentSnapshot(): A2aGroupsSnapshot;
138
+ /** Subscribe to Host pushes; always returns a disposer. */
139
+ export declare function subscribeGroups(listener: () => void): () => void;
140
+ /** Render one epoch-ms instant as compact Chinese relative time. */
141
+ export declare function formatTime(time: number | undefined | null): GroupTimeLabel;
142
+
143
+ /** Client plugin body handed to the Cordis loader. */
144
+ export declare function apply(ctx: A2aClientContext): void;
package/package.json CHANGED
@@ -1,6 +1,86 @@
1
1
  {
2
2
  "name": "dsh-a2a-groups",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.2",
4
+ "description": "A2A protocol for DSH: expose a DSH Session as a standard A2A agent, call remote A2A agents, and run invite-only collaboration groups where a group is itself an A2A agent behind a gateway.",
5
+ "keywords": [
6
+ "deepseek-harness",
7
+ "dsh",
8
+ "cordis",
9
+ "plugin",
10
+ "a2a",
11
+ "agent-to-agent",
12
+ "session",
13
+ "collaboration"
14
+ ],
15
+ "license": "MIT",
16
+ "type": "module",
17
+ "main": "lib/index.js",
18
+ "bin": {
19
+ "agent-groups": "bin/agent-groups.js",
20
+ "agent-groups-mcp": "lib/mcp-server.js"
21
+ },
22
+ "exports": {
23
+ ".": {
24
+ "types": "./lib/types/index.d.ts",
25
+ "default": "./lib/index.js"
26
+ },
27
+ "./client": {
28
+ "types": "./lib/types/client.d.ts",
29
+ "default": "./client.js"
30
+ },
31
+ "./mcp": "./lib/mcp-server.js",
32
+ "./host": "./bin/agent-groups.js",
33
+ "./specs": "./lib/shared/tool-specs.js",
34
+ "./runtime": "./lib/shared/tool-runtime.js",
35
+ "./cordis.patch.yml": "./cordis.patch.yml",
36
+ "./package.json": "./package.json",
37
+ "./core/groups": "./lib/core/groups.js",
38
+ "./core/memberships": "./lib/core/memberships.js",
39
+ "./core/wire": "./lib/core/wire.js"
40
+ },
41
+ "files": [
42
+ "bin",
43
+ "lib",
44
+ "client.js",
45
+ "cordis.patch.yml",
46
+ "README.md",
47
+ "README-ui.md",
48
+ "docs"
49
+ ],
50
+ "engines": {
51
+ "node": ">=22"
52
+ },
53
+ "scripts": {
54
+ "test": "node --test test/*.test.mjs",
55
+ "strip:invisible": "node scripts/strip-invisible.mjs client.js"
56
+ },
57
+ "dsh": {
58
+ "bundle": {
59
+ "patch": "./cordis.patch.yml"
60
+ },
61
+ "client": {
62
+ "platform": "web",
63
+ "inject": [
64
+ "slots",
65
+ "@deepseek-ai/dsh-client-connection/client"
66
+ ]
67
+ }
68
+ },
69
+ "devDependencies": {
70
+ "@types/node": "^26.6.6",
71
+ "typescript": "^7.0.2"
72
+ },
73
+ "publishConfig": {
74
+ "access": "public"
75
+ },
76
+ "repository": {
77
+ "type": "git",
78
+ "url": "git+https://github.com/evlon/dsh-a2a-groups.git",
79
+ "directory": "dsh-a2a"
80
+ },
81
+ "bugs": {
82
+ "url": "https://github.com/evlon/dsh-a2a-groups/issues"
83
+ },
84
+ "homepage": "https://github.com/evlon/dsh-a2a-groups#readme",
85
+ "author": "evlon"
86
+ }