@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
@@ -44,6 +44,7 @@ export const ROOM_EVENT_TYPES = [
44
44
  'room/dispatch',
45
45
  'room/speech',
46
46
  'room/run-state',
47
+ 'room/run-moved',
47
48
  'room/execution-metadata',
48
49
  'room/relay',
49
50
  'room/relay-resolved',
@@ -117,6 +118,7 @@ export function replay(events) {
117
118
  const relays = [];
118
119
  const approvals = new Map();
119
120
  const questions = new Map();
121
+ const asks = new Map();
120
122
  const relayById = new Map();
121
123
  const tasks = [];
122
124
  const taskById = new Map();
@@ -269,10 +271,24 @@ export function replay(events) {
269
271
  break;
270
272
  case 'room/question':
271
273
  questions.set(event.data.id, { id: event.data.id, member: event.data.member, questions: event.data.questions, time: event.time });
274
+ asks.set(event.data.id, {
275
+ id: event.data.id, member: event.data.member, questions: event.data.questions, state: 'pending', time: event.time,
276
+ ...event.data.runId === undefined ? {} : { runId: event.data.runId },
277
+ ...event.data.consent === true ? { consent: true } : {},
278
+ });
272
279
  break;
273
- case 'room/question-resolved':
280
+ case 'room/question-resolved': {
274
281
  questions.delete(event.data.id);
282
+ const ask = asks.get(event.data.id);
283
+ if (ask !== undefined) {
284
+ asks.set(ask.id, {
285
+ ...ask, state: event.data.outcome,
286
+ ...event.data.answers === undefined ? {} : { answers: event.data.answers },
287
+ ...event.data.late === true ? { late: true } : {},
288
+ });
289
+ }
275
290
  break;
291
+ }
276
292
  case 'room/approval-resolved':
277
293
  approvals.delete(event.data.id);
278
294
  break;
@@ -395,7 +411,7 @@ export function replay(events) {
395
411
  return {
396
412
  ...helps.length === 0 ? {} : { helps },
397
413
  ...links.linked.length === 0 ? {} : { linked: links.linked },
398
- ...links.nudgesDismissed.length === 0 ? {} : { helpNudgesDismissed: links.nudgesDismissed }, members, relays, ...approvals.size === 0 ? {} : { approvals: [...approvals.values()] }, ...questions.size === 0 ? {} : { questions: [...questions.values()] }, tasks, ...executions.size === 0 ? {} : { executions: [...executions.values()] }, ...plan === undefined ? {} : { plan }, ...deliveries.length === 0 ? {} : { deliveries }, runs: [...runs.values()], ...coordinator === undefined ? {} : { coordinator }, ...goal === undefined ? {} : { goal }, ...latestReplySeq === undefined ? {} : { latestReplySeq }, ...latestSpeechSeq === undefined ? {} : { latestSpeechSeq }, settings, ...jobs.length === 0 ? {} : { jobs }
414
+ ...links.nudgesDismissed.length === 0 ? {} : { helpNudgesDismissed: links.nudgesDismissed }, members, relays, ...approvals.size === 0 ? {} : { approvals: [...approvals.values()] }, ...questions.size === 0 ? {} : { questions: [...questions.values()] }, ...asks.size === 0 ? {} : { askLog: [...asks.values()] }, tasks, ...executions.size === 0 ? {} : { executions: [...executions.values()] }, ...plan === undefined ? {} : { plan }, ...deliveries.length === 0 ? {} : { deliveries }, runs: [...runs.values()], ...coordinator === undefined ? {} : { coordinator }, ...goal === undefined ? {} : { goal }, ...latestReplySeq === undefined ? {} : { latestReplySeq }, ...latestSpeechSeq === undefined ? {} : { latestSpeechSeq }, settings, ...jobs.length === 0 ? {} : { jobs }
399
415
  };
400
416
  }
401
417
  /**
@@ -133,6 +133,8 @@ export interface RoomMemberRemovedEvent {
133
133
  * log.
134
134
  */
135
135
  export interface RoomDispatchEvent {
136
+ /** The human message's admitted attachments, re-sent with the text on a retry. */
137
+ readonly attachments?: readonly RoomDispatchAttachment[];
136
138
  /** Goal work/report correlation, absent for ordinary chat. */
137
139
  readonly plan?: {
138
140
  readonly goalId: string;
@@ -209,6 +211,11 @@ export interface RoomSpeechEvent {
209
211
  readonly reportedTo?: string;
210
212
  readonly member: string;
211
213
  readonly text: string;
214
+ /** Questions the round asked, at their offsets in `text` (-1 = no split point found: shown first, marked mid-round). */
215
+ readonly asks?: readonly {
216
+ readonly id: string;
217
+ readonly at: number;
218
+ }[];
212
219
  readonly childSessionId?: SessionId;
213
220
  /** Native admission→settle milliseconds, excluding queue time. */
214
221
  readonly durationMs?: number;
@@ -235,6 +242,11 @@ export interface RoomRunUsage {
235
242
  readonly reasoningTokens?: number;
236
243
  }
237
244
  /** A member run's lifecycle edge. */
245
+ /** A running member's card moves to the bottom of the conversation; its run is untouched. */
246
+ export interface RoomRunMovedEvent {
247
+ readonly member: string;
248
+ readonly startedAt: number;
249
+ }
238
250
  export interface RoomRunStateEvent {
239
251
  readonly childSessionId?: SessionId;
240
252
  /** The child session's round this run reached (the last turn/start it wrote); terminal edges only, live sessions only. */
@@ -489,6 +501,12 @@ export interface RoomQuestionEvent {
489
501
  readonly member: string;
490
502
  readonly memberId: string;
491
503
  readonly questions: readonly RoomQuestionItem[];
504
+ /** The asker's round (its run id): the question renders inside that round's card and reply. */
505
+ readonly runId?: string;
506
+ /** The tail of what the round had said when it asked — where the reply splits around the question. */
507
+ readonly before?: string;
508
+ /** A consent gate (room_help's 允许/不允许): its answer only matters while the call waits, so it is never answered late. */
509
+ readonly consent?: true;
492
510
  }
493
511
  /** How a member's questions ended. */
494
512
  export interface RoomQuestionResolvedEvent {
@@ -496,6 +514,20 @@ export interface RoomQuestionResolvedEvent {
496
514
  /** `cancelled`: the call ended, timed out, or the host restarted before an answer. */
497
515
  readonly outcome: 'answered' | 'cancelled';
498
516
  readonly answers?: readonly RoomQuestionAnswer[];
517
+ /** Answered after the card expired: the answers went to the member as a new message instead of its (gone) waiting call. */
518
+ readonly late?: true;
519
+ }
520
+ /** Every question card the room has seen, with its outcome — inline question blocks read it. */
521
+ export interface RoomAsk {
522
+ readonly id: string;
523
+ readonly member: string;
524
+ readonly questions: readonly RoomQuestionItem[];
525
+ readonly state: 'pending' | 'answered' | 'cancelled';
526
+ readonly answers?: readonly RoomQuestionAnswer[];
527
+ readonly late?: true;
528
+ readonly consent?: true;
529
+ readonly runId?: string;
530
+ readonly time: number;
499
531
  }
500
532
  /** A member's questions still waiting for the human. */
501
533
  export interface RoomQuestion {
@@ -696,6 +728,8 @@ declare module '@deepseek-ai/dsh-session/types' {
696
728
  'room/speech': RoomSpeechEvent;
697
729
  /** Member run lifecycle. */
698
730
  'room/run-state': RoomRunStateEvent;
731
+ /** A running member's card re-anchors below a reply or human message that landed after it (presentation only). */
732
+ 'room/run-moved': RoomRunMovedEvent;
699
733
  /** Log-only observed metadata for a single execution. */
700
734
  'room/execution-metadata': RoomExecutionMetadataEvent;
701
735
  /** Notification gate: a member-to-member relay arrived (pending). */
@@ -829,6 +863,8 @@ export interface RoomExecution extends RoomMemberRun {
829
863
  * design note).
830
864
  */
831
865
  export interface RoomState {
866
+ /** All question cards with their outcomes (inline blocks in run cards and replies). */
867
+ readonly askLog?: readonly RoomAsk[];
832
868
  readonly executions?: readonly RoomExecution[];
833
869
  readonly plan?: Omit<RoomPlan, 'requests'>;
834
870
  readonly deliveries?: readonly RoomDelivery[];
@@ -904,6 +940,11 @@ export type RoomFailure = {
904
940
  } | {
905
941
  readonly code: 'empty-text';
906
942
  }
943
+ /** An attachment was refused (not uploaded to this room, too large, an unsupported image…). */
944
+ | {
945
+ readonly code: 'attachment-invalid';
946
+ readonly message: string;
947
+ }
907
948
  /** The public role is longer than 30 characters. */
908
949
  | {
909
950
  readonly code: 'role-too-long';
@@ -1002,6 +1043,16 @@ export interface RoomMemberMessage {
1002
1043
  */
1003
1044
  export type RoomMemberMessageReceipt = 'sent' | 'pending-confirm' | 'busy' | `sent ${string}` | `pending-confirm ${string}`;
1004
1045
  /** isRoom probe: does this session carry the room marker? */
1046
+ /** pendingCards request: no arguments (every live room the host knows). */
1047
+ export interface RoomPendingCardsRequest {
1048
+ readonly sessionId?: SessionId;
1049
+ }
1050
+ /** One question/approval card waiting for the human in a room (the session list's 「等你处理」). */
1051
+ export interface RoomPendingCard {
1052
+ readonly sessionId: string;
1053
+ readonly id: string;
1054
+ readonly kind: 'question' | 'approval';
1055
+ }
1005
1056
  export interface RoomIsRoomRequest {
1006
1057
  /** Session to probe. */
1007
1058
  readonly sessionId: SessionId;
@@ -1199,6 +1250,30 @@ export interface RoomPostMessageRequest {
1199
1250
  readonly targets?: readonly string[];
1200
1251
  /** The composer's task tag: `new` or a task root id (see RoomSetTaskHintRequest). */
1201
1252
  readonly task?: string;
1253
+ /**
1254
+ * Draft attachments in the official composer's wire form: an image's
1255
+ * base64 bytes, or a file's upload receipt (uploaded to this room session
1256
+ * on pick). The host admits them into the human message; members get them
1257
+ * by local path.
1258
+ */
1259
+ readonly attachments?: readonly RoomAttachmentInput[];
1260
+ }
1261
+ /** One composer attachment as it crosses the wire (the official prompt part shape). */
1262
+ export type RoomAttachmentInput = {
1263
+ readonly type: 'image';
1264
+ readonly data: string;
1265
+ readonly mediaType: string;
1266
+ readonly name?: string;
1267
+ } | {
1268
+ readonly type: 'file';
1269
+ readonly receiptId: string;
1270
+ };
1271
+ /** An admitted attachment as a dispatch records it: what members are told to read. */
1272
+ export interface RoomDispatchAttachment {
1273
+ readonly kind: 'image' | 'file';
1274
+ readonly name?: string;
1275
+ /** Absolute host path; absent when the attachment store is not file-backed. */
1276
+ readonly path?: string;
1202
1277
  }
1203
1278
  /** What the postMessage parser made of the raw text. */
1204
1279
  export interface RoomPostParsed {
@@ -1472,10 +1547,12 @@ export interface RoomJob {
1472
1547
  /** 1-based ordinal in the room, for 「任务 N」 and the coordinator's `task` argument. */
1473
1548
  readonly number: number;
1474
1549
  readonly title: string;
1550
+ /** `from`: the member id a member/coordinator dispatch came from; absent = the human. */
1475
1551
  readonly messages: readonly {
1476
1552
  readonly id: string;
1477
1553
  readonly time: number;
1478
1554
  readonly text: string;
1555
+ readonly from?: string;
1479
1556
  readonly by?: RoomTaskLinkEvent['by'];
1480
1557
  readonly probability?: number;
1481
1558
  }[];
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "cordis",
8
8
  "multi-agent"
9
9
  ],
10
- "version": "0.2.3",
10
+ "version": "0.2.5",
11
11
  "type": "module",
12
12
  "main": "lib/index.js",
13
13
  "types": "lib/types/index.d.ts",
@@ -75,6 +75,7 @@
75
75
  "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
76
76
  "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
77
77
  "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
78
+ "@deepseek-ai/dsh-client-ui-sidebar-right": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
78
79
  "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
79
80
  "@deepseek-ai/dsh-llm": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
80
81
  "@deepseek-ai/dsh-session": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
@@ -85,9 +86,9 @@
85
86
  "@deepseek-ai/dsh-tool-todo": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
86
87
  "@deepseek-ai/dsh-tools": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
87
88
  "@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
88
- "@khorsheed/dsh-local-agent": "^0.2.0",
89
- "react": "^18.2.0",
90
- "@deepseek-ai/dsh-client-ui-sidebar-right": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1"
89
+ "@deepseek-ai/dsh-util-workspace-path": "^0.1.0-rc.6 || ^0.2.0-rc.1 || ^0.2.1-rc.1",
90
+ "@khorsheed/dsh-local-agent": "^0.2.2",
91
+ "react": "^18.2.0"
91
92
  },
92
93
  "peerDependenciesMeta": {
93
94
  "@deepseek-ai/dsh-agent-preset-registry": {
@@ -96,6 +97,9 @@
96
97
  "@deepseek-ai/dsh-agent-presets": {
97
98
  "optional": true
98
99
  },
100
+ "@deepseek-ai/dsh-client-ui-sidebar-right": {
101
+ "optional": true
102
+ },
99
103
  "@deepseek-ai/dsh-session-stats": {
100
104
  "optional": true
101
105
  },
@@ -105,10 +109,10 @@
105
109
  "@deepseek-ai/dsh-tool-todo": {
106
110
  "optional": true
107
111
  },
108
- "@khorsheed/dsh-local-agent": {
112
+ "@deepseek-ai/dsh-util-workspace-path": {
109
113
  "optional": true
110
114
  },
111
- "@deepseek-ai/dsh-client-ui-sidebar-right": {
115
+ "@khorsheed/dsh-local-agent": {
112
116
  "optional": true
113
117
  }
114
118
  },