@linxin666/dsh-client-ui-task-board-team 0.0.0-stage → 0.4.13
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 +202 -0
- package/README.i18n.yaml +6 -0
- package/README.md +66 -2
- package/README.zh.md +67 -0
- package/cordis.patch.yml +14 -0
- package/icon.svg +3 -0
- package/lib/client.js +1117 -0
- package/lib/index.js +2968 -0
- package/lib/types/client/index.d.ts +58 -0
- package/lib/types/client/locales.d.ts +83 -0
- package/lib/types/client/optional-service.d.ts +22 -0
- package/lib/types/client/team/extension.d.ts +29 -0
- package/lib/types/client/team/sections.d.ts +38 -0
- package/lib/types/client/team/settings.d.ts +41 -0
- package/lib/types/client/team/summary.d.ts +34 -0
- package/lib/types/core/contract.d.ts +269 -0
- package/lib/types/core/hub-protocol.d.ts +175 -0
- package/lib/types/core/identity.d.ts +96 -0
- package/lib/types/core/mirror.d.ts +51 -0
- package/lib/types/core/question-report.d.ts +84 -0
- package/lib/types/core/settlement.d.ts +49 -0
- package/lib/types/core/task-record.d.ts +59 -0
- package/lib/types/core/timers.d.ts +20 -0
- package/lib/types/host/bindings.d.ts +92 -0
- package/lib/types/host/channel.d.ts +44 -0
- package/lib/types/host/credentials.d.ts +63 -0
- package/lib/types/host/extension.d.ts +57 -0
- package/lib/types/host/hub-client.d.ts +157 -0
- package/lib/types/host/questions.d.ts +105 -0
- package/lib/types/host/service.d.ts +209 -0
- package/lib/types/host/setup.d.ts +152 -0
- package/lib/types/host/tools.d.ts +19 -0
- package/lib/types/host/waterfall.d.ts +39 -0
- package/lib/types/index.d.ts +152 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +83 -3
- package/src/client/css-modules.d.ts +5 -0
- package/src/client/index.ts +139 -0
- package/src/client/locales.ts +154 -0
- package/src/client/optional-service.ts +30 -0
- package/src/client/team/extension.ts +185 -0
- package/src/client/team/sections.tsx +159 -0
- package/src/client/team/settings.tsx +242 -0
- package/src/client/team/summary.ts +156 -0
- package/src/client/team/team.module.css +122 -0
- package/src/core/contract.ts +326 -0
- package/src/core/hub-protocol.ts +217 -0
- package/src/core/identity.ts +193 -0
- package/src/core/mirror.ts +88 -0
- package/src/core/question-report.ts +144 -0
- package/src/core/settlement.ts +84 -0
- package/src/core/task-record.ts +65 -0
- package/src/core/timers.ts +34 -0
- package/src/host/bindings.ts +211 -0
- package/src/host/channel.ts +97 -0
- package/src/host/credentials.ts +147 -0
- package/src/host/extension.ts +197 -0
- package/src/host/hub-client.ts +287 -0
- package/src/host/questions.ts +275 -0
- package/src/host/service.ts +1421 -0
- package/src/host/setup.ts +259 -0
- package/src/host/tools.ts +70 -0
- package/src/host/waterfall.ts +51 -0
- package/src/index.ts +452 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The configuration surface this extension's settings section drives.
|
|
3
|
+
*
|
|
4
|
+
* One module owns every write, so the settings section, a profile patch and an
|
|
5
|
+
* agent all produce the same stored value: the hub URL, the team id and the
|
|
6
|
+
* member bindings are volatile fields of this plugin's own settings entry, and
|
|
7
|
+
* the Host Token goes to the credential store instead (`credentials.ts`). The
|
|
8
|
+
* read half reports status only — never a token, never a value a browser could
|
|
9
|
+
* replay.
|
|
10
|
+
*
|
|
11
|
+
* @module dsh-task-board-team/host/setup
|
|
12
|
+
*/
|
|
13
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
14
|
+
import type { TeamAgentBinding } from './bindings.ts';
|
|
15
|
+
import type { TeamExtensionSummary } from './service.ts';
|
|
16
|
+
/** Settings entry ids this package's rows carry, most specific first. */
|
|
17
|
+
export declare const TEAM_ENTRY_IDS: readonly string[];
|
|
18
|
+
/** One entry the settings surface reports. */
|
|
19
|
+
interface SettingsDescriptor {
|
|
20
|
+
ns?: unknown;
|
|
21
|
+
value?: unknown;
|
|
22
|
+
revision?: unknown;
|
|
23
|
+
}
|
|
24
|
+
/** One path-addressed edit the settings surface accepts. */
|
|
25
|
+
type SettingsPathOp = {
|
|
26
|
+
op: 'set';
|
|
27
|
+
path: readonly string[];
|
|
28
|
+
value: unknown;
|
|
29
|
+
} | {
|
|
30
|
+
op: 'unset';
|
|
31
|
+
path: readonly string[];
|
|
32
|
+
};
|
|
33
|
+
/** The slice of the Host settings surface this extension uses. */
|
|
34
|
+
export interface SettingsFace {
|
|
35
|
+
readonly writable: boolean;
|
|
36
|
+
describe(options?: {
|
|
37
|
+
redactSecrets?: boolean;
|
|
38
|
+
}): SettingsDescriptor[];
|
|
39
|
+
mutate(ns: string, ops: readonly SettingsPathOp[], expectedRevision?: number): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve the optional settings service.
|
|
43
|
+
* @param ctx - host context.
|
|
44
|
+
* @returns the surface, or undefined when this deployment serves none.
|
|
45
|
+
*/
|
|
46
|
+
export declare function resolveSettingsFace(ctx: Context): SettingsFace | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Find this extension's own entry in the settings surface.
|
|
49
|
+
* @param face - the settings surface.
|
|
50
|
+
* @returns the entry id and its current revision, or undefined.
|
|
51
|
+
*/
|
|
52
|
+
export declare function findTeamSettingsEntry(face: SettingsFace): {
|
|
53
|
+
ns: string;
|
|
54
|
+
revision: number;
|
|
55
|
+
} | undefined;
|
|
56
|
+
/** What the settings section renders. */
|
|
57
|
+
export interface TeamSetupStatus {
|
|
58
|
+
/** Configured hub base URL. */
|
|
59
|
+
hubUrl: string;
|
|
60
|
+
/** Configured team id. */
|
|
61
|
+
teamId: string;
|
|
62
|
+
/** Whether a Host Token is configured; never the value. */
|
|
63
|
+
token: {
|
|
64
|
+
configured: boolean;
|
|
65
|
+
writable: boolean;
|
|
66
|
+
ref: string;
|
|
67
|
+
source?: string;
|
|
68
|
+
};
|
|
69
|
+
/** Configured member bindings. */
|
|
70
|
+
agents: readonly TeamAgentBinding[];
|
|
71
|
+
/** Hostname this Host registers under. */
|
|
72
|
+
hostname: string;
|
|
73
|
+
/** Optional local fallback wait for a claimed question, in minutes; 0 means none. */
|
|
74
|
+
questionWaitMinutes: number;
|
|
75
|
+
/** The live connection and capability summary, when the provider is mounted. */
|
|
76
|
+
provider?: TeamExtensionSummary;
|
|
77
|
+
/** Whether this deployment exposes a settings form for this extension. */
|
|
78
|
+
writable: boolean;
|
|
79
|
+
}
|
|
80
|
+
/** The settings a caller may write. */
|
|
81
|
+
export interface TeamSetupPatch {
|
|
82
|
+
hubUrl?: string;
|
|
83
|
+
teamId?: string;
|
|
84
|
+
agents?: readonly TeamAgentBinding[];
|
|
85
|
+
hostname?: string;
|
|
86
|
+
questionWaitMinutes?: number;
|
|
87
|
+
}
|
|
88
|
+
export interface TeamSetupOptions {
|
|
89
|
+
ctx: Context;
|
|
90
|
+
/** Current configured values, read live from the plugin config. */
|
|
91
|
+
current: () => {
|
|
92
|
+
hubUrl: string;
|
|
93
|
+
teamId: string;
|
|
94
|
+
agents: readonly TeamAgentBinding[];
|
|
95
|
+
hostname: string;
|
|
96
|
+
tokenRef: string;
|
|
97
|
+
questionWaitMinutes?: number;
|
|
98
|
+
};
|
|
99
|
+
/** The live provider summary, when the extension is mounted. */
|
|
100
|
+
provider: () => TeamExtensionSummary | undefined;
|
|
101
|
+
/** Called after a successful write so the mount can follow it immediately. */
|
|
102
|
+
reload?: () => void;
|
|
103
|
+
}
|
|
104
|
+
/** The configuration surface one mount owns. */
|
|
105
|
+
export declare class TeamSetup {
|
|
106
|
+
#private;
|
|
107
|
+
/** Called after any write so the live mount can republish its summary. */
|
|
108
|
+
onWrite: (() => void) | undefined;
|
|
109
|
+
constructor(options: TeamSetupOptions);
|
|
110
|
+
/** Whether a Host Token is currently configured, as of the last refresh. */
|
|
111
|
+
tokenConfigured(): boolean;
|
|
112
|
+
/** Re-read the credential facts without exposing the value. */
|
|
113
|
+
refreshToken(): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Store one pasted Host Token.
|
|
116
|
+
*
|
|
117
|
+
* This is the only path a token value travels: the browser sends it once, the
|
|
118
|
+
* host half stores it in the credential seam, and nothing ever reads it back
|
|
119
|
+
* out to a client.
|
|
120
|
+
* @param value - the token the operator pasted.
|
|
121
|
+
*/
|
|
122
|
+
saveToken(value: string): Promise<void>;
|
|
123
|
+
/** Remove the stored Host Token. */
|
|
124
|
+
clearToken(): Promise<void>;
|
|
125
|
+
/** Read the current configuration status. */
|
|
126
|
+
status(): Promise<TeamSetupStatus>;
|
|
127
|
+
/**
|
|
128
|
+
* Store the hub URL, the team id, the member bindings or the hostname.
|
|
129
|
+
*
|
|
130
|
+
* Every field is written in one batch against the revision just read, so a
|
|
131
|
+
* hub URL and the team it belongs to cannot be stored split by a concurrent
|
|
132
|
+
* edit, and the Loader commits the result into the running mount without a
|
|
133
|
+
* restart.
|
|
134
|
+
* @param patch - the fields to replace.
|
|
135
|
+
* @returns the status after the write.
|
|
136
|
+
*/
|
|
137
|
+
save(patch: TeamSetupPatch): Promise<TeamSetupStatus>;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Normalize one hub URL to an absolute http(s) base without a trailing slash.
|
|
141
|
+
* @param raw - the value the operator typed.
|
|
142
|
+
* @returns the normalized URL.
|
|
143
|
+
* @throws when the value is not a usable absolute URL.
|
|
144
|
+
*/
|
|
145
|
+
export declare function normalizeHubUrl(raw: string): string;
|
|
146
|
+
/**
|
|
147
|
+
* Keep only bindings that name a member, dropping duplicates.
|
|
148
|
+
* @param raw - the bindings one caller proposed.
|
|
149
|
+
* @returns the normalized list.
|
|
150
|
+
*/
|
|
151
|
+
export declare function normalizeBindings(raw: readonly TeamAgentBinding[]): TeamAgentBinding[];
|
|
152
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one model-visible tool this extension contributes: `team_comment`.
|
|
3
|
+
*
|
|
4
|
+
* Comments are the agent's half of the collaboration surface — the reviewer
|
|
5
|
+
* reads them on the issue, and a mention in one is delivered into the session.
|
|
6
|
+
* The tool registers through the board's capability face, so it lives exactly as
|
|
7
|
+
* long as the board runs this extension, and it accepts no shell text, path or
|
|
8
|
+
* permission: a comment is prose and nothing else.
|
|
9
|
+
*
|
|
10
|
+
* @module dsh-task-board-team/host/tools
|
|
11
|
+
*/
|
|
12
|
+
import { type ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
13
|
+
import type { TeamSyncService } from './service.ts';
|
|
14
|
+
/**
|
|
15
|
+
* Build the comment tool.
|
|
16
|
+
* @param service - the running sync service.
|
|
17
|
+
* @returns the tool definition the board registers.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildTeamTools(service: TeamSyncService): ToolDefinition[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single claim this provider makes on the Host's process-wide answerer
|
|
3
|
+
* waterfalls.
|
|
4
|
+
*
|
|
5
|
+
* Exactly one event is subscribed: `user-questions/request`, the decision
|
|
6
|
+
* question a session asks through `ask_user_question`. `approval/request` — the
|
|
7
|
+
* tool permission question — is deliberately absent, because it belongs to the
|
|
8
|
+
* local machine's own security domain (`team-hub/PROTOCOL.md` section 6): a
|
|
9
|
+
* remote reviewer must never be able to authorize a tool on this host. Keeping
|
|
10
|
+
* the subscription list in one function is what makes that absence reviewable
|
|
11
|
+
* and testable instead of an implicit property of a large entry file.
|
|
12
|
+
*
|
|
13
|
+
* @module dsh-task-board-team/host/waterfall
|
|
14
|
+
*/
|
|
15
|
+
import type { QuestionAnswer, QuestionRequestShape } from '../core/question-report.ts';
|
|
16
|
+
import type { QuestionRouter } from './questions.ts';
|
|
17
|
+
/** The event names this provider may subscribe to. */
|
|
18
|
+
export declare const CLAIMED_EVENTS: readonly ["user-questions/request"];
|
|
19
|
+
/** The event this provider must never subscribe to. */
|
|
20
|
+
export declare const NEVER_CLAIMED_EVENTS: readonly ["approval/request"];
|
|
21
|
+
/** The cordis slice the installer needs. */
|
|
22
|
+
export interface WaterfallSeat {
|
|
23
|
+
/** Subscribe one waterfall listener; the returned disposer unsubscribes. */
|
|
24
|
+
on(event: 'user-questions/request', listener: (request: QuestionRequestShape, next: () => Promise<QuestionAnswer>) => Promise<QuestionAnswer>, options?: {
|
|
25
|
+
prepend?: boolean;
|
|
26
|
+
}): () => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Install the provider's one waterfall claim.
|
|
30
|
+
*
|
|
31
|
+
* The listener is prepended so the team routing is consulted before the desktop
|
|
32
|
+
* answerer for a team card's session; every request that is not such a session's
|
|
33
|
+
* is delegated straight back down the chain, so the local surface keeps working
|
|
34
|
+
* exactly as it did before this provider existed.
|
|
35
|
+
* @param seat - the host context's event seat.
|
|
36
|
+
* @param router - resolves the question router of the live mount, if any.
|
|
37
|
+
* @returns disposer removing the subscription.
|
|
38
|
+
*/
|
|
39
|
+
export declare function installTeamWaterfall(seat: WaterfallSeat, router: () => QuestionRouter | undefined): () => void;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host half of the task-board team provider extension.
|
|
3
|
+
*
|
|
4
|
+
* This package is an EXTERNAL PROVIDER EXTENSION for the task board
|
|
5
|
+
* (@linxin666/dsh-client-ui-task-board). It owns the team-hub configuration,
|
|
6
|
+
* the Host Token custody, the claim and lease lifecycle, the question routing
|
|
7
|
+
* and the comment tool; it reaches the board through the board's provider
|
|
8
|
+
* service and imports no board module.
|
|
9
|
+
*
|
|
10
|
+
* Two boundaries are load-bearing here: the Host Token is a credential (read
|
|
11
|
+
* host-side only, never part of a snapshot, a published summary or an agent
|
|
12
|
+
* payload, and the browser sends a pasted value exactly once), and only
|
|
13
|
+
* user-questions/request is ever claimed. Tool permission approvals
|
|
14
|
+
* (approval/request) belong to this machine's own security domain, so this file
|
|
15
|
+
* registers no listener for them at all (team-hub/PROTOCOL.md section 6).
|
|
16
|
+
*
|
|
17
|
+
* @module dsh-task-board-team
|
|
18
|
+
*/
|
|
19
|
+
import type { Context, Volatile } from '@deepseek-ai/cordis';
|
|
20
|
+
import z from '@deepseek-ai/schemastery';
|
|
21
|
+
import { type TeamAgentBinding } from './host/bindings.ts';
|
|
22
|
+
/** npm identity shared by every install source of this package. */
|
|
23
|
+
export declare const PACKAGE_NAME = "@linxin666/dsh-client-ui-task-board-team";
|
|
24
|
+
/** The tool this extension registers, named in its announcement. */
|
|
25
|
+
export declare const TEAM_TOOL_NAME = "team_comment";
|
|
26
|
+
/** Model-facing announcement: what the extension does and the words that name it. */
|
|
27
|
+
export declare const TEAM_GUIDANCE = "\u672C\u673A\u5DF2\u5B89\u88C5 dsh-task-board-team \u6269\u5C55\uFF08DSH Web GUI \u4EFB\u52A1\u770B\u677F\u7684\u56E2\u961F\u534F\u4F5C\u63D0\u4F9B\u65B9\uFF09\uFF1A\u628A\u4E91\u7AEF team-hub \u4E0A\u6307\u6D3E\u7ED9\u672C\u673A dsh-agents \u6210\u5458\u7684 issue \u9886\u53D6\u4E3A\u770B\u677F\u955C\u50CF\u5361\u5E76\u5728\u672C\u673A\u6267\u884C\uFF0C\u6267\u884C\u7ED3\u7B97\u5199\u56DE hub\uFF0C\u6267\u884C\u4F1A\u8BDD\u91CC\u7684 ask_user_question \u4F1A\u8F6C\u7ED9\u56E2\u961F\u5BA1\u9605\u4EBA\u56DE\u7B54\uFF1B\u53E6\u6CE8\u518C team_comment \u5DE5\u5177\u4F9B\u6A21\u578B\u53D1\u8868\u8BC4\u8BBA\uFF0C\u8BC4\u8BBA\u91CC @ \u5230\u672C\u673A Agent \u65F6\u4F1A\u4F5C\u4E3A\u540E\u7EED\u6D88\u606F\u6295\u9012\u8FDB\u4F1A\u8BDD\u3002\u5DE5\u5177\u6743\u9650\u5BA1\u6279\u4E00\u5F8B\u53EA\u5728\u672C\u673A\u5904\u7406\uFF0C\u7EDD\u4E0D\u8FDB\u5165 hub\u3002\u7528\u6237\u63D0\u5230\u300C\u56E2\u961F\u4EFB\u52A1 / team-hub / \u9886\u53D6\u56E2\u961F issue / \u7ED9\u56E2\u961F\u7559\u8A00\u300D\u65F6\u5373\u6307\u672C\u6269\u5C55\uFF0C\u8BF7\u636E\u6B64\u534F\u4F5C\u3002";
|
|
28
|
+
/** One configured member binding. */
|
|
29
|
+
export interface TeamAgentBindingInput {
|
|
30
|
+
/** dsh-agents member id to bind as a team Agent. */
|
|
31
|
+
memberId: string;
|
|
32
|
+
/** Name the hub resolves mentions by; empty falls back to the member's own name. */
|
|
33
|
+
name?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Plugin config, validated by the same-named schemastery schema. */
|
|
36
|
+
export interface Config {
|
|
37
|
+
/** Master switch for the extension. */
|
|
38
|
+
enabled?: Volatile<boolean>;
|
|
39
|
+
/** Whether this extension announces itself in every agent system prompt. */
|
|
40
|
+
announceToAgent?: Volatile<boolean>;
|
|
41
|
+
/** Team-hub base URL, e.g. https://hub.example.com. */
|
|
42
|
+
hubUrl?: Volatile<string>;
|
|
43
|
+
/** Team id the Host registers into. */
|
|
44
|
+
teamId?: Volatile<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Workspace this mount runs its mirror cards in; empty falls back to the
|
|
47
|
+
* workspace the member's dsh-agents team pins.
|
|
48
|
+
*
|
|
49
|
+
* A card with neither cannot be started by the board, and the hub keeps its
|
|
50
|
+
* issue `running` for as long as this Host holds the lease, so this Host claims
|
|
51
|
+
* nothing until one resolves and reports that in its summary instead.
|
|
52
|
+
*/
|
|
53
|
+
workspaceId?: Volatile<string>;
|
|
54
|
+
/** Credential reference the Host Token is stored under. */
|
|
55
|
+
hostTokenRef?: Volatile<string>;
|
|
56
|
+
/** dsh-agents members bound as team Agents on this machine. */
|
|
57
|
+
agents?: Volatile<TeamAgentBindingInput[]>;
|
|
58
|
+
/** Hostname this Host registers under; empty means the platform hostname. */
|
|
59
|
+
hostname?: Volatile<string>;
|
|
60
|
+
/**
|
|
61
|
+
* Optional local fallback wait for a claimed question, in minutes.
|
|
62
|
+
*
|
|
63
|
+
* Zero (the default) waits for the hub's own terminal state — answered,
|
|
64
|
+
* expired or withdrawn — which is what lets a member answer from a lock-screen
|
|
65
|
+
* push hours later. A positive value withdraws the question after that long and
|
|
66
|
+
* hands the ask back to the local answerer.
|
|
67
|
+
*/
|
|
68
|
+
questionWaitMinutes?: Volatile<number>;
|
|
69
|
+
}
|
|
70
|
+
/** Profile-patch shape of {@link Config}. */
|
|
71
|
+
export interface ConfigInput {
|
|
72
|
+
enabled?: boolean;
|
|
73
|
+
announceToAgent?: boolean;
|
|
74
|
+
hubUrl?: string;
|
|
75
|
+
teamId?: string;
|
|
76
|
+
workspaceId?: string;
|
|
77
|
+
hostTokenRef?: string;
|
|
78
|
+
agents?: TeamAgentBindingInput[];
|
|
79
|
+
hostname?: string;
|
|
80
|
+
questionWaitMinutes?: number;
|
|
81
|
+
}
|
|
82
|
+
/** Schema default of the announcement switch. */
|
|
83
|
+
export declare const DEFAULT_ANNOUNCE_TO_AGENT = false;
|
|
84
|
+
/** Schema default of the Host Token reference. */
|
|
85
|
+
export declare const DEFAULT_HOST_TOKEN_REF = "DSH_TEAM_HUB_TOKEN";
|
|
86
|
+
export declare const Config: z<ConfigInput, Config>;
|
|
87
|
+
/**
|
|
88
|
+
* Read one config field's live value.
|
|
89
|
+
* @param field - the field as the Loader handed it.
|
|
90
|
+
* @param fallback - value when the field is absent.
|
|
91
|
+
* @returns the effective value.
|
|
92
|
+
*/
|
|
93
|
+
export declare function readConfigField<T>(field: Volatile<T> | T | undefined, fallback: T): T;
|
|
94
|
+
/** The effective settings of one mount. */
|
|
95
|
+
export interface TeamProviderSettings {
|
|
96
|
+
enabled: boolean;
|
|
97
|
+
announceToAgent: boolean;
|
|
98
|
+
hubUrl: string;
|
|
99
|
+
teamId: string;
|
|
100
|
+
workspaceId: string;
|
|
101
|
+
hostTokenRef: string;
|
|
102
|
+
agents: readonly TeamAgentBinding[];
|
|
103
|
+
hostname: string;
|
|
104
|
+
questionWaitMinutes: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolve the effective settings of one mount.
|
|
108
|
+
* @param config - the row's config as the Host handed it.
|
|
109
|
+
* @param hostname - platform hostname fallback.
|
|
110
|
+
* @returns the settings the registration consumes.
|
|
111
|
+
*/
|
|
112
|
+
export declare function resolveProviderSettings(config?: Config, hostname?: string): TeamProviderSettings;
|
|
113
|
+
/**
|
|
114
|
+
* Resolve the announcement text, or undefined when the tool it names is not
|
|
115
|
+
* reachable: guidance for a tool the session cannot see only wastes context.
|
|
116
|
+
* @param ctx - host context.
|
|
117
|
+
* @returns the text to publish, or undefined.
|
|
118
|
+
*/
|
|
119
|
+
export declare function resolveAnnouncement(ctx: Context): string | undefined;
|
|
120
|
+
declare module '@deepseek-ai/cordis' {
|
|
121
|
+
interface Events {
|
|
122
|
+
/**
|
|
123
|
+
* Volatile config values were committed into the running fiber without a
|
|
124
|
+
* remount; dispatched to the owning fiber only.
|
|
125
|
+
* @param paths - changed config paths as key arrays.
|
|
126
|
+
* @mode emit
|
|
127
|
+
*/
|
|
128
|
+
'loader/volatile-update'(paths: readonly (readonly string[])[]): void;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Mount the plugin once per Host process, whichever install source loaded it.
|
|
133
|
+
* @param key - the process-wide guard key.
|
|
134
|
+
* @param apply - the real entry.
|
|
135
|
+
* @returns the guarded entry.
|
|
136
|
+
*/
|
|
137
|
+
export declare function mountOnce<T extends (ctx: Context, config?: Config) => void>(key: symbol, apply: T): T;
|
|
138
|
+
export declare const apply: typeof applyImpl;
|
|
139
|
+
/**
|
|
140
|
+
* Activate the extension's host half.
|
|
141
|
+
*
|
|
142
|
+
* The provider is admitted through the board's own registration service, so it
|
|
143
|
+
* follows the board's master switch as well as this extension's. Registration
|
|
144
|
+
* lives behind a cordis dependency scope (ctx.inject) because the Host loads
|
|
145
|
+
* plugin rows in an order this package does not own: the board's service may
|
|
146
|
+
* genuinely not exist yet when this row activates, and the scope mounts when it
|
|
147
|
+
* appears and unloads when it is withdrawn.
|
|
148
|
+
* @param ctx - the plugin context.
|
|
149
|
+
* @param config - resolved plugin config.
|
|
150
|
+
*/
|
|
151
|
+
declare function applyImpl(ctx: Context, config?: Config): void;
|
|
152
|
+
export {};
|
package/locale/en.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,86 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-client-ui-task-board-team",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "External provider extension for the dsh Web GUI task board that binds local dsh-agents members as team Agents and mirrors cloud team-hub issues onto the board; shipped as a dsh profile bundle with no DSH source changes.",
|
|
4
|
+
"version": "0.4.13",
|
|
5
|
+
"icon": "icon.svg",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
9
|
+
},
|
|
10
|
+
"main": "lib/index.js",
|
|
11
|
+
"types": "lib/types/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./lib/types/index.d.ts",
|
|
15
|
+
"default": "./lib/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./client": {
|
|
18
|
+
"types": "./lib/types/client/index.d.ts",
|
|
19
|
+
"default": "./lib/client.js"
|
|
20
|
+
},
|
|
21
|
+
"./src/*": "./src/*",
|
|
22
|
+
"./locale/en.json": "./locale/en.json",
|
|
23
|
+
"./locale/zh.json": "./locale/zh.json",
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"dsh": {
|
|
27
|
+
"engines": {
|
|
28
|
+
"dsh": ">=0.2.1-rc.3"
|
|
29
|
+
},
|
|
30
|
+
"bundle": {
|
|
31
|
+
"patch": "./cordis.patch.yml"
|
|
32
|
+
},
|
|
33
|
+
"client": {
|
|
34
|
+
"inject": [
|
|
35
|
+
"@deepseek-ai/dsh-client-locale",
|
|
36
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
37
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
38
|
+
"@deepseek-ai/dsh-client-ui-slots"
|
|
39
|
+
],
|
|
40
|
+
"platform": "web"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@deepseek-ai/dsh": ">=0.2.1-rc.3",
|
|
45
|
+
"react": "^18.2.0"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@deepseek-ai/schemastery": "^3.18.5"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@deepseek-ai/cordis": "^4.0.5",
|
|
52
|
+
"@deepseek-ai/dsh-api-gateway": "^0.2.1-rc.3",
|
|
53
|
+
"@deepseek-ai/dsh-credentials": "^0.2.1-rc.3",
|
|
54
|
+
"@deepseek-ai/dsh-client-locale": "^0.2.1-rc.3",
|
|
55
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.2.1-rc.3",
|
|
56
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.2.1-rc.3",
|
|
57
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.2.1-rc.3",
|
|
58
|
+
"@deepseek-ai/dsh-llm": "^0.2.1-rc.3",
|
|
59
|
+
"@deepseek-ai/dsh-tools": "^0.2.1-rc.3",
|
|
60
|
+
"@types/node": "^22.20.0",
|
|
61
|
+
"@types/react": "~18.3.1",
|
|
62
|
+
"@types/react-dom": "^18.3.7",
|
|
63
|
+
"react": "^18.3.1",
|
|
64
|
+
"react-dom": "^18.3.1",
|
|
65
|
+
"tsdown": "0.22.2",
|
|
66
|
+
"typescript": "~5.7.2",
|
|
67
|
+
"vitest": "^4.1.11"
|
|
68
|
+
},
|
|
69
|
+
"files": [
|
|
70
|
+
"lib/**/*.js",
|
|
71
|
+
"lib/**/*.d.ts",
|
|
72
|
+
"src",
|
|
73
|
+
"cordis.patch.yml",
|
|
74
|
+
"icon.svg",
|
|
75
|
+
"locale"
|
|
76
|
+
],
|
|
77
|
+
"license": "BSD-3-Clause",
|
|
78
|
+
"scripts": {
|
|
79
|
+
"build": "tsc -b tsconfig.build.json && tsdown",
|
|
80
|
+
"bundle": "tsdown",
|
|
81
|
+
"watch": "tsdown --watch",
|
|
82
|
+
"typecheck": "tsgo --noEmit",
|
|
83
|
+
"test": "vitest run",
|
|
84
|
+
"test:watch": "vitest"
|
|
85
|
+
}
|
|
6
86
|
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser half of the task-board team provider extension.
|
|
3
|
+
*
|
|
4
|
+
* It registers this extension's copy, then contributes three seats: the card
|
|
5
|
+
* decoration and the task-detail section (both behind the extension's own
|
|
6
|
+
* switch, which is read from the settings form), and the configuration block
|
|
7
|
+
* inside the board's own settings card (behind the board service alone, because
|
|
8
|
+
* that block is where the switch and the Host Token live).
|
|
9
|
+
*
|
|
10
|
+
* Failure policy: a missing slot registry, locale service or board service is
|
|
11
|
+
* handled, never thrown — the web shell fails the whole boot when a plugin apply
|
|
12
|
+
* throws, and one external plugin must not take the GUI down.
|
|
13
|
+
*
|
|
14
|
+
* @module dsh-task-board-team/client
|
|
15
|
+
*/
|
|
16
|
+
import type { Context as ClientContext } from '@deepseek-ai/cordis'
|
|
17
|
+
import type { ConfigForm, ConfigFormSnapshot } from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
18
|
+
// Type-only: pulls the settings-surface Context merge (ctx.configForms).
|
|
19
|
+
import type {} from '@deepseek-ai/dsh-client-ui-settings/client'
|
|
20
|
+
// Type-only: pulls the locale plugin's Context merge (ctx.locale) and its
|
|
21
|
+
// LocaleNamespaceMap merge table.
|
|
22
|
+
import type {} from '@deepseek-ai/dsh-client-locale/client'
|
|
23
|
+
import type {} from '@deepseek-ai/dsh-client-ui-renderer/client'
|
|
24
|
+
import type {} from '@deepseek-ai/dsh-client-ui-slots'
|
|
25
|
+
import { installTeamClientHalf, type ExtensionEnabledSource } from './team/extension.ts'
|
|
26
|
+
import { optionalService } from './optional-service.ts'
|
|
27
|
+
import { en, setRuntimeTranslate, t, zh, type TeamKey } from './locales.ts'
|
|
28
|
+
|
|
29
|
+
/** Locale namespace this half owns. */
|
|
30
|
+
export const NS = 'task-board-team'
|
|
31
|
+
|
|
32
|
+
/** Settings namespace the block edits. */
|
|
33
|
+
export const SETTINGS_NAMESPACE = 'task-board-team'
|
|
34
|
+
|
|
35
|
+
/** Profile entry ids this package's patch rows carry, most specific first. */
|
|
36
|
+
export const ENTRY_IDS: readonly string[] = ['web-ui-task-board-team', 'ui-task-board-team', SETTINGS_NAMESPACE]
|
|
37
|
+
|
|
38
|
+
/** The settings value this extension's own form carries. */
|
|
39
|
+
export interface TeamSettingsValue {
|
|
40
|
+
enabled?: boolean
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
44
|
+
interface SlotMap {
|
|
45
|
+
/** Provider task-detail section; the board declares and renders it. */
|
|
46
|
+
'task-board.detail.section': { kind: 'list'; scope: 'root'; owner: import('../core/contract.ts').TaskBoardDetailSectionProps }
|
|
47
|
+
/** Provider settings section; the board declares and renders it. */
|
|
48
|
+
'task-board.settings.section': { kind: 'list'; scope: 'root'; owner: import('../core/contract.ts').TaskBoardSettingsSectionProps }
|
|
49
|
+
/** Provider card decoration; the board declares and renders it. */
|
|
50
|
+
'task-board.card.decoration': { kind: 'list'; scope: 'root'; owner: import('../core/contract.ts').TaskBoardCardDecorationProps }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface LocaleNamespaceMap {
|
|
54
|
+
/** The team provider extension copy. */
|
|
55
|
+
'task-board-team': TeamKey
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A form for a page that serves this namespace to nobody: it never answers, so
|
|
61
|
+
* the seats follow the documented default (enabled) instead of failing.
|
|
62
|
+
* @returns an inert configuration form.
|
|
63
|
+
*/
|
|
64
|
+
function unavailableForm(): ConfigForm<TeamSettingsValue> {
|
|
65
|
+
const snapshot: ConfigFormSnapshot<TeamSettingsValue> = {
|
|
66
|
+
status: 'unavailable',
|
|
67
|
+
value: undefined,
|
|
68
|
+
base: undefined,
|
|
69
|
+
user: undefined,
|
|
70
|
+
revision: undefined,
|
|
71
|
+
writable: false,
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
getSnapshot: () => snapshot,
|
|
75
|
+
subscribe: () => () => {},
|
|
76
|
+
set: async () => false,
|
|
77
|
+
unset: async () => false,
|
|
78
|
+
mutate: async () => false,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Bind the settings form this extension's switch is read from.
|
|
84
|
+
* @param ctx - the browser plugin context.
|
|
85
|
+
* @returns the form, or an inert one when the page serves no such namespace.
|
|
86
|
+
*/
|
|
87
|
+
function bindSettingsForm(ctx: ClientContext): ConfigForm<TeamSettingsValue> {
|
|
88
|
+
// Read through the optional accessor: the shell throws on an undeclared
|
|
89
|
+
// service property, and one external plugin must not fail the whole boot.
|
|
90
|
+
const forms = optionalService(ctx, 'configForms') as { describe?: unknown } | undefined
|
|
91
|
+
if (forms === undefined) return unavailableForm()
|
|
92
|
+
const binder = optionalService(ctx, 'webUiSettings') as
|
|
93
|
+
{ bind?: <T>(spec: { namespace: string }) => ConfigForm<T> } | undefined
|
|
94
|
+
if (binder !== undefined && typeof binder.bind === 'function') {
|
|
95
|
+
try {
|
|
96
|
+
return binder.bind<TeamSettingsValue>({ namespace: SETTINGS_NAMESPACE })
|
|
97
|
+
} catch {
|
|
98
|
+
return unavailableForm()
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return unavailableForm()
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Runtime face of the locale service this half registers its copy into. */
|
|
105
|
+
interface LocaleSeat {
|
|
106
|
+
register(namespace: string, dictionaries: { zh: unknown; en: unknown }): () => void
|
|
107
|
+
bind(namespace: string): unknown
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Mount the extension's browser half.
|
|
112
|
+
* @param ctx - the browser plugin context.
|
|
113
|
+
*/
|
|
114
|
+
export function apply(ctx: ClientContext): void {
|
|
115
|
+
const locale = optionalService(ctx, 'locale') as LocaleSeat | undefined
|
|
116
|
+
|
|
117
|
+
ctx.effect(() => {
|
|
118
|
+
if (locale === undefined) return () => {}
|
|
119
|
+
try {
|
|
120
|
+
return locale.register(NS, { zh, en })
|
|
121
|
+
} catch {
|
|
122
|
+
return () => {}
|
|
123
|
+
}
|
|
124
|
+
}, 'task-board-team: dictionaries')
|
|
125
|
+
|
|
126
|
+
// Wire the SDK translate seat into the module-level t the seats use, so a
|
|
127
|
+
// runtime language switch reaches them without a reload.
|
|
128
|
+
if (locale !== undefined) {
|
|
129
|
+
try { setRuntimeTranslate(locale.bind(NS) as (key: TeamKey) => string) } catch { void t }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const scope = bindSettingsForm(ctx)
|
|
133
|
+
const enabledSource: ExtensionEnabledSource = {
|
|
134
|
+
read: () => scope.getSnapshot().value?.enabled !== false,
|
|
135
|
+
subscribe: listener => scope.subscribe(listener),
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
ctx.effect(() => installTeamClientHalf(ctx, enabledSource), 'task-board-team: provider seats')
|
|
139
|
+
}
|