@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.
Files changed (65) hide show
  1. package/LICENSE +202 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +66 -2
  4. package/README.zh.md +67 -0
  5. package/cordis.patch.yml +14 -0
  6. package/icon.svg +3 -0
  7. package/lib/client.js +1117 -0
  8. package/lib/index.js +2968 -0
  9. package/lib/types/client/index.d.ts +58 -0
  10. package/lib/types/client/locales.d.ts +83 -0
  11. package/lib/types/client/optional-service.d.ts +22 -0
  12. package/lib/types/client/team/extension.d.ts +29 -0
  13. package/lib/types/client/team/sections.d.ts +38 -0
  14. package/lib/types/client/team/settings.d.ts +41 -0
  15. package/lib/types/client/team/summary.d.ts +34 -0
  16. package/lib/types/core/contract.d.ts +269 -0
  17. package/lib/types/core/hub-protocol.d.ts +175 -0
  18. package/lib/types/core/identity.d.ts +96 -0
  19. package/lib/types/core/mirror.d.ts +51 -0
  20. package/lib/types/core/question-report.d.ts +84 -0
  21. package/lib/types/core/settlement.d.ts +49 -0
  22. package/lib/types/core/task-record.d.ts +59 -0
  23. package/lib/types/core/timers.d.ts +20 -0
  24. package/lib/types/host/bindings.d.ts +92 -0
  25. package/lib/types/host/channel.d.ts +44 -0
  26. package/lib/types/host/credentials.d.ts +63 -0
  27. package/lib/types/host/extension.d.ts +57 -0
  28. package/lib/types/host/hub-client.d.ts +157 -0
  29. package/lib/types/host/questions.d.ts +105 -0
  30. package/lib/types/host/service.d.ts +209 -0
  31. package/lib/types/host/setup.d.ts +152 -0
  32. package/lib/types/host/tools.d.ts +19 -0
  33. package/lib/types/host/waterfall.d.ts +39 -0
  34. package/lib/types/index.d.ts +152 -0
  35. package/locale/en.json +6 -0
  36. package/locale/zh.json +6 -0
  37. package/package.json +83 -3
  38. package/src/client/css-modules.d.ts +5 -0
  39. package/src/client/index.ts +139 -0
  40. package/src/client/locales.ts +154 -0
  41. package/src/client/optional-service.ts +30 -0
  42. package/src/client/team/extension.ts +185 -0
  43. package/src/client/team/sections.tsx +159 -0
  44. package/src/client/team/settings.tsx +242 -0
  45. package/src/client/team/summary.ts +156 -0
  46. package/src/client/team/team.module.css +122 -0
  47. package/src/core/contract.ts +326 -0
  48. package/src/core/hub-protocol.ts +217 -0
  49. package/src/core/identity.ts +193 -0
  50. package/src/core/mirror.ts +88 -0
  51. package/src/core/question-report.ts +144 -0
  52. package/src/core/settlement.ts +84 -0
  53. package/src/core/task-record.ts +65 -0
  54. package/src/core/timers.ts +34 -0
  55. package/src/host/bindings.ts +211 -0
  56. package/src/host/channel.ts +97 -0
  57. package/src/host/credentials.ts +147 -0
  58. package/src/host/extension.ts +197 -0
  59. package/src/host/hub-client.ts +287 -0
  60. package/src/host/questions.ts +275 -0
  61. package/src/host/service.ts +1421 -0
  62. package/src/host/setup.ts +259 -0
  63. package/src/host/tools.ts +70 -0
  64. package/src/host/waterfall.ts +51 -0
  65. package/src/index.ts +452 -0
@@ -0,0 +1,63 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ /** Credential reference name the Host Token is stored under by default. */
3
+ export declare const DEFAULT_TOKEN_REF = "DSH_TEAM_HUB_TOKEN";
4
+ /** Credential facts one reference reports; no slot carries a value. */
5
+ interface CredentialInfo {
6
+ configured: boolean;
7
+ source?: string;
8
+ writable: boolean;
9
+ }
10
+ /** The slice of the credential seam this extension uses. */
11
+ export interface CredentialFace {
12
+ resolve(ref: unknown): Promise<{
13
+ value: string;
14
+ source?: string;
15
+ } | undefined>;
16
+ describe(ref: unknown): Promise<CredentialInfo>;
17
+ set(ref: unknown, value: string): Promise<void>;
18
+ unset(ref: unknown): Promise<void>;
19
+ }
20
+ /**
21
+ * Resolve the optional credential service without declaring a required
22
+ * injection: a deployment that serves none keeps working on the environment.
23
+ * @param ctx - host context.
24
+ * @returns the seam, or undefined.
25
+ */
26
+ export declare function resolveCredentialFace(ctx: Context): CredentialFace | undefined;
27
+ /**
28
+ * Report one reference's credential facts for a settings surface.
29
+ * @param ctx - host context.
30
+ * @param ref - the configured reference name.
31
+ * @param env - environment consulted for the ambient fallback.
32
+ * @returns the status the settings section renders.
33
+ */
34
+ export declare function describeHostToken(ctx: Context, ref: string, env?: Record<string, string | undefined>): Promise<{
35
+ configured: boolean;
36
+ writable: boolean;
37
+ source?: string;
38
+ ref: string;
39
+ }>;
40
+ /**
41
+ * Resolve the effective Host Token for one reference.
42
+ * @param ctx - host context.
43
+ * @param ref - the configured reference name.
44
+ * @param env - environment consulted for the ambient fallback.
45
+ * @returns the token, or undefined when none is configured.
46
+ */
47
+ export declare function resolveHostToken(ctx: Context, ref: string, env?: Record<string, string | undefined>): Promise<string | undefined>;
48
+ /**
49
+ * Store one Host Token in the credential seam.
50
+ * @param ctx - host context.
51
+ * @param ref - the reference to write.
52
+ * @param token - the secret value.
53
+ * @throws when no credential store is served or the store refuses the write.
54
+ */
55
+ export declare function setHostToken(ctx: Context, ref: string, token: string): Promise<void>;
56
+ /**
57
+ * Remove one stored Host Token. Absent values are a no-op.
58
+ * @param ctx - host context.
59
+ * @param ref - the reference to clear.
60
+ * @throws when no credential store is served.
61
+ */
62
+ export declare function clearHostToken(ctx: Context, ref: string): Promise<void>;
63
+ export {};
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The team provider assembled as one task-board extension.
3
+ *
4
+ * Everything team-specific lives behind this factory: the board admits it
5
+ * through the cordis `taskBoard` service, hands it the capability face, and
6
+ * never learns what the provider does with it. The factory imports no board
7
+ * internals — only the same-shape contract in `../core/contract.ts` — and it
8
+ * probes the two optional capabilities instead of assuming them, so a board
9
+ * revision without follow-up or rework loses those deliveries and reports the
10
+ * loss rather than failing to mount.
11
+ *
12
+ * @module dsh-task-board-team/host/extension
13
+ */
14
+ import { type TaskBoardExtension } from '../core/contract.ts';
15
+ import { TEAM_EXTENSION_ID } from '../core/identity.ts';
16
+ import { type HostTimerFace } from '../core/timers.ts';
17
+ import type { SocketHandlers, SocketLike } from './channel.ts';
18
+ import type { BoundAgent } from './bindings.ts';
19
+ import type { TeamRuntimeSettings, TeamSyncService } from './service.ts';
20
+ import type { TeamSetup } from './setup.ts';
21
+ import type { HubClient } from './hub-client.ts';
22
+ export { TEAM_EXTENSION_ID };
23
+ export interface TeamExtensionOptions {
24
+ /** Hub REST client. */
25
+ hub: HubClient;
26
+ /** Live settings of this mount. */
27
+ settings: () => TeamRuntimeSettings;
28
+ /** Resolve the bound members out of the dsh-agents ledger. */
29
+ resolveAgents: () => Promise<{
30
+ agents: BoundAgent[];
31
+ problems: string[];
32
+ }>;
33
+ /** Open the team channel. */
34
+ connect: (sinceSeq: number, handlers: SocketHandlers) => Promise<SocketLike | undefined>;
35
+ /** Ask the board to run a card; absent means this Host cannot start executions. */
36
+ requestRun?: (taskId: string) => void;
37
+ /** Configuration surface the settings section drives through these actions. */
38
+ setup?: TeamSetup;
39
+ /** Non-secret configuration the settings section renders, read at publish time. */
40
+ configuration?: () => Record<string, unknown>;
41
+ /** Called with the live service on start and with undefined on stop. */
42
+ onService?: (service: TeamSyncService | undefined) => void;
43
+ /** Volatile master switch, read at use time. Absent means enabled. */
44
+ enabled?: () => boolean;
45
+ /** Whether the deployment exposes the board's action seat (the run capability). */
46
+ actionSeat?: () => boolean;
47
+ timers?: HostTimerFace;
48
+ now?: () => number;
49
+ uuid?: () => string;
50
+ log?: (message: string, detail?: unknown) => void;
51
+ }
52
+ /**
53
+ * Build the team provider extension.
54
+ * @param options - deployment configuration for the integration.
55
+ * @returns the extension the board registers.
56
+ */
57
+ export declare function createTeamExtension(options: TeamExtensionOptions): TaskBoardExtension;
@@ -0,0 +1,157 @@
1
+ /**
2
+ * The Host's REST client for one team-hub.
3
+ *
4
+ * Every call carries the Host Token and the protocol version, resolves its base
5
+ * URL and team at call time (so a settings edit reaches the next call without a
6
+ * remount), and turns the hub's unified error envelope into one diagnosable
7
+ * error carrying its code. The transport is injected: a deployment uses the
8
+ * global fetch, and the test suite drives a fake hub through the same seam.
9
+ *
10
+ * @module dsh-task-board-team/host/hub-client
11
+ */
12
+ import { type HubActivity, type HubAgentDefinition, type HubAgentRecord, type HubClaim, type HubComment, type HubIssue, type HubQuestion } from '../core/hub-protocol.ts';
13
+ import type { QuestionReportBody } from '../core/question-report.ts';
14
+ import type { SettleRequestBody } from '../core/settlement.ts';
15
+ /** One response as this client reads it. */
16
+ export interface HubResponse {
17
+ ok: boolean;
18
+ status: number;
19
+ text(): Promise<string>;
20
+ }
21
+ /** The transport one deployment hands the client. */
22
+ export type HubFetch = (url: string, init: {
23
+ method: string;
24
+ headers: Record<string, string>;
25
+ body?: string;
26
+ }) => Promise<HubResponse>;
27
+ /** One refusal the hub answered with. */
28
+ export declare class HubError extends Error {
29
+ /** Machine-readable code from the unified error envelope. */
30
+ readonly code: string;
31
+ /** HTTP status the hub answered with. */
32
+ readonly status: number;
33
+ constructor(code: string, message: string, status: number);
34
+ }
35
+ export interface HubClientOptions {
36
+ /** Hub base URL, read per call. */
37
+ hubUrl: () => string;
38
+ /** Team id, read per call. */
39
+ teamId: () => string;
40
+ /** Host Token, resolved per call from the credential store. */
41
+ token: () => Promise<string | undefined>;
42
+ /** Transport; the global fetch when absent. */
43
+ fetch?: HubFetch;
44
+ }
45
+ /** The REST surface one Host speaks to one team. */
46
+ export declare class HubClient {
47
+ #private;
48
+ constructor(options: HubClientOptions);
49
+ /** Whether this deployment can reach a hub at all (a URL and a token exist). */
50
+ configured(): Promise<boolean>;
51
+ /**
52
+ * Register this Host and synchronize its agent definitions.
53
+ *
54
+ * The body is snake_case end to end (protocol amendment A4 point 1): the hub
55
+ * stores exactly these keys, so a camelCase member is a field it never sees.
56
+ * @param body - hostname, client version and the local agent definitions.
57
+ * @returns the registered host id, status and the agent records the hub now holds.
58
+ */
59
+ register(body: {
60
+ hostname: string;
61
+ client_version: string;
62
+ agents: readonly HubAgentDefinition[];
63
+ }): Promise<{
64
+ host_id: string;
65
+ status: string;
66
+ agents?: readonly HubAgentRecord[];
67
+ }>;
68
+ /**
69
+ * Send one heartbeat.
70
+ * @param hostId - the registered host id.
71
+ * @returns the hub's server time.
72
+ */
73
+ heartbeat(hostId: string): Promise<{
74
+ server_time?: number;
75
+ }>;
76
+ /**
77
+ * List the issues this Host may claim.
78
+ * @param hostId - the registered host id.
79
+ * @returns the claimable issues.
80
+ */
81
+ listClaimableIssues(hostId: string): Promise<readonly HubIssue[]>;
82
+ /**
83
+ * Claim one issue, or re-establish the attempt already running locally.
84
+ * @param issueId - the issue to claim.
85
+ * @param credentials - the previous attempt credentials, when this is a reconnect.
86
+ * @returns the lease.
87
+ */
88
+ claim(issueId: string, credentials?: {
89
+ execution_attempt_id?: string;
90
+ lease_token?: string;
91
+ }): Promise<HubClaim>;
92
+ /**
93
+ * Extend one lease.
94
+ * @param issueId - the claimed issue.
95
+ * @param leaseToken - the lease credential.
96
+ * @returns the new expiry.
97
+ */
98
+ renewLease(issueId: string, leaseToken: string): Promise<{
99
+ lease_expires_at: number;
100
+ }>;
101
+ /**
102
+ * Write one settlement back.
103
+ * @param issueId - the settled issue.
104
+ * @param body - outcome, summary and error.
105
+ * @returns the collaboration status the hub moved to.
106
+ */
107
+ settle(issueId: string, body: SettleRequestBody): Promise<{
108
+ ok: boolean;
109
+ status: string;
110
+ }>;
111
+ /**
112
+ * Report one decision question.
113
+ * @param issueId - the issue it belongs to.
114
+ * @param body - the question text, options and multi-select flag.
115
+ * @returns the stored question.
116
+ */
117
+ createQuestion(issueId: string, body: QuestionReportBody): Promise<HubQuestion>;
118
+ /**
119
+ * Withdraw one pending question after the local asker gave up.
120
+ * @param questionId - the question to withdraw.
121
+ */
122
+ withdrawQuestion(questionId: string): Promise<void>;
123
+ /**
124
+ * Post one agent comment.
125
+ * @param issueId - the issue to comment on.
126
+ * @param body - the content and the agent identity that wrote it.
127
+ * @returns the stored comment.
128
+ */
129
+ createComment(issueId: string, body: {
130
+ content: string;
131
+ author_type: 'agent';
132
+ author_agent_id: string;
133
+ }): Promise<HubComment>;
134
+ /**
135
+ * Read one issue's comment thread.
136
+ * @param issueId - the issue to read.
137
+ * @returns the comments, oldest first.
138
+ */
139
+ comments(issueId: string): Promise<readonly HubComment[]>;
140
+ }
141
+ /** The activity entry one status change appends, as the browser renders it. */
142
+ export interface ActivityEntry {
143
+ id: string;
144
+ type: string;
145
+ text: string;
146
+ createdAt: number;
147
+ }
148
+ /**
149
+ * Project one hub activity row into the shape the summary carries.
150
+ *
151
+ * The wire carries the payload as a JSON object (its `payload_json` column is a
152
+ * D1 storage form only), so the rendered text is this Host's own rendering of
153
+ * that object rather than a serialized column.
154
+ * @param activity - the row the hub broadcast or served.
155
+ * @returns the entry the browser renders.
156
+ */
157
+ export declare function projectActivity(activity: HubActivity): ActivityEntry;
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Decision questions asked by a team card's session, routed through the hub.
3
+ *
4
+ * The Host's question waterfall is shared by every answerer on the machine, so
5
+ * this module claims exactly one case and delegates everything else: a request
6
+ * whose `agent.id` — the session id, since the event carries no session field —
7
+ * is the session of a card this extension mirrors. Every other conversation on
8
+ * the machine keeps its own answerer, and the local surface stays available for
9
+ * a claimed question because the claim holds the ask while the hub's reviewers
10
+ * answer it.
11
+ *
12
+ * Tool permission approvals are NOT part of this module and have no listener at
13
+ * all: `approval/request` belongs to the local machine's security domain
14
+ * (`team-hub/PROTOCOL.md` section 6), so this provider never puts one on the
15
+ * wire.
16
+ *
17
+ * @module dsh-task-board-team/host/questions
18
+ */
19
+ import type { HubClient } from './hub-client.ts';
20
+ import { type QuestionAnswer, type QuestionRequestShape } from '../core/question-report.ts';
21
+ import type { TaskBoardExtensionHost, TaskBoardLinkedTask } from '../core/contract.ts';
22
+ import type { HostTimerFace } from '../core/timers.ts';
23
+ /**
24
+ * Default local fallback wait, in milliseconds.
25
+ *
26
+ * Zero means "no local cap": the claim holds the ask until the hub settles it
27
+ * (answered, expired or withdrawn), which is what the acceptance loop needs — a
28
+ * member answering from a lock-screen push may take far longer than any fixed
29
+ * window. A deployment that wants the local surface back sooner turns the
30
+ * fallback on and names its own number of minutes.
31
+ */
32
+ export declare const DEFAULT_QUESTION_WAIT_MS = 0;
33
+ /** One question this Host reported and is still waiting on. */
34
+ export interface PendingQuestionView {
35
+ /** Local claim id. */
36
+ id: string;
37
+ /** Card the asking session belongs to. */
38
+ taskId: string;
39
+ /** Issue the question belongs to. */
40
+ issueId: string;
41
+ /** The question text, as the browser renders it. */
42
+ question: string;
43
+ /** Hub question id, once the hub stored it. */
44
+ hubQuestionId?: string;
45
+ /** Instant the question was reported (ms epoch). */
46
+ askedAt: number;
47
+ }
48
+ export interface QuestionRouterOptions {
49
+ hub: HubClient;
50
+ host: TaskBoardExtensionHost;
51
+ /** Every card this extension mirrors; read live so a deleted card is not answered. */
52
+ linked: () => readonly TaskBoardLinkedTask[];
53
+ timers: HostTimerFace;
54
+ now: () => number;
55
+ /** Mint the local claim id. */
56
+ uuid: () => string;
57
+ /** Called whenever the pending set changes, so the summary can republish. */
58
+ onChange?: () => void;
59
+ /**
60
+ * Local fallback wait for one claim, read per question.
61
+ *
62
+ * Absent or zero means the claim waits for the hub's own terminal state; a
63
+ * positive number withdraws the question after that long and hands the ask back
64
+ * to the next answerer.
65
+ */
66
+ fallbackWaitMs?: () => number | undefined;
67
+ log?: (message: string, detail?: unknown) => void;
68
+ }
69
+ /**
70
+ * The provider's claims on the Host's process-wide question waterfall.
71
+ */
72
+ export declare class QuestionRouter {
73
+ #private;
74
+ constructor(options: QuestionRouterOptions);
75
+ /** Every question this Host is still waiting on, oldest claim first. */
76
+ pending(): readonly PendingQuestionView[];
77
+ /**
78
+ * The waterfall body: claim one question that belongs to a team card, and
79
+ * delegate every other request to the next answerer.
80
+ * @param request - the pending question batch.
81
+ * @param next - the rest of the answerer chain.
82
+ * @returns the team's answer, or whatever the next answerer says.
83
+ */
84
+ request(request: QuestionRequestShape, next: () => Promise<QuestionAnswer>): Promise<QuestionAnswer>;
85
+ /**
86
+ * Settle one question with a team answer.
87
+ * @param payload - the hub's `question.answered` payload.
88
+ * @returns whether this Host was waiting on that question.
89
+ */
90
+ answered(payload: Record<string, unknown>): boolean;
91
+ /**
92
+ * End one question as unanswered, the way the hub's expiry does.
93
+ * @param payload - the hub's `question.expired` payload.
94
+ * @returns whether this Host was waiting on that question.
95
+ */
96
+ expired(payload: Record<string, unknown>): boolean;
97
+ /**
98
+ * Drop one question the hub reported withdrawn.
99
+ * @param payload - the hub's `question.withdrawn` payload.
100
+ * @returns whether this Host was waiting on that question.
101
+ */
102
+ withdrawn(payload: Record<string, unknown>): boolean;
103
+ /** Drop every claim, delegating each to the next answerer. */
104
+ dispose(): void;
105
+ }
@@ -0,0 +1,209 @@
1
+ /**
2
+ * The provider's hub synchronization: registration, heartbeat, claiming, leases
3
+ * and write-back.
4
+ *
5
+ * The division of authority runs through every method here. The hub decides
6
+ * which issues exist, who owns them and what collaboration status they carry;
7
+ * this Host decides whether it may take one, how it runs it locally and what the
8
+ * run produced. A claim is the only moment the two meet: the hub hands over a
9
+ * lease and an attempt id, this Host materializes the issue as a board card and
10
+ * reports back when that card's execution settles.
11
+ *
12
+ * Reconnection is the interesting path, so it is written as one: the attempt
13
+ * credentials live on the card's own payload, and a re-claim presents them. A
14
+ * hub that recognizes them re-establishes the lease and creates nothing new, and
15
+ * this Host in turn never creates a second card for an issue it already mirrors
16
+ * and never starts a second execution for an attempt it already ran.
17
+ *
18
+ * @module dsh-task-board-team/host/service
19
+ */
20
+ import { type HubIssueStatus } from '../core/hub-protocol.ts';
21
+ import type { TaskBoardExtensionHost, TaskBoardCapabilities } from '../core/contract.ts';
22
+ import type { HostTimerFace } from '../core/timers.ts';
23
+ import type { BoundAgent, TeamAgentBinding } from './bindings.ts';
24
+ import { type HubClient } from './hub-client.ts';
25
+ import { QuestionRouter, type PendingQuestionView } from './questions.ts';
26
+ import type { SocketHandlers, SocketLike } from './channel.ts';
27
+ /** Live settings of one mount, read at use time. */
28
+ export interface TeamRuntimeSettings {
29
+ /** Whether this extension is switched on. */
30
+ enabled: boolean;
31
+ /** Hostname this Host registers under. */
32
+ hostname: string;
33
+ /** Configured member bindings. */
34
+ bindings: readonly TeamAgentBinding[];
35
+ /** Workspace this mount runs its cards in; empty falls back to the member's team. */
36
+ workspaceId?: string;
37
+ /** Optional local fallback wait for a claimed question, in minutes; 0 means none. */
38
+ questionWaitMinutes?: number;
39
+ }
40
+ /** One comment, as the browser renders it. */
41
+ export interface TeamCommentView {
42
+ id: string;
43
+ author: string;
44
+ content: string;
45
+ createdAt: number;
46
+ }
47
+ /** One activity entry, as the browser renders it. */
48
+ export interface TeamActivityView {
49
+ id: string;
50
+ type: string;
51
+ text: string;
52
+ createdAt: number;
53
+ }
54
+ /** The collaboration half of one mirrored card. */
55
+ export interface TeamCardView {
56
+ issueId: string;
57
+ issueNumber?: number;
58
+ hubStatus?: HubIssueStatus;
59
+ assignee?: string;
60
+ reviewer?: string;
61
+ /** Member id behind `assignee`, when the hub named one. */
62
+ assigneeMemberId?: string;
63
+ /** Member id behind `reviewer`, when the hub named one. */
64
+ reviewerMemberId?: string;
65
+ agentName?: string;
66
+ comments: TeamCommentView[];
67
+ activity: TeamActivityView[];
68
+ lastError?: string;
69
+ }
70
+ /** How the row's connection to the hub currently stands. */
71
+ export type TeamConnectionState = 'idle' | 'connecting' | 'online' | 'reconnecting' | 'error';
72
+ /** The summary this extension publishes into the board snapshot. */
73
+ export interface TeamExtensionSummary {
74
+ connection: {
75
+ state: TeamConnectionState;
76
+ hostId?: string;
77
+ lastHeartbeatAt?: number;
78
+ reconnects: number;
79
+ lastError?: string;
80
+ };
81
+ capabilities: TaskBoardCapabilities;
82
+ agents: Array<{
83
+ memberId: string;
84
+ name: string;
85
+ preset?: string;
86
+ hubAgentId?: string;
87
+ }>;
88
+ problems: string[];
89
+ /**
90
+ * Whether this board pins a draft preset, model and effort when it creates a
91
+ * card.
92
+ *
93
+ * `unknown` until the first mirror card proves it either way: the verdict comes
94
+ * from reading the created card back, because a board revision without the
95
+ * draft targets drops them silently.
96
+ */
97
+ presetPin: 'unknown' | 'supported' | 'missing';
98
+ cards: Record<string, TeamCardView>;
99
+ pendingQuestions: PendingQuestionView[];
100
+ /**
101
+ * Non-secret configuration, added by the mounting row rather than by the
102
+ * service: the settings block renders the configured hub, team and bindings
103
+ * from the same document it reads everything else from.
104
+ */
105
+ configuration?: {
106
+ hubUrl?: string;
107
+ teamId?: string;
108
+ hostname?: string;
109
+ tokenConfigured?: boolean;
110
+ /** Optional local fallback wait for a claimed question, in minutes; 0 means none. */
111
+ questionWaitMinutes?: number;
112
+ };
113
+ }
114
+ /** The problem line published when the board serves no draft preset. */
115
+ export declare const DRAFT_PIN_PROBLEM = "this board revision cannot pin an agent preset, model or reasoning effort on a new card, so a claimed issue becomes a mirror card that is left for a human to start";
116
+ /** The problem line published while this Host has no workspace to run a card in. */
117
+ export declare const WORKSPACE_PROBLEM = "no run workspace is bound to this Host, so no team issue is claimed: a mirror card without a workspace cannot be started, and the hub would keep its issue running";
118
+ export interface TeamSyncServiceOptions {
119
+ /** The board's capability face. */
120
+ host: TaskBoardExtensionHost;
121
+ /** Hub REST client. */
122
+ hub: HubClient;
123
+ /** Live settings. */
124
+ settings: () => TeamRuntimeSettings;
125
+ /** Resolve the bound members out of the dsh-agents ledger. */
126
+ resolveAgents: () => Promise<{
127
+ agents: BoundAgent[];
128
+ problems: string[];
129
+ }>;
130
+ /** Open the team channel; undefined means this deployment cannot. */
131
+ connect: (sinceSeq: number, handlers: SocketHandlers) => Promise<SocketLike | undefined>;
132
+ /** Which optional capabilities the board really serves. */
133
+ capabilities: TaskBoardCapabilities;
134
+ /** Ask the board to run one card; absent means this Host cannot start executions. */
135
+ requestRun?: (taskId: string) => void;
136
+ timers: HostTimerFace;
137
+ now: () => number;
138
+ uuid: () => string;
139
+ log?: (message: string, detail?: unknown) => void;
140
+ }
141
+ /** The synchronization service of one mounted extension. */
142
+ export declare class TeamSyncService {
143
+ #private;
144
+ constructor(options: TeamSyncServiceOptions);
145
+ /** Republish the summary, e.g. after a configuration write changed what it shows. */
146
+ publishNow(): void;
147
+ /** The question router this service routes the Host waterfall through. */
148
+ get questions(): QuestionRouter;
149
+ /** Start registration, heartbeat, the channel and the first claim sweep. */
150
+ start(): Promise<void>;
151
+ /**
152
+ * Resolve once this mount finished registering, or immediately when it has not
153
+ * started at all.
154
+ *
155
+ * A sweep requested before registration completes must wait for the host id
156
+ * instead of silently claiming nothing, which is what a caller racing the
157
+ * bootstrap would otherwise get.
158
+ * @returns a promise resolved when the bootstrap settles.
159
+ */
160
+ whenStarted(): Promise<void>;
161
+ /** Release every timer, the socket and every pending question claim. */
162
+ stop(): void;
163
+ /** The summary the browser renders, built fresh from the live state. */
164
+ summary(): TeamExtensionSummary;
165
+ /**
166
+ * Report one settled execution back to the hub.
167
+ * @param event - the board's settlement notification.
168
+ */
169
+ handleExecutionSettled(event: {
170
+ taskId: string;
171
+ executionId: string;
172
+ outcome: 'succeeded' | 'failed' | 'cancelled';
173
+ error?: string;
174
+ }): Promise<void>;
175
+ /**
176
+ * Claim every issue the hub offers this Host, for the agents bound to it.
177
+ * @returns how many issues this pass turned into a new card.
178
+ */
179
+ sweep(): Promise<number>;
180
+ /**
181
+ * Ask for a sweep, coalesced to at most one pass per cadence window.
182
+ *
183
+ * A burst of channel events (a reviewer rejecting, a status moving, an issue
184
+ * appearing) asks for the same work, and the hub counts Host requests per
185
+ * minute (protocol amendment A4 point 6), so the asks collapse into one pass:
186
+ * the current window's pass or the single pass scheduled at its boundary.
187
+ */
188
+ requestSweep(): void;
189
+ /** The agents whose hub records were synchronized at registration. */
190
+ boundAgents(): readonly BoundAgent[];
191
+ /**
192
+ * Post one agent comment on the issue a card mirrors.
193
+ *
194
+ * The agent identity is the hub record this Host registered for the member the
195
+ * card was claimed for: the hub only accepts agent comments from the token
196
+ * holder that owns that agent, so the id comes from the payload instead of
197
+ * from whatever the model named.
198
+ * @param input - the card or issue to comment on, and the markdown body.
199
+ * @returns the stored comment's id.
200
+ */
201
+ postComment(input: {
202
+ taskId?: string;
203
+ issueId?: string;
204
+ text: string;
205
+ }): Promise<{
206
+ issueId: string;
207
+ commentId: string;
208
+ }>;
209
+ }