@khorsheed/dsh-room 0.2.3 → 0.2.5

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 (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/lib/client.js +2309 -1127
  3. package/lib/index.js +572 -36
  4. package/lib/typert.host.js +249 -65
  5. package/lib/typert.remote-client.d.ts +4 -1
  6. package/lib/typert.remote-client.js +208 -53
  7. package/lib/types/client/InviteDialog.js +11 -4
  8. package/lib/types/client/RoomAttachments.d.ts +20 -0
  9. package/lib/types/client/RoomAttachments.js +36 -0
  10. package/lib/types/client/RoomComposer.d.ts +6 -12
  11. package/lib/types/client/RoomComposer.js +116 -12
  12. package/lib/types/client/RoomQuestionView.d.ts +10 -2
  13. package/lib/types/client/RoomQuestionView.js +18 -5
  14. package/lib/types/client/RoomRunView.d.ts +1 -1
  15. package/lib/types/client/RoomRunView.js +15 -5
  16. package/lib/types/client/RoomSpeechView.d.ts +24 -1
  17. package/lib/types/client/RoomSpeechView.js +39 -3
  18. package/lib/types/client/RoomStatsLine.d.ts +3 -1
  19. package/lib/types/client/RoomStatsLine.js +3 -1
  20. package/lib/types/client/RoomTaskCapsule.d.ts +6 -1
  21. package/lib/types/client/RoomTaskCapsule.js +2 -2
  22. package/lib/types/client/TasksView.js +1 -1
  23. package/lib/types/client/TeamView.js +1 -1
  24. package/lib/types/client/icons.d.ts +2 -1
  25. package/lib/types/client/icons.js +1 -0
  26. package/lib/types/client/index.js +94 -15
  27. package/lib/types/client/locales.d.ts +44 -0
  28. package/lib/types/client/locales.js +44 -0
  29. package/lib/types/client/nodes.d.ts +22 -3
  30. package/lib/types/client/nodes.js +28 -5
  31. package/lib/types/client/path-mentions.d.ts +34 -0
  32. package/lib/types/client/path-mentions.js +39 -0
  33. package/lib/types/client/slots.d.ts +51 -1
  34. package/lib/types/dispatch.d.ts +60 -0
  35. package/lib/types/dispatch.js +136 -1
  36. package/lib/types/index.d.ts +69 -1
  37. package/lib/types/index.js +368 -20
  38. package/lib/types/jobs.js +7 -3
  39. package/lib/types/journal.d.ts +1 -1
  40. package/lib/types/journal.js +18 -2
  41. package/lib/types/types.d.ts +77 -0
  42. package/package.json +10 -6
  43. package/lib/journal-B4FOGO6S.js +0 -482
  44. package/lib/journal-BWL3-i0s.js +0 -462
  45. package/lib/journal-Rid9AAnD.js +0 -485
@@ -7,7 +7,7 @@ import { SessionId } from '@deepseek-ai/dsh-session';
7
7
  import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
8
8
  import { DispatchEngine } from './dispatch.ts';
9
9
  import type { Agent } from '@deepseek-ai/dsh-agent';
10
- import type { RoomHelpLinkRequest, RoomHelpLinkResult, RoomCancelRequest, RoomCancelResult, RoomPrepareMemberRequest, RoomPrepareMemberResult, RoomFailure, RoomSetCoordinatorRequest, RoomSetCoordinatorResult, RoomReconcileDeliveryRequest, RoomReconcileDeliveryResult, RoomGetStateRequest, RoomGetStateResult, RoomInviteRequest, RoomInviteResult, RoomIsRoomRequest, RoomListProvidersRequest, RoomMemberMessage, RoomMemberMessageReceipt, RoomMessageRequest, RoomReleaseReportsRequest, RoomReleaseReportsResult, RoomSetTaskHintRequest, RoomStopJobRequest, RoomStopJobResult, RoomMessageResult, RoomSetSettingsRequest, RoomSetSettingsResult, RoomPostMessageRequest, RoomPostMessageResult, RoomProviderList, RoomRelayResolveRequest, RoomRelayResolveResult, RoomRemoveMemberRequest, RoomRemoveMemberResult, RoomRestoreMemberRequest, RoomRestoreMemberResult, RoomSetGoalRequest, RoomSetGoalResult, RoomState, RoomUpdateMemberRequest, RoomUpdateMemberResult, RoomAnswerApprovalRequest, RoomAnswerApprovalResult, RoomAnswerQuestionRequest, RoomAnswerQuestionResult, RoomQuestionItem } from './types.ts';
10
+ import type { RoomHelpLinkRequest, RoomHelpLinkResult, RoomCancelRequest, RoomCancelResult, RoomPrepareMemberRequest, RoomPrepareMemberResult, RoomFailure, RoomSetCoordinatorRequest, RoomSetCoordinatorResult, RoomReconcileDeliveryRequest, RoomReconcileDeliveryResult, RoomGetStateRequest, RoomGetStateResult, RoomInviteRequest, RoomInviteResult, RoomIsRoomRequest, RoomListProvidersRequest, RoomMemberMessage, RoomMemberMessageReceipt, RoomMessageRequest, RoomReleaseReportsRequest, RoomReleaseReportsResult, RoomSetTaskHintRequest, RoomStopJobRequest, RoomStopJobResult, RoomMessageResult, RoomSetSettingsRequest, RoomSetSettingsResult, RoomPostMessageRequest, RoomPostMessageResult, RoomDispatchAttachment, RoomPendingCard, RoomPendingCardsRequest, RoomProviderList, RoomRelayResolveRequest, RoomRelayResolveResult, RoomRemoveMemberRequest, RoomRemoveMemberResult, RoomRestoreMemberRequest, RoomRestoreMemberResult, RoomSetGoalRequest, RoomSetGoalResult, RoomState, RoomUpdateMemberRequest, RoomUpdateMemberResult, RoomAnswerApprovalRequest, RoomAnswerApprovalResult, RoomAnswerQuestionRequest, RoomAnswerQuestionResult, RoomQuestionAnswer, RoomQuestionItem } from './types.ts';
11
11
  export type * from './types.ts';
12
12
  export { MAIN_AGENT_MEMBER, ROOM_EVENT_TYPES } from './journal.ts';
13
13
  declare module '@deepseek-ai/cordis' {
@@ -39,6 +39,23 @@ type RoomLoad = {
39
39
  * @returns the questions, or the error text the model reads.
40
40
  */
41
41
  export declare function parseQuestions(raw: unknown): readonly RoomQuestionItem[] | string;
42
+ /**
43
+ * The message a late answer reaches its member as: each question with the
44
+ * human's pick, so the member can go on (or correct what it assumed).
45
+ * @param questions - the card's questions.
46
+ * @param answers - the human's answers, one per question.
47
+ * @returns the dispatch text.
48
+ */
49
+ export declare function lateAnswerText(questions: readonly RoomQuestionItem[], answers: readonly RoomQuestionAnswer[]): string;
50
+ /**
51
+ * The dispatch text with the message's attachments appended as local paths:
52
+ * every member — CLI or native — opens them with its own read tool, so one
53
+ * form reaches all of them.
54
+ * @param text - the dispatched text.
55
+ * @param attachments - the admitted attachments.
56
+ * @returns the text members receive.
57
+ */
58
+ export declare function withAttachmentPaths(text: string, attachments: readonly RoomDispatchAttachment[] | undefined): string;
42
59
  /**
43
60
  * What a new coordinator reads once, on its first round: who handed over,
44
61
  * the goal and open tasks, and where to look. The conversation itself is
@@ -95,6 +112,36 @@ export declare class RoomService extends TypertRemoteService {
95
112
  * @param request - session identity.
96
113
  * @returns true when the session carries the marker (false for unknown sessions too).
97
114
  */
115
+ /** Run ids of the members working in each room (the session list's 运行中). */
116
+ private readonly activeRuns;
117
+ /** Question/approval cards waiting for the human, per room. */
118
+ private readonly waitingCards;
119
+ /**
120
+ * Follow a room's run and card edges as they are journaled: a room turns
121
+ * running when its first member starts and settles when its last one ends
122
+ * (the host's `api-session/status`, so the list shows 运行中 and then
123
+ * 已完成), and its waiting cards are kept for {@link pendingCards}.
124
+ * @param session - the session the event landed in.
125
+ * @param event - the journaled event.
126
+ */
127
+ private observeActivity;
128
+ /**
129
+ * End the waits behind one member's open cards (its round settled): the
130
+ * question/approval calls resolve as unanswered, which journals them
131
+ * expired — still answerable, by a new message (answerExpiredQuestion).
132
+ * @param roomId - the room session.
133
+ * @param member - the member whose round ended.
134
+ */
135
+ private expireCardsOf;
136
+ /** Broadcast a room's running flip on the host's session-status channel. */
137
+ private emitStatus;
138
+ /**
139
+ * The question/approval cards waiting for the human across live rooms —
140
+ * the browser publishes them as the session list's 等你处理 status.
141
+ * @param request - optionally one room only.
142
+ * @returns the waiting cards.
143
+ */
144
+ pendingCards(request: RoomPendingCardsRequest): Promise<readonly RoomPendingCard[]>;
98
145
  isRoom(request: RoomIsRoomRequest): Promise<boolean>;
99
146
  /**
100
147
  * Resolve a session for a room WRITE, promoting it when it isn't a room
@@ -293,6 +340,16 @@ export declare class RoomService extends TypertRemoteService {
293
340
  * @returns the parse receipt, or a rejection.
294
341
  */
295
342
  postMessage(request: RoomPostMessageRequest): Promise<RoomPostMessageResult>;
343
+ /**
344
+ * Admit a human message's composer attachments the way the host's own
345
+ * prompt path does: file receipts resolve against this room session's
346
+ * uploads, images are stored, and every attachment becomes a durable
347
+ * content block for the message — plus the local path members read it by.
348
+ * @param sessionId - the room session (its agent owns the uploads).
349
+ * @param inputs - the wire attachments.
350
+ * @returns the content blocks, the dispatch records, and the receipt binder; or a refusal.
351
+ */
352
+ private admitAttachments;
296
353
  /**
297
354
  * Send one message from a member to another (host-only — the `room_message`
298
355
  * tool and the bridge's `member_message`/`room_message` land here; the
@@ -443,6 +500,17 @@ export declare class RoomService extends TypertRemoteService {
443
500
  * @returns ok, or `question-not-pending` when it already ended.
444
501
  */
445
502
  answerQuestion(request: RoomAnswerQuestionRequest): Promise<RoomAnswerQuestionResult>;
503
+ /**
504
+ * Answer a card whose waiting call is gone (it timed out, or a restart
505
+ * ended the member's process): the card records the answers, and they
506
+ * reach the member as a new message that wakes it with its own context —
507
+ * the member asked so it could go on, so a late answer is still worth it.
508
+ * A consent gate is never answered late: its call already decided.
509
+ * @param session - the live room session.
510
+ * @param request - card id and the human's answers.
511
+ * @returns ok, or `question-not-pending` when the card is not an expired, unanswered question.
512
+ */
513
+ private answerExpiredQuestion;
446
514
  /** Shared backend for external MCP room tools. Not exposed as a browser Remote. */
447
515
  receiveMemberCommand(actor: LocalAgentMemberRun, command: MemberRoomCommand): Promise<MemberMessageOutcome>;
448
516
  /**