dsh-team 0.2.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/lib/index.d.ts ADDED
@@ -0,0 +1,591 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ import { z as z$1 } from "zod";
3
+ import { Context, Service } from "@deepseek-ai/cordis";
4
+ import { SessionEvent } from "@deepseek-ai/dsh-session";
5
+ import { Agent } from "@deepseek-ai/dsh-agent";
6
+ import { ProjectionDefinition } from "@deepseek-ai/dsh-session-projection";
7
+ //#region src/config.d.ts
8
+ /** Validated team configuration. */
9
+ interface TeamConfig {
10
+ /** `ctx.subagents` provider used to materialize teammates (the base bundle registers `spawn`). */
11
+ readonly provider: string;
12
+ /** Ceiling on live roster size for one leader. */
13
+ readonly maxTeammates: number;
14
+ /** Mailbox feed length kept in the durable fold and served to the panel. */
15
+ readonly maxRecentMessages: number;
16
+ /**
17
+ * Relays one teammate-started conversation may take before the mailbox
18
+ * refuses another peer delivery. Escalating to the leader is never refused,
19
+ * so the budget converges a peer exchange instead of ending the work.
20
+ */
21
+ readonly maxChainHops: number;
22
+ /** Messages one ordered member pair may exchange within a single chain. */
23
+ readonly maxChainRoundTrips: number;
24
+ /** Notes one workspace area (the shared board, or one private pad) may hold. */
25
+ readonly maxWorkspaceEntries: number;
26
+ /** Longest single note body. */
27
+ readonly maxNoteChars: number;
28
+ }
29
+ /**
30
+ * The row's config schema; the loader validates before the service is built.
31
+ * Every key is defaulted, so a deployment may add the row with no options at
32
+ * all — the input type stays partial while the validated output is complete.
33
+ */
34
+ declare const Config: z<Partial<TeamConfig>, TeamConfig>;
35
+ //#endregion
36
+ //#region src/contract.d.ts
37
+ /**
38
+ * The team vocabulary shared by the host half and the browser half: the
39
+ * durable projection value, the mailbox message source, and the relationship
40
+ * model. Types only — the browser bundle imports this module type-only, so it
41
+ * must never grow a runtime import of a host package.
42
+ *
43
+ * @module dsh-team/contract
44
+ */
45
+ /** The two relationship levels between the leader and a teammate. */
46
+ type TeamRelation = 'managed' | 'peer';
47
+ /** Lifecycle of one shared task. */
48
+ type TeamTaskStatus = 'pending' | 'active' | 'done';
49
+ /** What kind of traffic one mailbox row records. */
50
+ type TeamMessageKind =
51
+ /** Content one member addressed to another through `team_send`. */
52
+ 'message' |
53
+ /** A teammate's own result, delivered through the harness `report` tool. */
54
+ 'report' |
55
+ /** The runtime's account of a teammate's activation ending. */
56
+ 'settled';
57
+ /** One teammate as the leader's log records it. */
58
+ interface TeamMemberView {
59
+ /** The teammate's session id; the address every team tool takes. */
60
+ readonly memberId: string;
61
+ readonly name: string;
62
+ readonly role?: string;
63
+ readonly relation: TeamRelation;
64
+ /** Model route recorded at spawn, when the leader overrode its own. */
65
+ readonly model?: string;
66
+ /** Provider-owned reasoning effort recorded at spawn, when one was requested. */
67
+ readonly effort?: string;
68
+ /** Epoch ms of the spawn that added this member. */
69
+ readonly joinedAt: number;
70
+ }
71
+ /** One shared task. */
72
+ interface TeamTaskView {
73
+ readonly taskId: string;
74
+ readonly title: string;
75
+ /** Assigned teammate; absent means unassigned (leader-held). */
76
+ readonly assigneeId?: string;
77
+ readonly status: TeamTaskStatus;
78
+ /** Closing note recorded by whoever moved the task to `done`. */
79
+ readonly note?: string;
80
+ }
81
+ /**
82
+ * One mailbox row. `from`/`to` absent means the leader — the projection is
83
+ * served per session, so the owning session needs no id of its own.
84
+ */
85
+ interface TeamMessageView {
86
+ readonly messageId: string;
87
+ readonly from?: string;
88
+ readonly to?: string;
89
+ readonly kind: TeamMessageKind;
90
+ readonly text: string;
91
+ readonly time: number;
92
+ /**
93
+ * Depth of this delivery in its conversation chain: 0 is a message the
94
+ * leader started, and every teammate-to-teammate relay adds one. A row
95
+ * without it was written before the plugin recorded chains.
96
+ */
97
+ readonly hop?: number;
98
+ }
99
+ /**
100
+ * One entry of the team's shared workspace, as the leader's log last recorded
101
+ * it. Only the shared area is ever projected: a member's private pad stays
102
+ * private, including from this panel.
103
+ */
104
+ interface TeamBoardEntryView {
105
+ readonly key: string;
106
+ /** Session id of the member that wrote it last. */
107
+ readonly authorId: string;
108
+ readonly authorName: string;
109
+ readonly updatedAt: number;
110
+ /** First non-empty line, bounded — the projection never carries note bodies. */
111
+ readonly preview: string;
112
+ }
113
+ /** The durable team state folded from one leader session's log. */
114
+ interface TeamView {
115
+ /** True once a spawn settled and the team was not ended afterwards. */
116
+ readonly active: boolean;
117
+ readonly members: readonly TeamMemberView[];
118
+ readonly tasks: readonly TeamTaskView[];
119
+ /** Bounded newest-last mailbox feed of leader-visible traffic. */
120
+ readonly messages: readonly TeamMessageView[];
121
+ /**
122
+ * The shared workspace as of the last time the leader read or wrote it.
123
+ * Teammates write straight to the durable workspace, which no session log
124
+ * records, so this index is a snapshot rather than a live view.
125
+ */
126
+ readonly board: readonly TeamBoardEntryView[];
127
+ /** When that snapshot was taken; absent while the leader has never looked. */
128
+ readonly boardAt?: number;
129
+ }
130
+ /** The empty value every session without a team folds to. */
131
+ declare const EMPTY_TEAM_VIEW: TeamView;
132
+ /**
133
+ * One delivery's place in a conversation chain. A chain begins whenever the
134
+ * leader addresses a teammate and grows by one hop with every relay a teammate
135
+ * makes off the message it is working from; escalation to the leader always
136
+ * ends it. The pair is what bounds a peer conversation mechanically instead of
137
+ * by prompt — see `src/service.ts`.
138
+ */
139
+ interface TeamChain {
140
+ /** Identity of the conversation this delivery belongs to (per leader, per process). */
141
+ readonly chainId: string;
142
+ /** Relays between the chain's first delivery and this one. */
143
+ readonly hop: number;
144
+ }
145
+ /**
146
+ * Durable attribution for one team mailbox delivery, carried by the recipient's
147
+ * own `user/message` event so the sender survives persistence on both sides.
148
+ */
149
+ interface TeamMessageSource extends TeamChain {
150
+ readonly kind: 'team-message';
151
+ /** A message another agent addressed to this one (`relay` context form). */
152
+ readonly form: 'relay';
153
+ /** Session id of the sending member, or of the leader. */
154
+ readonly senderSessionId: string;
155
+ /** Display name of the sender at delivery time. */
156
+ readonly senderName: string;
157
+ }
158
+ /** The projection key this plugin owns. */
159
+ declare const TEAM_PROJECTION_KEY = "team";
160
+ //#endregion
161
+ //#region src/fold.d.ts
162
+ /** Identity and relation facts one settled team tool publishes about a member. */
163
+ interface TeamMemberFact {
164
+ readonly memberId: string;
165
+ readonly name: string;
166
+ readonly role?: string;
167
+ readonly relation: TeamRelation;
168
+ readonly model?: string;
169
+ readonly effort?: string;
170
+ }
171
+ /**
172
+ * One settled team-tool result, projected through `presentationMeta`. Every
173
+ * arm carries the WHOLE post-change entity, never a delta, so the fold's
174
+ * transition stays trivial and each logged row is self-describing.
175
+ */
176
+ type TeamFact = {
177
+ readonly team: 'member-added';
178
+ readonly member: TeamMemberFact;
179
+ } | {
180
+ readonly team: 'member-updated';
181
+ readonly member: TeamMemberFact;
182
+ } | {
183
+ readonly team: 'member-removed';
184
+ readonly memberId: string;
185
+ } | {
186
+ readonly team: 'ended';
187
+ } | {
188
+ readonly team: 'message';
189
+ readonly messageId: string;
190
+ readonly to: string;
191
+ readonly text: string;
192
+ /** Depth of the delivery in its conversation chain. */
193
+ readonly hop?: number;
194
+ } | {
195
+ readonly team: 'task';
196
+ readonly task: TeamTaskView;
197
+ } | {
198
+ readonly team: 'board';
199
+ readonly entries: readonly TeamBoardEntryView[];
200
+ readonly at: number;
201
+ };
202
+ /**
203
+ * Fold a whole log — the cold path used by tests and by a service reading a
204
+ * session the projection registry has not driven.
205
+ * @param events - the session's events, in seq order.
206
+ * @param bound - mailbox feed length ceiling.
207
+ * @returns the folded view.
208
+ */
209
+ declare function foldTeam(events: readonly SessionEvent[], bound: number): TeamView;
210
+ //#endregion
211
+ //#region src/service.d.ts
212
+ /** Live lifecycle of one teammate, as `list_agents` names the same states. */
213
+ type MemberStatus = 'running' | 'idle' | 'ready';
214
+ /** Traffic one conversation chain has already carried, per ordered pair. */
215
+ interface ChainRecord {
216
+ /** Deliveries per `from → to` pair. */
217
+ readonly edges: Map<string, number>;
218
+ /** The last text each ordered pair carried, so a verbatim repeat is refused. */
219
+ readonly said: Map<string, string>;
220
+ }
221
+ /** The live team of one leader session. */
222
+ interface TeamState {
223
+ active: boolean;
224
+ readonly members: Map<string, TeamMemberFact>;
225
+ readonly tasks: Map<string, TeamTaskView>;
226
+ /**
227
+ * The delivery each member is working from. A teammate's own sends inherit
228
+ * it, which is what makes a peer exchange one bounded conversation rather
229
+ * than an unbounded sequence of unrelated messages.
230
+ */
231
+ readonly inbox: Map<string, TeamChain>;
232
+ /** Enforcement state per chain, oldest first and bounded by {@link CHAIN_MEMORY}. */
233
+ readonly chains: Map<string, ChainRecord>;
234
+ /** Monotonic chain counter for this leader's live team. */
235
+ started: number;
236
+ }
237
+ /** What the leader asks for when spawning one teammate. */
238
+ interface TeamSpawnRequest {
239
+ readonly name: string;
240
+ readonly role?: string;
241
+ readonly persona?: string;
242
+ readonly relation: TeamRelation;
243
+ readonly task: string;
244
+ readonly model?: string;
245
+ readonly reasoningEffort?: string;
246
+ }
247
+ /** One roster row with its live runtime state. */
248
+ interface TeamMemberStatusView extends TeamMemberView {
249
+ readonly status: MemberStatus;
250
+ }
251
+ /** The model-facing team read. */
252
+ interface TeamListResult {
253
+ readonly active: boolean;
254
+ readonly members: readonly TeamMemberStatusView[];
255
+ readonly tasks: readonly TeamTaskView[];
256
+ readonly messages: readonly TeamMessageView[];
257
+ }
258
+ /** Where one member sits: whose workspace it reaches, and how a note is signed. */
259
+ interface TeamSeat {
260
+ readonly leaderId: string;
261
+ readonly memberId: string;
262
+ readonly name: string;
263
+ }
264
+ /** One resolved delivery recipient. */
265
+ type Recipient = {
266
+ readonly kind: 'leader';
267
+ readonly id: string;
268
+ readonly name: string;
269
+ } | {
270
+ readonly kind: 'member';
271
+ readonly id: string;
272
+ readonly name: string;
273
+ readonly member: TeamMemberFact;
274
+ };
275
+ /** `Context.team`: roster, mailbox routing, tasks, and team lifecycle. */
276
+ declare class TeamService extends Service {
277
+ private readonly config;
278
+ static inject: string[];
279
+ /** Live team per leader session id; rebuilt lazily from that session's log. */
280
+ private readonly teams;
281
+ /** Spawns in flight, keyed by leader session id (team tools never overlap). */
282
+ private readonly pending;
283
+ constructor(ctx: Context, config: TeamConfig);
284
+ /**
285
+ * The live team of one leader, rebuilt from its log on first touch. Nothing
286
+ * is resumed here: a teammate materializes only when a message reaches it.
287
+ * @param leader - the leader session's live agent.
288
+ * @returns the mutable live team state.
289
+ */
290
+ teamOf(leader: Agent): TeamState;
291
+ /**
292
+ * Adopt one continuable child into the team world while its scope is being
293
+ * composed. Called from the teammate setup contribution, which runs inside
294
+ * the child's unpublished creation window — on cold resume the child is
295
+ * already on the leader's roster, and only a child the roster has never seen
296
+ * can be the spawn currently in flight.
297
+ * @param child - the unpublished child agent.
298
+ * @returns the membership facts, or undefined for a child outside any team.
299
+ */
300
+ adopt(child: Agent): TeamMemberFact | undefined;
301
+ /**
302
+ * Spawn one teammate: a continuable subagent of the leader plus a roster row.
303
+ * @param leader - the acting leader agent.
304
+ * @param request - name, relation, initial task, and optional overrides.
305
+ * @param signal - cancellation owning the operation until the teammate accepts its brief.
306
+ * @returns the new member's durable facts.
307
+ * @throws {TeamError} when the actor cannot lead, or the roster is full.
308
+ */
309
+ spawn(leader: Agent, request: TeamSpawnRequest, signal: AbortSignal): Promise<TeamMemberFact>;
310
+ /**
311
+ * Deliver one mailbox message. The leader may message any teammate; a peer
312
+ * teammate may message the leader or any other teammate; a managed teammate
313
+ * may message only the leader.
314
+ *
315
+ * A teammate-to-teammate delivery also spends chain budget: it continues the
316
+ * conversation its sender is working from, and that conversation may only
317
+ * relay so far and may not repeat one ordered pair. Escalation to the leader
318
+ * spends nothing, so the guard converges a peer exchange without ever
319
+ * trapping a member with something to say.
320
+ * @param from - the acting agent (leader or teammate).
321
+ * @param to - recipient member id or member name; `leader` addresses the leader.
322
+ * @param text - the message content.
323
+ * @param signal - cancellation owning the delivery until inbox acceptance.
324
+ * @returns the accepted message id, the resolved recipient, and the chain it joined.
325
+ * @throws {TeamError} when the actor is outside the team, the recipient is
326
+ * unknown, the actor's relation forbids the delivery, or the conversation
327
+ * has spent its budget.
328
+ */
329
+ send(from: Agent, to: string, text: string, signal: AbortSignal): Promise<{
330
+ readonly messageId: string;
331
+ readonly recipient: Recipient;
332
+ readonly chain: TeamChain;
333
+ }>;
334
+ /**
335
+ * Create or update one shared task. Writes are the leader's: a teammate's
336
+ * own tool calls land in its own log, which the leader's durable team state
337
+ * never reads — teammates report, and the leader records the outcome.
338
+ * @param leader - the acting leader agent.
339
+ * @param spec - a new task (title) or an update to an existing one (taskId).
340
+ * @returns the whole post-change task.
341
+ * @throws {TeamError} when the actor is not the leader, the task is unknown,
342
+ * or the assignee is not on the roster.
343
+ */
344
+ upsertTask(leader: Agent, spec: {
345
+ readonly taskId?: string;
346
+ readonly title?: string;
347
+ readonly assigneeId?: string;
348
+ readonly status?: TeamTaskStatus;
349
+ readonly note?: string;
350
+ }): TeamTaskView;
351
+ /**
352
+ * Change one teammate's relationship level.
353
+ * @param leader - the acting leader agent.
354
+ * @param target - the teammate's member id or name.
355
+ * @param relation - the new relation.
356
+ * @returns the whole post-change member record.
357
+ * @throws {TeamError} when the actor is not the leader or the member is unknown.
358
+ */
359
+ setRelation(leader: Agent, target: string, relation: TeamRelation): TeamMemberFact;
360
+ /**
361
+ * Dismiss one teammate, or end the whole team when no target is given. A
362
+ * dismissed teammate stops its current turn and stops receiving mail; its
363
+ * durable session stays readable through the subagent catalog.
364
+ * @param leader - the acting leader agent.
365
+ * @param target - the teammate's member id or name; absent ends the team.
366
+ * @returns whether the team ended, plus the dismissed member id when targeted.
367
+ * @throws {TeamError} when the actor is not the leader or the member is unknown.
368
+ */
369
+ dismiss(leader: Agent, target?: string): {
370
+ readonly ended: boolean;
371
+ readonly memberId?: string;
372
+ };
373
+ /**
374
+ * The roster, task list, and recent leader-visible mailbox traffic, from the
375
+ * point of view of any member of the team.
376
+ * @param actorAgent - the acting leader or teammate.
377
+ * @returns the live team read; an inactive team reports empty lists.
378
+ */
379
+ list(actorAgent: Agent): TeamListResult;
380
+ /**
381
+ * Where one acting agent sits in its team: whose workspace it reaches, and
382
+ * how a note it writes is attributed. The leader's own seat carries its
383
+ * session id, so its private pad is addressed exactly like a teammate's.
384
+ * @param agent - the acting leader or teammate.
385
+ * @returns the team's leader id, the actor's own id, and its display name.
386
+ * @throws {TeamError} when the actor is not in a team.
387
+ */
388
+ seatOf(agent: Agent): TeamSeat;
389
+ /**
390
+ * The teammate roster as one teammate should see it, for its prompt section.
391
+ * @param member - the teammate agent.
392
+ * @returns the leader-relative roster, or undefined outside a team.
393
+ */
394
+ rosterFor(member: Agent): {
395
+ readonly self: TeamMemberFact;
396
+ readonly others: readonly TeamMemberFact[];
397
+ } | undefined;
398
+ /** The durable view the leader's log folds to (the projection registry's cached cut). */
399
+ private durableView;
400
+ /** Live runtime state of one teammate; `ready` means no live agent remains. */
401
+ private statusOf;
402
+ /**
403
+ * Resolve the acting agent's team, or fail loud — and say WHICH failure it
404
+ * is. A teammate whose leader session is simply not loaded is not a teammate
405
+ * without a team: every delivery runs on the leader's parent authority, so
406
+ * the mailbox is shut until the leader is back, while the workspace (which
407
+ * needs nobody) stays open. Telling it "no team here yet" would send it to
408
+ * spawn one, which it cannot do.
409
+ */
410
+ private resolveActor;
411
+ /** Resolve the acting agent's team, or report absence. */
412
+ private tryResolveActor;
413
+ /** Resolve one address (member id, member name, or `leader`) to a recipient. */
414
+ private resolveRecipient;
415
+ /**
416
+ * The chain one send belongs to. A teammate continues the conversation it is
417
+ * working from — that is what turns a peer exchange into one bounded
418
+ * conversation instead of an unbounded sequence of unrelated messages. The
419
+ * leader always opens a fresh chain: its own turns are the user-visible,
420
+ * interruptible convergence point, so a conversation that reached the leader
421
+ * has already converged and the next instruction starts over.
422
+ */
423
+ private chainFor;
424
+ /**
425
+ * Refuse a peer delivery this conversation can no longer afford: too many
426
+ * relays deep, one ordered pair talked out, or a verbatim repeat. Nothing
427
+ * here applies to a message addressed to the leader.
428
+ */
429
+ private assertBudget;
430
+ /** Charge one accepted peer delivery to its chain, and hand the chain on. */
431
+ private recordDelivery;
432
+ /** Deliver one message, choosing the transport the recipient's runtime requires. */
433
+ private deliver;
434
+ /**
435
+ * Reject a reasoning effort the selected model does not offer, at spawn
436
+ * rather than on the teammate's every later request. Validation needs an
437
+ * exact provider/model route: without one the adapter stays the authority.
438
+ */
439
+ private assertEffortOffered;
440
+ /**
441
+ * Stop one teammate's current work. Residency belongs to the continuation
442
+ * manager, so dismissal interrupts rather than disposes: an interrupted
443
+ * teammate settles on its own and its session stays readable.
444
+ */
445
+ private stopMember;
446
+ /** Service teardown: live teams are rebuilt from their logs on next touch. */
447
+ protected stop(): void;
448
+ }
449
+ //#endregion
450
+ //#region src/errors.d.ts
451
+ /**
452
+ * Team failures the model reads back as tool errors. One class with a closed
453
+ * code set: the code is the stable fact, the message is the sentence the model
454
+ * acts on.
455
+ *
456
+ * @module dsh-team/errors
457
+ */
458
+ /** Every way a team operation refuses. */
459
+ type TeamErrorCode = 'NO_TEAM' | 'LEADER_AWAY' | 'NESTED_TEAM' | 'MAX_TEAMMATES' | 'DUPLICATE_NAME' | 'UNKNOWN_MEMBER' | 'UNKNOWN_TASK' | 'TASK_TITLE_REQUIRED' | 'SELF_MESSAGE' | 'UNAUTHORIZED' | 'UNKNOWN_EFFORT' | 'CHAIN_EXHAUSTED' | 'PING_PONG' | 'REPEATED_MESSAGE' | 'INVALID_NOTE_KEY' | 'NOTE_TOO_LONG' | 'WORKSPACE_FULL' | 'UNKNOWN_NOTE';
460
+ /** One refused team operation. */
461
+ declare class TeamError extends Error {
462
+ readonly code: TeamErrorCode;
463
+ readonly detail?: string | undefined;
464
+ /**
465
+ * @param code - the stable refusal code.
466
+ * @param detail - the caller-specific part appended to the stable sentence.
467
+ */
468
+ constructor(code: TeamErrorCode, detail?: string | undefined);
469
+ }
470
+ //#endregion
471
+ //#region src/projection.d.ts
472
+ /**
473
+ * Build the projection unit for one deployment's mailbox bound.
474
+ * @param maxRecentMessages - feed ceiling from the row config.
475
+ * @returns the registrable unit.
476
+ */
477
+ declare function teamProjection(maxRecentMessages: number): ProjectionDefinition<'team', TeamView>;
478
+ //#endregion
479
+ //#region src/workspace.d.ts
480
+ /** The shared area's stable id; every other area id is a member's session id. */
481
+ declare const SHARED_AREA = "shared";
482
+ /** One stored note, whole: the record IS the entity, never a delta. */
483
+ declare const entrySchema: z$1.ZodObject<{
484
+ leaderId: z$1.ZodString;
485
+ area: z$1.ZodString;
486
+ key: z$1.ZodString;
487
+ text: z$1.ZodString;
488
+ authorId: z$1.ZodString;
489
+ authorName: z$1.ZodString;
490
+ updatedAt: z$1.ZodNumber;
491
+ }, z$1.core.$strip>;
492
+ /** One stored note. */
493
+ type WorkspaceEntry = z$1.infer<typeof entrySchema>;
494
+ /** The domain this plugin owns: one table of notes across every team. */
495
+ declare const WORKSPACE_DOMAIN: {
496
+ name: string;
497
+ version: number;
498
+ tables: {
499
+ entries: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
500
+ leaderId: string;
501
+ area: string;
502
+ key: string;
503
+ text: string;
504
+ authorId: string;
505
+ authorName: string;
506
+ updatedAt: number;
507
+ }>;
508
+ };
509
+ };
510
+ /** Who is writing, as the note records them. */
511
+ interface NoteAuthor {
512
+ readonly id: string;
513
+ readonly name: string;
514
+ }
515
+ /**
516
+ * The team workspaces over one open storage domain. One instance serves every
517
+ * team in the process; records carry their own leader and area, so a read is a
518
+ * filter and no two teams can see each other's notes.
519
+ */
520
+ declare class TeamWorkspace {
521
+ private readonly config;
522
+ private readonly opening;
523
+ private disposed;
524
+ /**
525
+ * @param ctx - a context whose `storageDomain` is already resolved.
526
+ * @param config - the row config carrying the workspace bounds.
527
+ */
528
+ constructor(ctx: Context, config: TeamConfig);
529
+ /**
530
+ * Read one area of one team's workspace, newest first.
531
+ * @param leaderId - the team's leader session id.
532
+ * @param area - {@link SHARED_AREA} or a member's session id.
533
+ * @returns the notes in that area.
534
+ */
535
+ read(leaderId: string, area: string): Promise<readonly WorkspaceEntry[]>;
536
+ /**
537
+ * Write one note, replacing whatever the key held.
538
+ * @param leaderId - the team's leader session id.
539
+ * @param area - {@link SHARED_AREA} or the author's own session id.
540
+ * @param key - the note's name, as the model gave it.
541
+ * @param text - the whole note body.
542
+ * @param author - who is writing.
543
+ * @param now - epoch ms recorded on the note.
544
+ * @returns the stored note.
545
+ * @throws {TeamError} on an unusable key, an oversized note, or a full area.
546
+ */
547
+ write(leaderId: string, area: string, key: string, text: string, author: NoteAuthor, now: number): Promise<WorkspaceEntry>;
548
+ /**
549
+ * Drop one note.
550
+ * @param leaderId - the team's leader session id.
551
+ * @param area - the area holding it.
552
+ * @param key - the note's name.
553
+ * @throws {TeamError} when no note of that name is in the area.
554
+ */
555
+ remove(leaderId: string, area: string, key: string): Promise<void>;
556
+ /**
557
+ * Drop everything one area holds — a dismissed member's private pad, or a
558
+ * disbanded team's whole workspace.
559
+ * @param leaderId - the team's leader session id.
560
+ * @param area - one area, or undefined for every area of this team.
561
+ */
562
+ clear(leaderId: string, area?: string): Promise<void>;
563
+ /**
564
+ * The shared area as the leader's durable projection carries it: names,
565
+ * attribution, and a one-line preview, never whole note bodies. A private
566
+ * pad is never projected — private means private, including from the panel.
567
+ * @param leaderId - the team's leader session id.
568
+ * @returns the board index, newest first.
569
+ */
570
+ index(leaderId: string): Promise<readonly TeamBoardEntryView[]>;
571
+ /** Release the domain handle; queued writes drain first. */
572
+ dispose(): void;
573
+ }
574
+ //#endregion
575
+ //#region src/index.d.ts
576
+ declare const name = "team";
577
+ /**
578
+ * `tools` and `systemPrompt` are declared although this row registers into
579
+ * agent scopes rather than the root registry: a Loader ordering mistake then
580
+ * fails at load instead of at the next session or teammate.
581
+ */
582
+ declare const inject: string[];
583
+ /**
584
+ * Compose the team capability: the service, the durable projection unit, the
585
+ * teammate world, the per-session leader tools, and the virtual workspaces.
586
+ * @param ctx - the row's context.
587
+ * @param config - the validated row configuration.
588
+ */
589
+ declare function apply(ctx: Context, config: TeamConfig): void;
590
+ //#endregion
591
+ export { Config, EMPTY_TEAM_VIEW, SHARED_AREA, TEAM_PROJECTION_KEY, TeamBoardEntryView, TeamChain, type TeamConfig, TeamError, type TeamErrorCode, type TeamFact, type TeamMemberFact, TeamMemberView, TeamMessageKind, TeamMessageSource, TeamMessageView, TeamRelation, TeamService, TeamTaskStatus, TeamTaskView, TeamView, TeamWorkspace, WORKSPACE_DOMAIN, type WorkspaceEntry, apply, foldTeam, inject, name, teamProjection };