@wowyuarm/dsh-agent-team 0.1.9 → 0.1.11

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 (119) hide show
  1. package/README.md +17 -11
  2. package/README.zh.md +17 -11
  3. package/package.json +61 -47
  4. package/packages/agent-team/README.md +6 -4
  5. package/packages/agent-team/README.zh.md +6 -3
  6. package/packages/agent-team/lib/context-management.js +48 -55
  7. package/packages/agent-team/lib/context-projection.js +22 -8
  8. package/packages/agent-team/lib/context-source.js +163 -23
  9. package/packages/agent-team/lib/index.js +349 -176
  10. package/packages/agent-team/lib/invariant.js +38 -4
  11. package/packages/agent-team/lib/ledger.js +658 -294
  12. package/packages/agent-team/lib/member-context.js +6 -2
  13. package/packages/agent-team/lib/member-time-context.js +141 -0
  14. package/packages/agent-team/lib/pressure-policy.js +34 -11
  15. package/packages/agent-team/lib/progress-nudge.js +12 -4
  16. package/packages/agent-team/lib/session-event-cursor.js +116 -0
  17. package/packages/agent-team/lib/session-remediation.js +493 -0
  18. package/packages/agent-team/lib/spec.js +49 -36
  19. package/packages/agent-team/lib/stored-session-reader.js +138 -0
  20. package/packages/agent-team/lib/time-format.js +56 -0
  21. package/packages/agent-team/lib/typert.host.js +163 -63
  22. package/packages/agent-team/lib/typert.remote-client.d.ts.map +1 -1
  23. package/packages/agent-team/lib/typert.remote-client.js +105 -32
  24. package/packages/agent-team/lib/types/context-management.d.ts +13 -1
  25. package/packages/agent-team/lib/types/context-management.d.ts.map +1 -1
  26. package/packages/agent-team/lib/types/context-projection.d.ts +8 -0
  27. package/packages/agent-team/lib/types/context-projection.d.ts.map +1 -1
  28. package/packages/agent-team/lib/types/context-source.d.ts +70 -36
  29. package/packages/agent-team/lib/types/context-source.d.ts.map +1 -1
  30. package/packages/agent-team/lib/types/index.d.ts +110 -9
  31. package/packages/agent-team/lib/types/index.d.ts.map +1 -1
  32. package/packages/agent-team/lib/types/invariant.d.ts.map +1 -1
  33. package/packages/agent-team/lib/types/ledger.d.ts +205 -7
  34. package/packages/agent-team/lib/types/ledger.d.ts.map +1 -1
  35. package/packages/agent-team/lib/types/member-context.d.ts.map +1 -1
  36. package/packages/agent-team/lib/types/member-time-context.d.ts +83 -0
  37. package/packages/agent-team/lib/types/member-time-context.d.ts.map +1 -0
  38. package/packages/agent-team/lib/types/pressure-policy.d.ts +18 -0
  39. package/packages/agent-team/lib/types/pressure-policy.d.ts.map +1 -1
  40. package/packages/agent-team/lib/types/progress-nudge.d.ts.map +1 -1
  41. package/packages/agent-team/lib/types/session-event-cursor.d.ts +119 -0
  42. package/packages/agent-team/lib/types/session-event-cursor.d.ts.map +1 -0
  43. package/packages/agent-team/lib/types/session-remediation.d.ts +172 -0
  44. package/packages/agent-team/lib/types/session-remediation.d.ts.map +1 -0
  45. package/packages/agent-team/lib/types/spec.d.ts.map +1 -1
  46. package/packages/agent-team/lib/types/stored-session-reader.d.ts +92 -0
  47. package/packages/agent-team/lib/types/stored-session-reader.d.ts.map +1 -0
  48. package/packages/agent-team/lib/types/time-format.d.ts +28 -0
  49. package/packages/agent-team/lib/types/time-format.d.ts.map +1 -0
  50. package/packages/agent-team/lib/types/types/entities.d.ts +36 -2
  51. package/packages/agent-team/lib/types/types/entities.d.ts.map +1 -1
  52. package/packages/agent-team/lib/types/types/operations.d.ts +45 -19
  53. package/packages/agent-team/lib/types/types/operations.d.ts.map +1 -1
  54. package/packages/agent-team/lib/types/types/requests-results.d.ts +50 -3
  55. package/packages/agent-team/lib/types/types/requests-results.d.ts.map +1 -1
  56. package/packages/agent-team/preset/team-member/agent.cordis.yml +21 -4
  57. package/packages/client-agent-team/README.md +1 -1
  58. package/packages/client-agent-team/README.zh.md +1 -1
  59. package/packages/client-agent-team/lib/client.js +1121 -402
  60. package/packages/client-agent-team/lib/client.js.map +1 -1
  61. package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.d.ts.map +1 -1
  62. package/packages/client-agent-team/lib/types/client/TeamAgentsPanel.js +24 -4
  63. package/packages/client-agent-team/lib/types/client/TeamChannelPage.d.ts.map +1 -1
  64. package/packages/client-agent-team/lib/types/client/TeamChannelPage.js +42 -22
  65. package/packages/client-agent-team/lib/types/client/TeamChannelsPanel.d.ts.map +1 -1
  66. package/packages/client-agent-team/lib/types/client/TeamChannelsPanel.js +13 -24
  67. package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts +11 -5
  68. package/packages/client-agent-team/lib/types/client/TeamComposer.d.ts.map +1 -1
  69. package/packages/client-agent-team/lib/types/client/TeamComposer.js +15 -9
  70. package/packages/client-agent-team/lib/types/client/TeamConversation.d.ts +1 -1
  71. package/packages/client-agent-team/lib/types/client/TeamConversation.d.ts.map +1 -1
  72. package/packages/client-agent-team/lib/types/client/TeamConversation.js +8 -1
  73. package/packages/client-agent-team/lib/types/client/TeamInboxPage.d.ts +21 -0
  74. package/packages/client-agent-team/lib/types/client/TeamInboxPage.d.ts.map +1 -0
  75. package/packages/client-agent-team/lib/types/client/TeamInboxPage.js +71 -0
  76. package/packages/client-agent-team/lib/types/client/TeamMemberEditor.d.ts.map +1 -1
  77. package/packages/client-agent-team/lib/types/client/TeamMemberEditor.js +8 -24
  78. package/packages/client-agent-team/lib/types/client/TeamMessage.d.ts +9 -2
  79. package/packages/client-agent-team/lib/types/client/TeamMessage.d.ts.map +1 -1
  80. package/packages/client-agent-team/lib/types/client/TeamMessage.js +13 -6
  81. package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts +8 -0
  82. package/packages/client-agent-team/lib/types/client/TeamPresenceDot.d.ts.map +1 -1
  83. package/packages/client-agent-team/lib/types/client/TeamPresenceDot.js +21 -1
  84. package/packages/client-agent-team/lib/types/client/TeamThreadPage.d.ts.map +1 -1
  85. package/packages/client-agent-team/lib/types/client/TeamThreadPage.js +106 -32
  86. package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.d.ts +1 -1
  87. package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.d.ts.map +1 -1
  88. package/packages/client-agent-team/lib/types/client/TeamWorkspaceBrowser.js +50 -7
  89. package/packages/client-agent-team/lib/types/client/index.d.ts.map +1 -1
  90. package/packages/client-agent-team/lib/types/client/index.js +25 -9
  91. package/packages/client-agent-team/lib/types/client/locales.d.ts +18 -0
  92. package/packages/client-agent-team/lib/types/client/locales.d.ts.map +1 -1
  93. package/packages/client-agent-team/lib/types/client/locales.js +18 -0
  94. package/packages/client-agent-team/lib/types/client/navigation.d.ts +10 -0
  95. package/packages/client-agent-team/lib/types/client/navigation.d.ts.map +1 -1
  96. package/packages/client-agent-team/lib/types/client/navigation.js +18 -7
  97. package/packages/client-agent-team/lib/types/client/scope-coverage.d.ts +41 -0
  98. package/packages/client-agent-team/lib/types/client/scope-coverage.d.ts.map +1 -0
  99. package/packages/client-agent-team/lib/types/client/scope-coverage.js +64 -0
  100. package/packages/client-agent-team/lib/types/client/slots.d.ts +8 -2
  101. package/packages/client-agent-team/lib/types/client/slots.d.ts.map +1 -1
  102. package/packages/client-agent-team/lib/types/client/team-changes.d.ts +26 -1
  103. package/packages/client-agent-team/lib/types/client/team-changes.d.ts.map +1 -1
  104. package/packages/client-agent-team/lib/types/client/team-changes.js +66 -15
  105. package/packages/client-agent-team/lib/types/client/team-dialog-save.d.ts +20 -0
  106. package/packages/client-agent-team/lib/types/client/team-dialog-save.d.ts.map +1 -0
  107. package/packages/client-agent-team/lib/types/client/team-dialog-save.js +36 -0
  108. package/packages/client-agent-team/lib/types/client/team-formatters.d.ts +9 -0
  109. package/packages/client-agent-team/lib/types/client/team-formatters.d.ts.map +1 -1
  110. package/packages/client-agent-team/lib/types/client/team-formatters.js +34 -6
  111. package/packages/tool-agent-team/README.md +8 -6
  112. package/packages/tool-agent-team/README.zh.md +8 -6
  113. package/packages/tool-agent-team/lib/context-tools.js +18 -14
  114. package/packages/tool-agent-team/lib/host-access.js +20 -0
  115. package/packages/tool-agent-team/lib/index.js +314 -123
  116. package/packages/tool-agent-team/lib/types/context-tools.d.ts.map +1 -1
  117. package/packages/tool-agent-team/lib/types/host-access.d.ts +14 -0
  118. package/packages/tool-agent-team/lib/types/host-access.d.ts.map +1 -0
  119. package/packages/tool-agent-team/lib/types/index.d.ts.map +1 -1
@@ -4102,7 +4102,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4102
4102
  "receipt": object({
4103
4103
  "operationId": intersection(string(), unknown()).readonly(),
4104
4104
  "requestId": intersection(string(), unknown()).readonly(),
4105
- "sequence": number().readonly()
4105
+ "sequence": number().readonly(),
4106
+ "occurredAt": string().readonly()
4106
4107
  }).readonly(),
4107
4108
  "status": object({
4108
4109
  "member": object({
@@ -4142,7 +4143,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4142
4143
  literal("working"),
4143
4144
  literal("error")
4144
4145
  ]).readonly(),
4145
- "diagnostic": string().readonly().optional(),
4146
+ "diagnostic": object({
4147
+ "class": union([
4148
+ literal("session-refused"),
4149
+ literal("session-unreadable"),
4150
+ literal("preset-composition"),
4151
+ literal("rollover"),
4152
+ literal("runtime"),
4153
+ literal("activation")
4154
+ ]).readonly(),
4155
+ "detail": string().readonly(),
4156
+ "location": object({
4157
+ "kind": string().readonly(),
4158
+ "path": string().readonly()
4159
+ }).readonly().optional(),
4160
+ "sessionId": intersection(string(), unknown()).readonly().optional(),
4161
+ "remediable": boolean().readonly().optional()
4162
+ }).readonly().optional(),
4146
4163
  "capabilityWarnings": union([_undefined(), array(object({
4147
4164
  "name": string().readonly(),
4148
4165
  "knownNames": array(string()).readonly()
@@ -4158,7 +4175,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4158
4175
  "receipt": object({
4159
4176
  "operationId": intersection(string(), unknown()).readonly(),
4160
4177
  "requestId": intersection(string(), unknown()).readonly(),
4161
- "sequence": number().readonly()
4178
+ "sequence": number().readonly(),
4179
+ "occurredAt": string().readonly()
4162
4180
  }).readonly(),
4163
4181
  "channel": object({
4164
4182
  "channelRef": intersection(string(), unknown()).readonly(),
@@ -4190,7 +4208,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4190
4208
  "receipt": object({
4191
4209
  "operationId": intersection(string(), unknown()).readonly(),
4192
4210
  "requestId": intersection(string(), unknown()).readonly(),
4193
- "sequence": number().readonly()
4211
+ "sequence": number().readonly(),
4212
+ "occurredAt": string().readonly()
4194
4213
  }).readonly(),
4195
4214
  "member": object({
4196
4215
  "memberId": intersection(string(), unknown()).readonly(),
@@ -4245,7 +4264,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4245
4264
  "receipt": object({
4246
4265
  "operationId": intersection(string(), unknown()).readonly(),
4247
4266
  "requestId": intersection(string(), unknown()).readonly(),
4248
- "sequence": number().readonly()
4267
+ "sequence": number().readonly(),
4268
+ "occurredAt": string().readonly()
4249
4269
  }).readonly(),
4250
4270
  "task": object({
4251
4271
  "taskRef": intersection(string(), unknown()).readonly(),
@@ -4290,6 +4310,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4290
4310
  object({
4291
4311
  "kind": literal("thread").readonly(),
4292
4312
  "threadRef": intersection(string(), unknown()).readonly()
4313
+ }),
4314
+ object({
4315
+ "kind": literal("presence").readonly(),
4316
+ "workspaceId": intersection(string(), unknown()).readonly()
4293
4317
  })
4294
4318
  ]).readonly().optional()
4295
4319
  });
@@ -4311,7 +4335,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4311
4335
  "receipt": object({
4312
4336
  "operationId": intersection(string(), unknown()).readonly(),
4313
4337
  "requestId": intersection(string(), unknown()).readonly(),
4314
- "sequence": number().readonly()
4338
+ "sequence": number().readonly(),
4339
+ "occurredAt": string().readonly()
4315
4340
  }).readonly(),
4316
4341
  "activity": object({
4317
4342
  "kind": union([
@@ -4390,7 +4415,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4390
4415
  "receipt": object({
4391
4416
  "operationId": intersection(string(), unknown()).readonly(),
4392
4417
  "requestId": intersection(string(), unknown()).readonly(),
4393
- "sequence": number().readonly()
4418
+ "sequence": number().readonly(),
4419
+ "occurredAt": string().readonly()
4394
4420
  }).readonly(),
4395
4421
  "status": object({
4396
4422
  "member": object({
@@ -4430,7 +4456,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4430
4456
  literal("working"),
4431
4457
  literal("error")
4432
4458
  ]).readonly(),
4433
- "diagnostic": string().readonly().optional(),
4459
+ "diagnostic": object({
4460
+ "class": union([
4461
+ literal("session-refused"),
4462
+ literal("session-unreadable"),
4463
+ literal("preset-composition"),
4464
+ literal("rollover"),
4465
+ literal("runtime"),
4466
+ literal("activation")
4467
+ ]).readonly(),
4468
+ "detail": string().readonly(),
4469
+ "location": object({
4470
+ "kind": string().readonly(),
4471
+ "path": string().readonly()
4472
+ }).readonly().optional(),
4473
+ "sessionId": intersection(string(), unknown()).readonly().optional(),
4474
+ "remediable": boolean().readonly().optional()
4475
+ }).readonly().optional(),
4434
4476
  "capabilityWarnings": union([_undefined(), array(object({
4435
4477
  "name": string().readonly(),
4436
4478
  "knownNames": array(string()).readonly()
@@ -4448,7 +4490,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4448
4490
  "receipt": object({
4449
4491
  "operationId": intersection(string(), unknown()).readonly(),
4450
4492
  "requestId": intersection(string(), unknown()).readonly(),
4451
- "sequence": number().readonly()
4493
+ "sequence": number().readonly(),
4494
+ "occurredAt": string().readonly()
4452
4495
  }).readonly(),
4453
4496
  "channel": object({
4454
4497
  "channelRef": intersection(string(), unknown()).readonly(),
@@ -4469,11 +4512,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4469
4512
  });
4470
4513
  const _wowyuarm_dsh_agent_team_agentTeam_inbox_parameter_0$schema = object({
4471
4514
  "workspaceId": intersection(string(), unknown()).readonly(),
4472
- "limit": number().readonly().optional()
4515
+ "limit": number().readonly().optional(),
4516
+ "directOnly": boolean().readonly().optional()
4473
4517
  });
4474
4518
  const _wowyuarm_dsh_agent_team_agentTeam_inbox_result$schema = object({
4475
4519
  "items": array(object({
4476
4520
  "channelRef": intersection(string(), unknown()).readonly(),
4521
+ "channelName": string().readonly().optional(),
4477
4522
  "task": object({
4478
4523
  "taskRef": intersection(string(), unknown()).readonly(),
4479
4524
  "channelRef": intersection(string(), unknown()).readonly(),
@@ -4491,6 +4536,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4491
4536
  literal("accepted")
4492
4537
  ]).readonly()
4493
4538
  }).readonly().optional(),
4539
+ "taskNumber": number().readonly().optional(),
4494
4540
  "thread": object({
4495
4541
  "threadRef": intersection(string(), unknown()).readonly(),
4496
4542
  "taskRef": intersection(string(), unknown()).readonly().optional(),
@@ -4498,7 +4544,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4498
4544
  }).readonly(),
4499
4545
  "unreadCount": number().readonly(),
4500
4546
  "directCount": number().readonly(),
4547
+ "previewText": string().readonly().optional(),
4501
4548
  "newestSequence": number().readonly(),
4549
+ "newestOccurredAt": string().readonly(),
4502
4550
  "attention": object({
4503
4551
  "memberId": intersection(string(), unknown()).readonly(),
4504
4552
  "threadRef": intersection(string(), unknown()).readonly(),
@@ -4519,7 +4567,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4519
4567
  "receipt": object({
4520
4568
  "operationId": intersection(string(), unknown()).readonly(),
4521
4569
  "requestId": intersection(string(), unknown()).readonly(),
4522
- "sequence": number().readonly()
4570
+ "sequence": number().readonly(),
4571
+ "occurredAt": string().readonly()
4523
4572
  }).readonly(),
4524
4573
  "channelRef": intersection(string(), unknown()).readonly(),
4525
4574
  "memberId": intersection(string(), unknown()).readonly()
@@ -4562,7 +4611,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4562
4611
  literal("working"),
4563
4612
  literal("error")
4564
4613
  ]).readonly(),
4565
- "diagnostic": string().readonly().optional(),
4614
+ "diagnostic": object({
4615
+ "class": union([
4616
+ literal("session-refused"),
4617
+ literal("session-unreadable"),
4618
+ literal("preset-composition"),
4619
+ literal("rollover"),
4620
+ literal("runtime"),
4621
+ literal("activation")
4622
+ ]).readonly(),
4623
+ "detail": string().readonly(),
4624
+ "location": object({
4625
+ "kind": string().readonly(),
4626
+ "path": string().readonly()
4627
+ }).readonly().optional(),
4628
+ "sessionId": intersection(string(), unknown()).readonly().optional(),
4629
+ "remediable": boolean().readonly().optional()
4630
+ }).readonly().optional(),
4566
4631
  "capabilityWarnings": union([_undefined(), array(object({
4567
4632
  "name": string().readonly(),
4568
4633
  "knownNames": array(string()).readonly()
@@ -4595,7 +4660,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4595
4660
  "receipt": object({
4596
4661
  "operationId": intersection(string(), unknown()).readonly(),
4597
4662
  "requestId": intersection(string(), unknown()).readonly(),
4598
- "sequence": number().readonly()
4663
+ "sequence": number().readonly(),
4664
+ "occurredAt": string().readonly()
4599
4665
  }).readonly(),
4600
4666
  "activity": object({
4601
4667
  "kind": union([
@@ -4661,8 +4727,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4661
4727
  "receipt": object({
4662
4728
  "operationId": intersection(string(), unknown()).readonly(),
4663
4729
  "requestId": intersection(string(), unknown()).readonly(),
4664
- "sequence": number().readonly()
4665
- }).readonly(),
4730
+ "sequence": number().readonly(),
4731
+ "occurredAt": string().readonly()
4732
+ }).readonly().optional(),
4666
4733
  "task": object({
4667
4734
  "taskRef": intersection(string(), unknown()).readonly(),
4668
4735
  "channelRef": intersection(string(), unknown()).readonly(),
@@ -4737,7 +4804,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4737
4804
  "sequence": number().readonly(),
4738
4805
  "occurredAt": string().readonly()
4739
4806
  }).readonly(),
4740
- "mentions": array(intersection(string(), unknown())).readonly()
4807
+ "mentions": array(intersection(string(), unknown())).readonly(),
4808
+ "occurredAt": string().readonly()
4741
4809
  }), object({
4742
4810
  "kind": literal("activity").readonly(),
4743
4811
  "sequence": number().readonly(),
@@ -4780,7 +4848,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4780
4848
  "actor": intersection(string(), unknown()).readonly(),
4781
4849
  "sequence": number().readonly()
4782
4850
  })
4783
- ]).readonly()
4851
+ ]).readonly(),
4852
+ "occurredAt": string().readonly()
4784
4853
  })]).readonly(),
4785
4854
  "unread": boolean().readonly(),
4786
4855
  "direct": boolean().readonly()
@@ -4806,8 +4875,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4806
4875
  "hardLimit": union([_undefined(), number()]).readonly().optional(),
4807
4876
  "action": union([
4808
4877
  literal("unavailable"),
4809
- literal("keep"),
4810
4878
  literal("rollover"),
4879
+ literal("keep"),
4811
4880
  literal("handoff-now")
4812
4881
  ]).readonly(),
4813
4882
  "guidance": string().readonly()
@@ -4856,7 +4925,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4856
4925
  literal("working"),
4857
4926
  literal("error")
4858
4927
  ]).readonly(),
4859
- "diagnostic": string().readonly().optional(),
4928
+ "diagnostic": object({
4929
+ "class": union([
4930
+ literal("session-refused"),
4931
+ literal("session-unreadable"),
4932
+ literal("preset-composition"),
4933
+ literal("rollover"),
4934
+ literal("runtime"),
4935
+ literal("activation")
4936
+ ]).readonly(),
4937
+ "detail": string().readonly(),
4938
+ "location": object({
4939
+ "kind": string().readonly(),
4940
+ "path": string().readonly()
4941
+ }).readonly().optional(),
4942
+ "sessionId": intersection(string(), unknown()).readonly().optional(),
4943
+ "remediable": boolean().readonly().optional()
4944
+ }).readonly().optional(),
4860
4945
  "capabilityWarnings": union([_undefined(), array(object({
4861
4946
  "name": string().readonly(),
4862
4947
  "knownNames": array(string()).readonly()
@@ -4872,7 +4957,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4872
4957
  "receipt": object({
4873
4958
  "operationId": intersection(string(), unknown()).readonly(),
4874
4959
  "requestId": intersection(string(), unknown()).readonly(),
4875
- "sequence": number().readonly()
4960
+ "sequence": number().readonly(),
4961
+ "occurredAt": string().readonly()
4876
4962
  }).readonly(),
4877
4963
  "channelRef": intersection(string(), unknown()).readonly(),
4878
4964
  "memberId": intersection(string(), unknown()).readonly(),
@@ -4946,7 +5032,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
4946
5032
  "receipt": object({
4947
5033
  "operationId": intersection(string(), unknown()).readonly(),
4948
5034
  "requestId": intersection(string(), unknown()).readonly(),
4949
- "sequence": number().readonly()
5035
+ "sequence": number().readonly(),
5036
+ "occurredAt": string().readonly()
4950
5037
  }).readonly(),
4951
5038
  "message": object({
4952
5039
  "messageRef": intersection(string(), unknown()).readonly(),
@@ -5028,7 +5115,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5028
5115
  "receipt": object({
5029
5116
  "operationId": intersection(string(), unknown()).readonly(),
5030
5117
  "requestId": intersection(string(), unknown()).readonly(),
5031
- "sequence": number().readonly()
5118
+ "sequence": number().readonly(),
5119
+ "occurredAt": string().readonly()
5032
5120
  }).readonly(),
5033
5121
  "message": object({
5034
5122
  "messageRef": intersection(string(), unknown()).readonly(),
@@ -5183,7 +5271,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5183
5271
  "sequence": number().readonly(),
5184
5272
  "occurredAt": string().readonly()
5185
5273
  }).readonly(),
5186
- "mentions": array(intersection(string(), unknown())).readonly()
5274
+ "mentions": array(intersection(string(), unknown())).readonly(),
5275
+ "occurredAt": string().readonly()
5187
5276
  }), object({
5188
5277
  "kind": literal("activity").readonly(),
5189
5278
  "sequence": number().readonly(),
@@ -5226,7 +5315,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5226
5315
  "actor": intersection(string(), unknown()).readonly(),
5227
5316
  "sequence": number().readonly()
5228
5317
  })
5229
- ]).readonly()
5318
+ ]).readonly(),
5319
+ "occurredAt": string().readonly()
5230
5320
  })])).readonly(),
5231
5321
  "cursor": number().readonly(),
5232
5322
  "hasMore": boolean().readonly()
@@ -5258,7 +5348,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5258
5348
  "receipt": object({
5259
5349
  "operationId": intersection(string(), unknown()).readonly(),
5260
5350
  "requestId": intersection(string(), unknown()).readonly(),
5261
- "sequence": number().readonly()
5351
+ "sequence": number().readonly(),
5352
+ "occurredAt": string().readonly()
5262
5353
  }).readonly(),
5263
5354
  "channel": object({
5264
5355
  "channelRef": intersection(string(), unknown()).readonly(),
@@ -5288,7 +5379,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5288
5379
  "receipt": object({
5289
5380
  "operationId": intersection(string(), unknown()).readonly(),
5290
5381
  "requestId": intersection(string(), unknown()).readonly(),
5291
- "sequence": number().readonly()
5382
+ "sequence": number().readonly(),
5383
+ "occurredAt": string().readonly()
5292
5384
  }).readonly(),
5293
5385
  "status": object({
5294
5386
  "member": object({
@@ -5328,7 +5420,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5328
5420
  literal("working"),
5329
5421
  literal("error")
5330
5422
  ]).readonly(),
5331
- "diagnostic": string().readonly().optional(),
5423
+ "diagnostic": object({
5424
+ "class": union([
5425
+ literal("session-refused"),
5426
+ literal("session-unreadable"),
5427
+ literal("preset-composition"),
5428
+ literal("rollover"),
5429
+ literal("runtime"),
5430
+ literal("activation")
5431
+ ]).readonly(),
5432
+ "detail": string().readonly(),
5433
+ "location": object({
5434
+ "kind": string().readonly(),
5435
+ "path": string().readonly()
5436
+ }).readonly().optional(),
5437
+ "sessionId": intersection(string(), unknown()).readonly().optional(),
5438
+ "remediable": boolean().readonly().optional()
5439
+ }).readonly().optional(),
5332
5440
  "capabilityWarnings": union([_undefined(), array(object({
5333
5441
  "name": string().readonly(),
5334
5442
  "knownNames": array(string()).readonly()
@@ -5427,7 +5535,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5427
5535
  "revision": number().readonly()
5428
5536
  }).readonly(),
5429
5537
  "taskNumber": number().readonly().optional(),
5430
- "messageCount": number().readonly()
5538
+ "messageCount": number().readonly(),
5539
+ "lastActivityAt": string().readonly()
5431
5540
  })).readonly(),
5432
5541
  "claims": array(object({
5433
5542
  "claimRef": intersection(string(), unknown()).readonly(),
@@ -5511,7 +5620,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5511
5620
  },
5512
5621
  sourceLocation: {
5513
5622
  "file": "packages/agent-team/src/index.ts",
5514
- "line": 616,
5623
+ "line": 718,
5515
5624
  "column": 9
5516
5625
  }
5517
5626
  },
@@ -5538,7 +5647,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5538
5647
  },
5539
5648
  sourceLocation: {
5540
5649
  "file": "packages/agent-team/src/index.ts",
5541
- "line": 606,
5650
+ "line": 708,
5542
5651
  "column": 9
5543
5652
  }
5544
5653
  },
@@ -5565,7 +5674,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5565
5674
  },
5566
5675
  sourceLocation: {
5567
5676
  "file": "packages/agent-team/src/index.ts",
5568
- "line": 987,
5677
+ "line": 1105,
5569
5678
  "column": 9
5570
5679
  }
5571
5680
  },
@@ -5592,7 +5701,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5592
5701
  },
5593
5702
  sourceLocation: {
5594
5703
  "file": "packages/agent-team/src/index.ts",
5595
- "line": 1109,
5704
+ "line": 1227,
5596
5705
  "column": 9
5597
5706
  }
5598
5707
  },
@@ -5620,7 +5729,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5620
5729
  },
5621
5730
  sourceLocation: {
5622
5731
  "file": "packages/agent-team/src/index.ts",
5623
- "line": 538,
5732
+ "line": 639,
5624
5733
  "column": 9
5625
5734
  }
5626
5735
  },
@@ -5647,7 +5756,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5647
5756
  },
5648
5757
  sourceLocation: {
5649
5758
  "file": "packages/agent-team/src/index.ts",
5650
- "line": 999,
5759
+ "line": 1117,
5651
5760
  "column": 9
5652
5761
  }
5653
5762
  },
@@ -5674,7 +5783,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5674
5783
  },
5675
5784
  sourceLocation: {
5676
5785
  "file": "packages/agent-team/src/index.ts",
5677
- "line": 715,
5786
+ "line": 833,
5678
5787
  "column": 9
5679
5788
  }
5680
5789
  },
@@ -5701,7 +5810,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5701
5810
  },
5702
5811
  sourceLocation: {
5703
5812
  "file": "packages/agent-team/src/index.ts",
5704
- "line": 579,
5813
+ "line": 681,
5705
5814
  "column": 9
5706
5815
  }
5707
5816
  },
@@ -5728,7 +5837,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5728
5837
  },
5729
5838
  sourceLocation: {
5730
5839
  "file": "packages/agent-team/src/index.ts",
5731
- "line": 1095,
5840
+ "line": 1213,
5732
5841
  "column": 9
5733
5842
  }
5734
5843
  },
@@ -5755,7 +5864,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5755
5864
  },
5756
5865
  sourceLocation: {
5757
5866
  "file": "packages/agent-team/src/index.ts",
5758
- "line": 1118,
5867
+ "line": 1236,
5759
5868
  "column": 3
5760
5869
  }
5761
5870
  },
@@ -5782,7 +5891,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5782
5891
  },
5783
5892
  sourceLocation: {
5784
5893
  "file": "packages/agent-team/src/index.ts",
5785
- "line": 1019,
5894
+ "line": 1137,
5786
5895
  "column": 9
5787
5896
  }
5788
5897
  },
@@ -5810,7 +5919,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5810
5919
  },
5811
5920
  sourceLocation: {
5812
5921
  "file": "packages/agent-team/src/index.ts",
5813
- "line": 529,
5922
+ "line": 630,
5814
5923
  "column": 3
5815
5924
  }
5816
5925
  },
@@ -5837,7 +5946,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5837
5946
  },
5838
5947
  sourceLocation: {
5839
5948
  "file": "packages/agent-team/src/index.ts",
5840
- "line": 1009,
5949
+ "line": 1127,
5841
5950
  "column": 9
5842
5951
  }
5843
5952
  },
@@ -5864,7 +5973,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5864
5973
  },
5865
5974
  sourceLocation: {
5866
5975
  "file": "packages/agent-team/src/index.ts",
5867
- "line": 1082,
5976
+ "line": 1200,
5868
5977
  "column": 9
5869
5978
  }
5870
5979
  },
@@ -5891,7 +6000,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5891
6000
  },
5892
6001
  sourceLocation: {
5893
6002
  "file": "packages/agent-team/src/index.ts",
5894
- "line": 1125,
6003
+ "line": 1243,
5895
6004
  "column": 9
5896
6005
  }
5897
6006
  },
@@ -5918,7 +6027,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5918
6027
  },
5919
6028
  sourceLocation: {
5920
6029
  "file": "packages/agent-team/src/index.ts",
5921
- "line": 676,
6030
+ "line": 778,
5922
6031
  "column": 9
5923
6032
  }
5924
6033
  },
@@ -5945,7 +6054,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5945
6054
  },
5946
6055
  sourceLocation: {
5947
6056
  "file": "packages/agent-team/src/index.ts",
5948
- "line": 1030,
6057
+ "line": 1148,
5949
6058
  "column": 9
5950
6059
  }
5951
6060
  },
@@ -5972,7 +6081,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5972
6081
  },
5973
6082
  sourceLocation: {
5974
6083
  "file": "packages/agent-team/src/index.ts",
5975
- "line": 1103,
6084
+ "line": 1221,
5976
6085
  "column": 9
5977
6086
  }
5978
6087
  },
@@ -5999,7 +6108,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
5999
6108
  },
6000
6109
  sourceLocation: {
6001
6110
  "file": "packages/agent-team/src/index.ts",
6002
- "line": 516,
6111
+ "line": 617,
6003
6112
  "column": 3
6004
6113
  }
6005
6114
  },
@@ -6026,7 +6135,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6026
6135
  },
6027
6136
  sourceLocation: {
6028
6137
  "file": "packages/agent-team/src/index.ts",
6029
- "line": 1039,
6138
+ "line": 1157,
6030
6139
  "column": 9
6031
6140
  }
6032
6141
  },
@@ -6053,7 +6162,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6053
6162
  },
6054
6163
  sourceLocation: {
6055
6164
  "file": "packages/agent-team/src/index.ts",
6056
- "line": 1141,
6165
+ "line": 1261,
6057
6166
  "column": 3
6058
6167
  }
6059
6168
  },
@@ -6080,7 +6189,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6080
6189
  },
6081
6190
  sourceLocation: {
6082
6191
  "file": "packages/agent-team/src/index.ts",
6083
- "line": 1134,
6192
+ "line": 1254,
6084
6193
  "column": 3
6085
6194
  }
6086
6195
  },
@@ -6107,7 +6216,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6107
6216
  },
6108
6217
  sourceLocation: {
6109
6218
  "file": "packages/agent-team/src/index.ts",
6110
- "line": 591,
6219
+ "line": 693,
6111
6220
  "column": 9
6112
6221
  }
6113
6222
  },
@@ -6134,7 +6243,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6134
6243
  },
6135
6244
  sourceLocation: {
6136
6245
  "file": "packages/agent-team/src/index.ts",
6137
- "line": 927,
6246
+ "line": 1045,
6138
6247
  "column": 9
6139
6248
  }
6140
6249
  },
@@ -6161,7 +6270,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6161
6270
  },
6162
6271
  sourceLocation: {
6163
6272
  "file": "packages/agent-team/src/index.ts",
6164
- "line": 1148,
6273
+ "line": 1268,
6165
6274
  "column": 3
6166
6275
  }
6167
6276
  }
@@ -6179,6 +6288,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6179
6288
  mode: parsed.mode === "team" ? "team" : "conversation",
6180
6289
  ...typeof parsed.workspaceId === "string" ? { workspaceId: parsed.workspaceId } : {},
6181
6290
  ...typeof parsed.channelRef === "string" ? { channelRef: parsed.channelRef } : {},
6291
+ ...parsed.inbox === true ? { inbox: true } : {},
6182
6292
  ...hasThread ? {
6183
6293
  threadRef: parsed.threadRef,
6184
6294
  ...typeof parsed.taskRef === "string" ? { taskRef: parsed.taskRef } : {},
@@ -6192,11 +6302,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6192
6302
  function persistSnapshot(snapshot) {
6193
6303
  if (typeof localStorage === "undefined") return;
6194
6304
  try {
6195
- const { mode, workspaceId, channelRef, taskRef, threadRef, taskNumber } = snapshot;
6305
+ const { mode, workspaceId, channelRef, taskRef, threadRef, taskNumber, inbox } = snapshot;
6196
6306
  localStorage.setItem(STORAGE_KEY$3, JSON.stringify({
6197
6307
  mode,
6198
6308
  ...workspaceId === void 0 ? {} : { workspaceId },
6199
6309
  ...channelRef === void 0 ? {} : { channelRef },
6310
+ ...inbox === true ? { inbox: true } : {},
6200
6311
  ...taskRef === void 0 ? {} : { taskRef },
6201
6312
  ...threadRef === void 0 ? {} : { threadRef },
6202
6313
  ...taskNumber === void 0 ? {} : { taskNumber }
@@ -6235,6 +6346,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6235
6346
  this.clearMemberSession();
6236
6347
  this.setThread(threadRef, channelRef, taskRef, taskNumber);
6237
6348
  },
6349
+ selectInbox: () => {
6350
+ this.clearMemberSession();
6351
+ this.setInbox();
6352
+ },
6238
6353
  backToWorkspace: () => {
6239
6354
  this.clearMemberSession();
6240
6355
  this.setThread(void 0);
@@ -6281,8 +6396,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6281
6396
  this.commit();
6282
6397
  }
6283
6398
  setWorkspace(workspaceId) {
6284
- if (this.snapshot.workspaceId === workspaceId) return;
6285
- const { channelRef: _channelRef, taskRef: _taskRef, threadRef: _threadRef, taskNumber: _taskNumber, ...base } = this.snapshot;
6399
+ if (this.snapshot.workspaceId === workspaceId && this.snapshot.inbox !== true) return;
6400
+ const { channelRef: _channelRef, taskRef: _taskRef, threadRef: _threadRef, taskNumber: _taskNumber, inbox: _inbox, ...base } = this.snapshot;
6286
6401
  this.snapshot = {
6287
6402
  ...base,
6288
6403
  workspaceId
@@ -6290,14 +6405,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6290
6405
  this.commit();
6291
6406
  }
6292
6407
  setChannel(channelRef) {
6293
- if (this.snapshot.channelRef === channelRef && this.snapshot.threadRef === void 0) return;
6294
- const { taskRef: _taskRef, threadRef: _threadRef, taskNumber: _taskNumber, ...base } = this.snapshot;
6408
+ if (this.snapshot.channelRef === channelRef && this.snapshot.threadRef === void 0 && this.snapshot.inbox !== true) return;
6409
+ const { taskRef: _taskRef, threadRef: _threadRef, taskNumber: _taskNumber, inbox: _inbox, ...base } = this.snapshot;
6295
6410
  this.snapshot = {
6296
6411
  ...base,
6297
6412
  channelRef
6298
6413
  };
6299
6414
  this.commit();
6300
6415
  }
6416
+ /** The Inbox is a face, not workspace content: selecting a Workspace leaves it. */
6417
+ setInbox() {
6418
+ if (this.snapshot.inbox === true && this.snapshot.channelRef === void 0 && this.snapshot.threadRef === void 0) return;
6419
+ const { channelRef: _channelRef, taskRef: _taskRef, threadRef: _threadRef, taskNumber: _taskNumber, ...base } = this.snapshot;
6420
+ this.snapshot = {
6421
+ ...base,
6422
+ inbox: true
6423
+ };
6424
+ this.commit();
6425
+ }
6301
6426
  clearChannel() {
6302
6427
  const { channelRef: _channelRef, ...base } = this.snapshot;
6303
6428
  if (this.snapshot.channelRef === void 0) return;
@@ -6305,12 +6430,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6305
6430
  this.commit();
6306
6431
  }
6307
6432
  setThread(threadRef, channelRef, taskRef, taskNumber) {
6308
- if (this.snapshot.threadRef === threadRef && this.snapshot.taskRef === taskRef && this.snapshot.channelRef === channelRef && this.snapshot.taskNumber === taskNumber) return;
6433
+ if (this.snapshot.threadRef === threadRef && this.snapshot.taskRef === taskRef && this.snapshot.channelRef === channelRef && this.snapshot.taskNumber === taskNumber && this.snapshot.inbox !== true) return;
6309
6434
  if (threadRef === void 0) {
6310
6435
  const { taskRef: _taskRef, threadRef: _threadRef, taskNumber: _taskNumber, ...base } = this.snapshot;
6311
6436
  this.snapshot = base;
6312
6437
  } else {
6313
- const { channelRef: _channelRef, taskRef: _taskRef, threadRef: _threadRef, taskNumber: _taskNumber, ...base } = this.snapshot;
6438
+ const { channelRef: _channelRef, taskRef: _taskRef, threadRef: _threadRef, taskNumber: _taskNumber, inbox: _inbox, ...base } = this.snapshot;
6314
6439
  this.snapshot = {
6315
6440
  ...base,
6316
6441
  threadRef,
@@ -6329,16 +6454,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6329
6454
  //#endregion
6330
6455
  //#region src/client/team-changes.ts
6331
6456
  function scopeKey(scope) {
6332
- return scope.kind === "workspace" ? `workspace:${scope.workspaceId}` : scope.kind === "channel" ? `channel:${scope.channelRef}` : `thread:${scope.threadRef}`;
6457
+ return scope === void 0 ? "all" : scope.kind === "workspace" ? `workspace:${scope.workspaceId}` : scope.kind === "channel" ? `channel:${scope.channelRef}` : scope.kind === "presence" ? `presence:${scope.workspaceId}` : `thread:${scope.threadRef}`;
6333
6458
  }
6334
6459
  /**
6335
6460
  * One long-poll per change scope, shared by every listening surface: panels
6336
6461
  * and pages never open parallel `changes` requests for the same scope, and
6337
6462
  * the poll is aborted as soon as the last subscriber leaves.
6463
+ *
6464
+ * Each poll keeps its own cursor, and a cursor only means something inside the
6465
+ * scope it was issued for: the Host answers a presence scope from a
6466
+ * process-local wake epoch and every other scope from a durable ledger
6467
+ * position.
6338
6468
  */
6339
6469
  var TeamChangeStream = class {
6340
6470
  changes;
6341
6471
  polls = /* @__PURE__ */ new Map();
6472
+ /**
6473
+ * The last version each scope key answered with, kept after that scope's poll
6474
+ * is torn down: a commit landing while no poll exists is otherwise folded into
6475
+ * the replacement poll's opening sample, which reports nothing.
6476
+ */
6477
+ observed = /* @__PURE__ */ new Map();
6342
6478
  constructor(changes) {
6343
6479
  this.changes = changes;
6344
6480
  }
@@ -6348,7 +6484,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6348
6484
  if (poll === void 0) {
6349
6485
  poll = {
6350
6486
  controller: new AbortController(),
6351
- listeners: /* @__PURE__ */ new Set()
6487
+ listeners: /* @__PURE__ */ new Set(),
6488
+ resumeFrom: this.observed.get(key)
6352
6489
  };
6353
6490
  this.polls.set(key, poll);
6354
6491
  this.run(key, scope, poll);
@@ -6365,27 +6502,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6365
6502
  }
6366
6503
  async run(key, scope, poll) {
6367
6504
  const { signal } = poll.controller;
6368
- const probe = await this.changes({
6369
- afterVersion: 0,
6370
- scope
6371
- }, signal);
6372
- if (signal.aborted) return;
6373
- if (!probe.ok) {
6374
- this.fail(key, poll, probe.error.message);
6375
- return;
6505
+ const request = (afterVersion) => ({
6506
+ afterVersion,
6507
+ ...scope === void 0 ? {} : { scope }
6508
+ });
6509
+ let version = poll.resumeFrom;
6510
+ if (version === void 0) {
6511
+ const probe = await this.changes(request(0), signal);
6512
+ if (signal.aborted) return;
6513
+ if (!probe.ok) {
6514
+ this.fail(key, poll, probe.error.message);
6515
+ return;
6516
+ }
6517
+ version = probe.value.version;
6518
+ this.observed.set(key, version);
6376
6519
  }
6377
- let version = probe.value.version;
6378
6520
  while (!signal.aborted) {
6379
- const result = await this.changes({
6380
- afterVersion: version,
6381
- scope
6382
- }, signal);
6521
+ const result = await this.changes(request(version), signal);
6383
6522
  if (signal.aborted) return;
6384
6523
  if (!result.ok) {
6385
6524
  this.fail(key, poll, result.error.message);
6386
6525
  return;
6387
6526
  }
6388
- if (result.value.version > version) {
6527
+ this.observed.set(key, result.value.version);
6528
+ if (result.value.version !== version) {
6389
6529
  version = result.value.version;
6390
6530
  for (const listener of poll.listeners) listener({
6391
6531
  type: "changed",
@@ -6402,6 +6542,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6402
6542
  });
6403
6543
  }
6404
6544
  };
6545
+ /**
6546
+ * The Host's `changes` stream never wakes on a Thread read — a read advances
6547
+ * only the reader's private watermark, so no shared projection changes. A
6548
+ * durable read does consume the reader's own mention markers, so the Human's
6549
+ * badge and Inbox page refresh from the completed read itself instead of
6550
+ * waiting for the next unrelated commit.
6551
+ */
6552
+ var TeamReadStream = class {
6553
+ version = 0;
6554
+ listeners = /* @__PURE__ */ new Set();
6555
+ bump() {
6556
+ this.version += 1;
6557
+ for (const listener of this.listeners) listener();
6558
+ }
6559
+ subscribe(listener) {
6560
+ this.listeners.add(listener);
6561
+ return () => {
6562
+ this.listeners.delete(listener);
6563
+ };
6564
+ }
6565
+ };
6405
6566
  //#endregion
6406
6567
  //#region src/client/drafts.ts
6407
6568
  const STORAGE_KEY$2 = "dsh.agent-team.drafts.v1";
@@ -6534,13 +6695,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6534
6695
  };
6535
6696
  //#endregion
6536
6697
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/team.module.css.mjs
6537
- const css$9 = ".YvAbSa_footerStack{flex:none;width:100%;height:42px;margin:8px 0 0;display:flex}.YvAbSa_footerAction,.YvAbSa_settingsAction{box-sizing:border-box;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:8px;width:calc(100% + 4px);height:42px;padding:0 10px 0 8px;font-family:inherit;font-size:14px;line-height:22px;display:flex;overflow:hidden}.YvAbSa_footerAction{margin:0 -2px}.YvAbSa_settingsAction{margin:4px -2px}.YvAbSa_footerAction:hover,.YvAbSa_footerAction:focus-visible,.YvAbSa_settingsAction:hover,.YvAbSa_settingsAction:focus-visible{background:var(--dsw-alias-interactive-bg-hover);outline:none}.YvAbSa_footerAction.YvAbSa_rail,.YvAbSa_settingsAction.YvAbSa_rail{border-radius:50%;justify-content:center;width:36px;height:36px;padding:0}.YvAbSa_footerAction.YvAbSa_rail{margin:0}.YvAbSa_settingsAction.YvAbSa_rail{margin:8px 0 10px}.YvAbSa_railStack{align-items:center;width:36px;height:36px;margin:0}";
6538
- const tagId$9 = "@wowyuarm/dsh-agent-team/team.module.css";
6539
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$9) + "]") === null) {
6698
+ const css$10 = ".YvAbSa_footerStack{flex:none;width:100%;height:42px;margin:8px 0 0;display:flex}.YvAbSa_footerAction,.YvAbSa_settingsAction{box-sizing:border-box;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:8px;width:calc(100% + 4px);height:42px;padding:0 10px 0 8px;font-family:inherit;font-size:14px;line-height:22px;display:flex;overflow:hidden}.YvAbSa_footerAction{margin:0 -2px}.YvAbSa_settingsAction{margin:4px -2px}.YvAbSa_footerAction:hover,.YvAbSa_footerAction:focus-visible,.YvAbSa_settingsAction:hover,.YvAbSa_settingsAction:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.YvAbSa_footerAction:focus-visible,.YvAbSa_settingsAction:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}.YvAbSa_footerAction.YvAbSa_rail,.YvAbSa_settingsAction.YvAbSa_rail{corner-shape:round;border-radius:50%;justify-content:center;width:36px;height:36px;padding:0}.YvAbSa_footerAction.YvAbSa_rail{margin:0}.YvAbSa_settingsAction.YvAbSa_rail{margin:8px 0 10px}.YvAbSa_railStack{align-items:center;width:36px;height:36px;margin:0}";
6699
+ const tagId$10 = "@wowyuarm/dsh-agent-team/team.module.css";
6700
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$10) + "]") === null) {
6540
6701
  const tag = document.createElement("style");
6541
6702
  tag.dataset.plugin = "@wowyuarm/dsh-agent-team";
6542
- tag.dataset.pluginCss = tagId$9;
6543
- tag.textContent = css$9;
6703
+ tag.dataset.pluginCss = tagId$10;
6704
+ tag.textContent = css$10;
6544
6705
  document.head.appendChild(tag);
6545
6706
  }
6546
6707
  var team_module_css_default = {
@@ -6584,13 +6745,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6584
6745
  }
6585
6746
  //#endregion
6586
6747
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/state-dot.module.css.mjs
6587
- const css$8 = ".DalNWW_quiet{border-radius:50%;flex:none;display:inline-block;position:relative}.DalNWW_quiet[data-variant=todo]{border:1px solid var(--dsw-alias-label-tertiary)}.DalNWW_quiet[data-variant=quiet]{color:var(--dsw-alias-label-tertiary)}.DalNWW_quiet[data-variant=quiet]:before{content:\"\";opacity:.1;background:currentColor;border-radius:50%;position:absolute;inset:0}.DalNWW_quiet[data-variant=quiet]:after{content:\"\";background:currentColor;border-radius:50%;position:absolute;inset:20%}";
6588
- const tagId$8 = "@wowyuarm/dsh-agent-team/state-dot.module.css";
6589
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$8) + "]") === null) {
6748
+ const css$9 = ".DalNWW_quiet{corner-shape:round;border-radius:50%;flex:none;display:inline-block;position:relative}.DalNWW_quiet[data-variant=todo]{border:1px solid var(--dsw-alias-label-tertiary)}.DalNWW_quiet[data-variant=quiet]{color:var(--dsw-alias-label-tertiary)}.DalNWW_quiet[data-variant=quiet]:before{corner-shape:round;content:\"\";opacity:.1;background:currentColor;border-radius:50%;position:absolute;inset:0}.DalNWW_quiet[data-variant=quiet]:after{corner-shape:round;content:\"\";background:currentColor;border-radius:50%;position:absolute;inset:20%}";
6749
+ const tagId$9 = "@wowyuarm/dsh-agent-team/state-dot.module.css";
6750
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$9) + "]") === null) {
6590
6751
  const tag = document.createElement("style");
6591
6752
  tag.dataset.plugin = "@wowyuarm/dsh-agent-team";
6592
- tag.dataset.pluginCss = tagId$8;
6593
- tag.textContent = css$8;
6753
+ tag.dataset.pluginCss = tagId$9;
6754
+ tag.textContent = css$9;
6594
6755
  document.head.appendChild(tag);
6595
6756
  }
6596
6757
  var state_dot_module_css_default = { "quiet": "DalNWW_quiet" };
@@ -6619,13 +6780,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6619
6780
  }
6620
6781
  //#endregion
6621
6782
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/presence.module.css.mjs
6622
- const css$7 = ".-\\36 lQ-q_target{flex:0 0 14px;justify-content:center;align-items:center;display:inline-flex}";
6623
- const tagId$7 = "@wowyuarm/dsh-agent-team/presence.module.css";
6624
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$7) + "]") === null) {
6783
+ const css$8 = ".-\\36 lQ-q_target{flex:0 0 14px;justify-content:center;align-items:center;display:inline-flex}";
6784
+ const tagId$8 = "@wowyuarm/dsh-agent-team/presence.module.css";
6785
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$8) + "]") === null) {
6625
6786
  const tag = document.createElement("style");
6626
6787
  tag.dataset.plugin = "@wowyuarm/dsh-agent-team";
6627
- tag.dataset.pluginCss = tagId$7;
6628
- tag.textContent = css$7;
6788
+ tag.dataset.pluginCss = tagId$8;
6789
+ tag.textContent = css$8;
6629
6790
  document.head.appendChild(tag);
6630
6791
  }
6631
6792
  var presence_module_css_default = { "target": "-6lQ-q_target" };
@@ -6633,7 +6794,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6633
6794
  //#region src/client/TeamPresenceDot.tsx
6634
6795
  function presenceLabel(status, t) {
6635
6796
  const label = status.presence === "available" ? t("statusAvailable") : status.presence === "working" ? t("statusWorking") : status.presence === "error" ? t("statusError") : t("statusUnavailable");
6636
- return status.diagnostic === void 0 ? label : `${label}: ${status.diagnostic}`;
6797
+ return status.diagnostic === void 0 ? label : `${label}: ${diagnosticText(status)}`;
6798
+ }
6799
+ /** One line of human-readable diagnostic text: the reason, plus the refused artifact path when one was reported. */
6800
+ function diagnosticText(status) {
6801
+ const diagnostic = status.diagnostic;
6802
+ if (diagnostic === void 0) return "";
6803
+ return diagnostic.location === void 0 ? diagnostic.detail : `${diagnostic.detail} (${diagnostic.location.path})`;
6804
+ }
6805
+ /**
6806
+ * Whether the restart action can help an unavailable Member: it heals
6807
+ * transient and repairable failures, but not a transient rollover window
6808
+ * (which resolves on its own) or a refusal already proven non-remediable.
6809
+ */
6810
+ function restartOffered(status) {
6811
+ const diagnostic = status.diagnostic;
6812
+ if (diagnostic === void 0) return true;
6813
+ if (diagnostic.class === "rollover") return false;
6814
+ return !(diagnostic.class === "session-refused" && diagnostic.remediable === false);
6637
6815
  }
6638
6816
  /** Shared presence → indicator mapping for dots and avatar badges. */
6639
6817
  function presenceDotState(presence) {
@@ -6654,13 +6832,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6654
6832
  }
6655
6833
  //#endregion
6656
6834
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/members.module.css.mjs
6657
- const css$6 = ".UkovOW_body{max-height:min(65vh,560px);overflow-y:auto}.UkovOW_content{outline:none;gap:12px;display:grid}.UkovOW_group{gap:3px;display:grid}.UkovOW_group+.UkovOW_group{border-top:1px solid var(--dsw-alias-border-l2);padding-top:10px}.UkovOW_group h3{color:var(--dsw-alias-label-secondary);margin:0 0 3px;font-size:12px;font-weight:600;line-height:18px}.UkovOW_member{border-radius:6px;grid-template-columns:14px minmax(0,1fr);align-items:center;gap:0 8px;min-height:36px;padding:4px 6px;display:grid}.UkovOW_member:hover{background:var(--dsw-alias-interactive-bg-hover)}.UkovOW_copy{min-width:0;display:grid}.UkovOW_copy strong{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500;line-height:18px;overflow:hidden}.UkovOW_copy small{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:14px;overflow:hidden}.UkovOW_state,.UkovOW_error{margin:0;padding:6px 0;font-size:12px;line-height:18px}.UkovOW_state{color:var(--dsw-alias-label-tertiary)}.UkovOW_error{color:var(--dsw-alias-state-error-primary)}@media (width<=600px){.UkovOW_body{max-height:calc(100vh - 160px)}}";
6658
- const tagId$6 = "@wowyuarm/dsh-agent-team/members.module.css";
6659
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
6835
+ const css$7 = ".UkovOW_body{max-height:min(65vh,560px);overflow-y:auto}.UkovOW_content{outline:none;gap:12px;display:grid}.UkovOW_group{gap:3px;display:grid}.UkovOW_group+.UkovOW_group{border-top:1px solid var(--dsw-alias-border-l2);padding-top:10px}.UkovOW_group h3{color:var(--dsw-alias-label-secondary);margin:0 0 3px;font-size:12px;font-weight:600;line-height:18px}.UkovOW_member{border-radius:6px;grid-template-columns:14px minmax(0,1fr);align-items:center;gap:0 8px;min-height:36px;padding:4px 6px;display:grid}.UkovOW_member:hover{background:var(--dsw-alias-interactive-bg-hover)}.UkovOW_copy{min-width:0;display:grid}.UkovOW_copy strong{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500;line-height:18px;overflow:hidden}.UkovOW_copy small{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:14px;overflow:hidden}.UkovOW_state,.UkovOW_error{margin:0;padding:6px 0;font-size:12px;line-height:18px}.UkovOW_state{color:var(--dsw-alias-label-tertiary)}.UkovOW_error{color:var(--dsw-alias-state-error-primary)}@media (width<=600px){.UkovOW_body{max-height:calc(100vh - 160px)}}";
6836
+ const tagId$7 = "@wowyuarm/dsh-agent-team/members.module.css";
6837
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$7) + "]") === null) {
6660
6838
  const tag = document.createElement("style");
6661
6839
  tag.dataset.plugin = "@wowyuarm/dsh-agent-team";
6662
- tag.dataset.pluginCss = tagId$6;
6663
- tag.textContent = css$6;
6840
+ tag.dataset.pluginCss = tagId$7;
6841
+ tag.textContent = css$7;
6664
6842
  document.head.appendChild(tag);
6665
6843
  }
6666
6844
  var members_module_css_default = {
@@ -6807,19 +6985,46 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6807
6985
  //#region src/client/requests.ts
6808
6986
  /** Fresh idempotency identity for one Client-initiated durable request. */
6809
6987
  const mintRequestId = () => crypto.randomUUID();
6988
+ /**
6989
+ * Upload composer files in order. One failure stops with the error text; the
6990
+ * caller keeps its chips so a retry uploads only the still-pending files.
6991
+ */
6992
+ const uploadComposerFiles = async (putAttachment, workspaceId, files) => {
6993
+ const attachmentIds = [];
6994
+ for (const file of files) {
6995
+ const uploaded = await putAttachment({
6996
+ requestId: mintRequestId(),
6997
+ workspaceId,
6998
+ name: file.name,
6999
+ mediaType: file.type === "" ? void 0 : file.type,
7000
+ bytesBase64: bytesToBase64(new Uint8Array(await file.arrayBuffer()))
7001
+ });
7002
+ if (!uploaded.ok) return {
7003
+ ok: false,
7004
+ error: uploaded.error.message
7005
+ };
7006
+ attachmentIds.push(uploaded.value.attachmentId);
7007
+ }
7008
+ return {
7009
+ ok: true,
7010
+ attachmentIds
7011
+ };
7012
+ };
6810
7013
  //#endregion
6811
7014
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/composer.module.css.mjs
6812
- const css$5 = ".x9jGQq_root{padding:0 var(--dsh-composer-side-clearance,16px) 8px;flex-direction:column;align-items:center;display:flex}.x9jGQq_card{box-sizing:border-box;width:100%;max-width:var(--dsh-composer-card-max-width,780px);border:1px solid var(--dsw-alias-border-l2-darkmode-thin);background:var(--dsw-specific-input-major,var(--dsw-alias-bg-layer-1));box-shadow:var(--dsw-shadow-lv2);border-radius:22px;flex-direction:column;gap:6px;padding:10px 0 0;display:flex;position:relative}.x9jGQq_inputArea{min-height:28px;position:relative}.x9jGQq_inputArea textarea{box-sizing:border-box;resize:none;width:100%;min-height:28px;max-height:336px;color:var(--dsw-alias-label-primary,var(--dsw-alias-label-primary));font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;background:0 0;border:0;outline:0;padding:4px 12px 0 16px;font-size:15px;line-height:24px;display:block;overflow-y:auto}.x9jGQq_inputArea textarea::placeholder{color:var(--dsw-alias-label-caption,var(--dsw-alias-label-tertiary))}.x9jGQq_inputArea textarea:disabled{cursor:not-allowed;opacity:.55}.x9jGQq_mentionMenu{z-index:10;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);max-height:min(320px,40vh);box-shadow:var(--dsw-shadow-lv3);border-radius:12px;padding:4px;position:absolute;bottom:calc(100% + 12px);left:0;right:0;overflow-y:auto}.x9jGQq_mentionOption{width:100%;min-height:40px;color:var(--dsw-alias-label-primary,var(--dsw-alias-label-primary));cursor:pointer;text-align:left;background:0 0;border:0;border-radius:10px;grid-template-columns:16px minmax(0,auto) minmax(0,1fr);align-items:center;gap:8px;padding:8px 10px;font-size:14px;line-height:22px;display:grid}.x9jGQq_mentionOption:hover,.x9jGQq_mentionOption[aria-selected=true]{background:var(--dsw-alias-interactive-bg-hover)}.x9jGQq_mentionName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.x9jGQq_mentionAllDot{background:var(--dsw-alias-label-primary);border-radius:50%;justify-self:center;width:8px;height:8px}.x9jGQq_mentionDescription{min-width:0;color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-tertiary));text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.x9jGQq_toolbar{justify-content:flex-end;align-items:center;gap:6px;min-height:34px;padding:2px 8px 6px;display:flex}.x9jGQq_asTaskOn[aria-pressed=true],.x9jGQq_asTaskOn[aria-pressed=true]:hover:not(:disabled){background:var(--dsw-alias-button-primary-fill);border-color:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}.x9jGQq_attachButton{background:var(--dsw-specific-selector);color:var(--dsw-alias-label-primary);cursor:pointer;border:0;border-radius:999px;flex:none;place-items:center;width:28px;height:28px;margin-right:auto;display:grid}.x9jGQq_attachButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.x9jGQq_attachButton:disabled{cursor:default;opacity:.5}.x9jGQq_attachButton:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,var(--dsw-specific-selector));outline-offset:1px}.x9jGQq_fileInput{display:none}.x9jGQq_fileChips{flex-wrap:wrap;gap:4px;margin:0;padding:4px 8px 0;list-style:none;display:flex}.x9jGQq_fileChip{background:var(--dsw-alias-interactive-bg-hover);border-radius:6px;align-items:center;gap:4px;max-width:100%;padding:2px 4px 2px 8px;display:inline-flex}.x9jGQq_fileChipSize{color:var(--dsw-alias-label-tertiary);margin-left:6px}.x9jGQq_imageChip{align-items:center;display:flex}.x9jGQq_imageChipPreview{border:1px solid var(--dsw-alias-border-l2);object-fit:cover;border-radius:4px;width:56px;height:40px}.x9jGQq_fileChipName{text-overflow:ellipsis;white-space:nowrap;max-width:220px;font-size:11px;line-height:16px;overflow:hidden}.x9jGQq_fileChipRemove{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:4px;justify-content:center;align-items:center;width:16px;height:16px;padding:0;font-size:12px;display:inline-flex}.x9jGQq_fileChipRemove:hover,.x9jGQq_fileChipRemove:focus-visible{color:var(--dsw-alias-label-primary);outline:none}.x9jGQq_sendButton{background:var(--dsw-alias-button-info-fill,var(--dsw-alias-button-primary-fill));color:#fff;cursor:pointer;border:0;border-radius:50%;justify-content:center;align-items:center;width:34px;height:34px;padding:0;transition:background-color .1s,opacity .1s;display:inline-flex}.x9jGQq_sendButton:hover:not(:disabled){background:var(--dsw-alias-button-info-hover,var(--dsw-alias-button-primary-hover))}.x9jGQq_sendButton:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.x9jGQq_sendButton:disabled{cursor:not-allowed;opacity:.4}.x9jGQq_confirmation{color:var(--dsw-alias-label-tertiary);align-self:stretch;margin:0;padding:0 16px;font-size:12px;line-height:18px}.x9jGQq_notifyRow{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-tertiary));overflow-wrap:anywhere;margin:0;padding:0 16px;font-size:12px;line-height:18px}.x9jGQq_error{color:var(--dsw-alias-state-error-primary);align-self:stretch;margin:0;padding:0 4px 2px;font-size:12px;line-height:18px}@media (width<=600px){.x9jGQq_mentionOption{grid-template-columns:16px minmax(0,1fr);min-height:36px;padding-block:6px}.x9jGQq_mentionDescription{display:none}}@media (prefers-reduced-motion:reduce){.x9jGQq_sendButton{transition:none}}";
6813
- const tagId$5 = "@wowyuarm/dsh-agent-team/composer.module.css";
6814
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$5) + "]") === null) {
7015
+ const css$6 = ".x9jGQq_root{padding:0 var(--dsh-composer-side-clearance,16px) 8px;flex-direction:column;align-items:center;display:flex}.x9jGQq_card{box-sizing:border-box;width:100%;max-width:var(--dsh-composer-card-max-width,780px);border:1px solid var(--dsw-alias-border-l2-darkmode-thin);background:var(--dsw-specific-input-major,var(--dsw-alias-bg-layer-1));box-shadow:var(--dsw-shadow-lv2);border-radius:22px;flex-direction:column;gap:6px;padding:10px 0 0;display:flex;position:relative}.x9jGQq_inputArea{min-height:28px;position:relative}.x9jGQq_inputArea textarea{box-sizing:border-box;resize:none;width:100%;min-height:28px;max-height:336px;color:var(--dsw-alias-label-primary,var(--dsw-alias-label-primary));font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;background:0 0;border:0;outline:0;padding:4px 12px 0 16px;font-size:15px;line-height:24px;display:block;overflow-y:auto}.x9jGQq_inputArea textarea::placeholder{color:var(--dsw-alias-label-caption,var(--dsw-alias-label-tertiary))}.x9jGQq_inputArea textarea:disabled{cursor:not-allowed;opacity:.55}.x9jGQq_mentionMenu{z-index:10;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);max-height:min(320px,40vh);box-shadow:var(--dsw-shadow-lv3);border-radius:12px;padding:4px;position:absolute;bottom:calc(100% + 12px);left:0;right:0;overflow-y:auto}.x9jGQq_mentionOption{width:100%;min-height:40px;color:var(--dsw-alias-label-primary,var(--dsw-alias-label-primary));cursor:pointer;text-align:left;background:0 0;border:0;border-radius:10px;grid-template-columns:16px minmax(0,auto) minmax(0,1fr);align-items:center;gap:8px;padding:8px 10px;font-size:14px;line-height:22px;display:grid}.x9jGQq_mentionOption:hover,.x9jGQq_mentionOption[aria-selected=true]{background:var(--dsw-alias-interactive-bg-hover)}.x9jGQq_mentionName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.x9jGQq_mentionAllDot{corner-shape:round;background:var(--dsw-alias-label-primary);border-radius:50%;justify-self:center;width:8px;height:8px}.x9jGQq_mentionDescription{min-width:0;color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-tertiary));text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.x9jGQq_toolbar{justify-content:flex-end;align-items:center;gap:12px;min-height:34px;padding:2px 8px 6px;display:flex;container-type:inline-size}.x9jGQq_asTaskPill{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:24px;flex:none;align-items:center;gap:4px;height:28px;padding:0 10px 0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.x9jGQq_asTaskPill:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.x9jGQq_asTaskPill:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-border-l3)}.x9jGQq_asTaskPill:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.x9jGQq_asTaskPillOn,.x9jGQq_asTaskPillOn:hover:not(:disabled){background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground)}.x9jGQq_asTaskLabel{white-space:nowrap}@container (width<=460px){.x9jGQq_asTaskPill .x9jGQq_asTaskLabel{display:none}}.x9jGQq_attachButton{background:var(--dsw-specific-selector);corner-shape:round;color:var(--dsw-alias-label-primary);cursor:pointer;border:0;border-radius:999px;flex:none;place-items:center;width:28px;height:28px;display:grid}.x9jGQq_attachButton:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.x9jGQq_attachButton:disabled{cursor:default;opacity:.5}.x9jGQq_attachButton:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,var(--dsw-specific-selector));outline-offset:1px}.x9jGQq_fileInput{display:none}.x9jGQq_fileChips{flex-wrap:wrap;gap:4px;margin:0;padding:4px 8px 0;list-style:none;display:flex}.x9jGQq_fileChip{background:var(--dsw-alias-interactive-bg-hover);border-radius:6px;align-items:center;gap:4px;max-width:100%;padding:2px 4px 2px 8px;display:inline-flex}.x9jGQq_fileChipSize{color:var(--dsw-alias-label-tertiary);margin-left:6px}.x9jGQq_imageChip{align-items:center;display:flex}.x9jGQq_imageChipPreview{border:1px solid var(--dsw-alias-border-l2);object-fit:cover;border-radius:4px;width:56px;height:40px}.x9jGQq_fileChipName{text-overflow:ellipsis;white-space:nowrap;max-width:220px;font-size:11px;line-height:16px;overflow:hidden}.x9jGQq_fileChipRemove{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:4px;justify-content:center;align-items:center;width:16px;height:16px;padding:0;font-size:12px;display:inline-flex}.x9jGQq_fileChipRemove:hover,.x9jGQq_fileChipRemove:focus-visible{color:var(--dsw-alias-label-primary)}.x9jGQq_fileChipRemove:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:1px}.x9jGQq_sendButton{background:var(--dsw-alias-button-info-fill,var(--dsw-alias-button-primary-fill));corner-shape:round;color:#fff;cursor:pointer;border:0;border-radius:999px;justify-content:center;align-items:center;width:34px;height:34px;margin-left:auto;padding:0;transition:background-color .1s,opacity .1s;display:inline-flex;transform:translateY(-2px)}.x9jGQq_sendButton:hover:not(:disabled){background:var(--dsw-alias-button-info-hover,var(--dsw-alias-button-primary-hover))}.x9jGQq_sendButton:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.x9jGQq_sendButton:disabled{cursor:default;opacity:.4}.x9jGQq_confirmation{color:var(--dsw-alias-label-tertiary);align-self:stretch;margin:0;padding:0 16px;font-size:12px;line-height:18px}.x9jGQq_notifyRow{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-tertiary));overflow-wrap:anywhere;margin:0;padding:0 16px;font-size:12px;line-height:18px}.x9jGQq_error{color:var(--dsw-alias-state-error-primary);align-self:stretch;margin:0;padding:0 4px 2px;font-size:12px;line-height:18px}@media (width<=600px){.x9jGQq_mentionOption{grid-template-columns:16px minmax(0,1fr);min-height:36px;padding-block:6px}.x9jGQq_mentionDescription{display:none}}@media (prefers-reduced-motion:reduce){.x9jGQq_sendButton{transition:none}}";
7016
+ const tagId$6 = "@wowyuarm/dsh-agent-team/composer.module.css";
7017
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$6) + "]") === null) {
6815
7018
  const tag = document.createElement("style");
6816
7019
  tag.dataset.plugin = "@wowyuarm/dsh-agent-team";
6817
- tag.dataset.pluginCss = tagId$5;
6818
- tag.textContent = css$5;
7020
+ tag.dataset.pluginCss = tagId$6;
7021
+ tag.textContent = css$6;
6819
7022
  document.head.appendChild(tag);
6820
7023
  }
6821
7024
  var composer_module_css_default = {
6822
- "asTaskOn": "x9jGQq_asTaskOn",
7025
+ "asTaskLabel": "x9jGQq_asTaskLabel",
7026
+ "asTaskPill": "x9jGQq_asTaskPill",
7027
+ "asTaskPillOn": "x9jGQq_asTaskPillOn",
6823
7028
  "attachButton": "x9jGQq_attachButton",
6824
7029
  "card": "x9jGQq_card",
6825
7030
  "confirmation": "x9jGQq_confirmation",
@@ -6892,13 +7097,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6892
7097
  }
6893
7098
  return url;
6894
7099
  }
6895
- function TeamComposer({ members, followerMemberIds, recipients, draft, pending, confirmation, error, onDraftChange, onRecipientsChange, onSubmit, placeholder, pendingFiles, onFilesChange, asTask, onAsTaskChange, t }) {
7100
+ function TeamComposer({ members, followerMemberIds, drafts, draftKey, pending, confirmation, error, onEdit, onSubmit, placeholder, pendingFiles, onFilesChange, asTask, onAsTaskChange, t }) {
6896
7101
  const inputRef = (0, react.useRef)(null);
6897
7102
  const fileInputRef = (0, react.useRef)(null);
6898
7103
  const rootRef = (0, react.useRef)(null);
6899
7104
  const menuRef = (0, react.useRef)(null);
6900
7105
  const activeOptionRef = (0, react.useRef)(null);
6901
7106
  const composingRef = (0, react.useRef)(false);
7107
+ const { draft, recipients } = (0, react.useSyncExternalStore)(drafts.subscribe, () => drafts.getSnapshot(draftKey));
6902
7108
  const [mention, setMention] = (0, react.useState)();
6903
7109
  const [highlight, setHighlight] = (0, react.useState)(0);
6904
7110
  const memberCandidates = mention === void 0 ? [] : rankMentionCandidates(mentionCandidates(members, mention.query), followerMemberIds);
@@ -6955,7 +7161,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6955
7161
  const member = knownMembers.get(memberId);
6956
7162
  return member !== void 0 && containsMention(nextDraft, member.handle);
6957
7163
  }));
6958
- if (next.size !== recipients.size) onRecipientsChange(next);
7164
+ if (next.size !== recipients.size) drafts.writeRecipients(draftKey, next);
6959
7165
  };
6960
7166
  (0, react.useEffect)(() => {
6961
7167
  if (members.length === 0) return;
@@ -6972,13 +7178,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
6972
7178
  };
6973
7179
  const onChange = (event) => {
6974
7180
  const nextDraft = event.target.value;
6975
- onDraftChange(nextDraft);
7181
+ drafts.writeDraft(draftKey, nextDraft);
7182
+ onEdit?.();
6976
7183
  pruneRecipients(nextDraft);
6977
7184
  updateMention(nextDraft, event.target.selectionStart ?? nextDraft.length);
6978
7185
  };
6979
7186
  const commitMention = (nextDraft, nextCaret, nextRecipients) => {
6980
- onDraftChange(nextDraft);
6981
- onRecipientsChange(nextRecipients);
7187
+ drafts.writeDraft(draftKey, nextDraft);
7188
+ drafts.writeRecipients(draftKey, nextRecipients);
7189
+ onEdit?.();
6982
7190
  setMention(void 0);
6983
7191
  setHighlight(0);
6984
7192
  requestAnimationFrame(() => {
@@ -7196,17 +7404,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7196
7404
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
7197
7405
  className: composer_module_css_default.toolbar,
7198
7406
  children: [
7199
- onAsTaskChange !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
7200
- size: "sm",
7201
- variant: "outline",
7202
- className: asTask === true ? composer_module_css_default.asTaskOn : void 0,
7203
- "aria-pressed": asTask === true,
7204
- disabled: pending,
7205
- onClick: () => {
7206
- onAsTaskChange(asTask !== true);
7207
- },
7208
- children: t("asTask")
7209
- }),
7210
7407
  onFilesChange !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
7211
7408
  ref: fileInputRef,
7212
7409
  type: "file",
@@ -7219,17 +7416,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7219
7416
  if (chosen.length > 0 && pendingFiles !== void 0) onFilesChange([...pendingFiles, ...chosen]);
7220
7417
  event.target.value = "";
7221
7418
  }
7222
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7419
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
7420
+ label: t("attachFiles"),
7421
+ side: "top",
7422
+ delayMs: 500,
7423
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7424
+ type: "button",
7425
+ className: composer_module_css_default.attachButton,
7426
+ "aria-label": t("attachFiles"),
7427
+ disabled: pending,
7428
+ onClick: () => {
7429
+ fileInputRef.current?.click();
7430
+ },
7431
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPaperclipOutline16, { size: 14 })
7432
+ })
7433
+ })] }),
7434
+ onAsTaskChange !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
7223
7435
  type: "button",
7224
- className: composer_module_css_default.attachButton,
7225
- "aria-label": t("attachFiles"),
7226
- title: t("attachFiles"),
7436
+ className: asTask === true ? `${composer_module_css_default.asTaskPill} ${composer_module_css_default.asTaskPillOn}` : composer_module_css_default.asTaskPill,
7437
+ "aria-label": t("asTask"),
7438
+ "aria-pressed": asTask === true,
7439
+ title: t("asTask"),
7227
7440
  disabled: pending,
7228
7441
  onClick: () => {
7229
- fileInputRef.current?.click();
7442
+ onAsTaskChange(asTask !== true);
7230
7443
  },
7231
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlusOutline16, { size: 14 })
7232
- })] }),
7444
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChecklistOutline14, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
7445
+ className: composer_module_css_default.asTaskLabel,
7446
+ children: t("asTask")
7447
+ })]
7448
+ }),
7233
7449
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
7234
7450
  type: "submit",
7235
7451
  className: composer_module_css_default.sendButton,
@@ -7495,6 +7711,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7495
7711
  return !(MARKDOWN_BLOCK_CONSTRUCT.test(text) || MARKDOWN_INLINE_CONSTRUCT.test(text));
7496
7712
  }
7497
7713
  const pad$1 = (value) => String(value).padStart(2, "0");
7714
+ /** Absolute local `YYYY-MM-DD HH:mm` label: the precise instant behind every shorter form. */
7715
+ function formatAbsoluteTime(occurredAt) {
7716
+ const at = new Date(occurredAt);
7717
+ if (Number.isNaN(at.getTime())) return "";
7718
+ return `${at.getFullYear()}-${pad$1(at.getMonth() + 1)}-${pad$1(at.getDate())} ${pad$1(at.getHours())}:${pad$1(at.getMinutes())}`;
7719
+ }
7498
7720
  /**
7499
7721
  * Wall-clock label for one Message instant: time within the current day,
7500
7722
  * month-day time within the year, full date otherwise.
@@ -7502,11 +7724,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7502
7724
  function formatMessageTime(occurredAt, now = /* @__PURE__ */ new Date()) {
7503
7725
  const at = new Date(occurredAt);
7504
7726
  if (Number.isNaN(at.getTime())) return "";
7505
- const time = `${pad$1(at.getHours())}:${pad$1(at.getMinutes())}`;
7506
- if (at.getFullYear() === now.getFullYear() && at.getMonth() === now.getMonth() && at.getDate() === now.getDate()) return time;
7507
- const date = `${at.getFullYear()}-${pad$1(at.getMonth() + 1)}-${pad$1(at.getDate())}`;
7508
- if (at.getFullYear() === now.getFullYear()) return `${date.slice(5)} ${time}`;
7509
- return `${date} ${time}`;
7727
+ if (at.getFullYear() === now.getFullYear() && at.getMonth() === now.getMonth() && at.getDate() === now.getDate()) return `${pad$1(at.getHours())}:${pad$1(at.getMinutes())}`;
7728
+ const absolute = formatAbsoluteTime(occurredAt);
7729
+ return at.getFullYear() === now.getFullYear() ? absolute.slice(5) : absolute;
7730
+ }
7731
+ /**
7732
+ * Calendar days between two instants in the viewer's own zone, so "yesterday"
7733
+ * means yesterday locally rather than 24 hours earlier.
7734
+ */
7735
+ function calendarDayDelta(at, now) {
7736
+ const midnight = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
7737
+ return Math.round((midnight(now) - midnight(at)) / 864e5);
7738
+ }
7739
+ /**
7740
+ * Queue label for one Inbox row's newest mention. The mention queue scans by
7741
+ * recency, so the two days a reader reasons about by name are named ("今天" /
7742
+ * "昨天") while everything older keeps the Message date form, so the row and
7743
+ * the Thread it opens agree about the same instant.
7744
+ */
7745
+ function formatInboxTime(occurredAt, t, now = /* @__PURE__ */ new Date()) {
7746
+ const at = new Date(occurredAt);
7747
+ if (Number.isNaN(at.getTime())) return "";
7748
+ const days = calendarDayDelta(at, now);
7749
+ if (days === 0 || days === 1) return `${t(days === 0 ? "inboxTimeToday" : "inboxTimeYesterday")} ${pad$1(at.getHours())}:${pad$1(at.getMinutes())}`;
7750
+ return formatMessageTime(occurredAt, now);
7510
7751
  }
7511
7752
  function formatActivity(activity, options) {
7512
7753
  const actor = options.actorName(activity.actor);
@@ -7571,13 +7812,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7571
7812
  }
7572
7813
  //#endregion
7573
7814
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/conversation.module.css.mjs
7574
- const css$4 = ".omcBaG_surface{grid-template-rows:auto minmax(0,1fr) auto;min-width:0;height:100%;min-height:0;display:grid;overflow:hidden}.omcBaG_surfaceHeader{border-bottom:1px solid var(--dsw-alias-border-l2);min-width:0;padding:14px clamp(18px,3vw,36px) 12px}.omcBaG_headerRow{justify-content:space-between;align-items:flex-start;gap:16px;min-width:0;max-width:880px;margin:0 auto;display:flex}.omcBaG_headerCopy{min-width:0}.omcBaG_headerCopy h1{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;margin:0;font-size:20px;font-weight:600;line-height:28px}.omcBaG_headerCopy p{color:var(--dsw-alias-label-secondary);margin:3px 0 0;font-size:13px;line-height:20px}.omcBaG_headerActions{flex:none;align-items:center;gap:6px;display:flex}.omcBaG_backRow{max-width:880px;margin:0 auto 8px}.omcBaG_timeline{overscroll-behavior:contain;scrollbar-gutter:stable;min-height:0;padding:12px clamp(18px,3vw,36px) 24px;overflow:hidden auto}.omcBaG_timelineContent{flex-direction:column;min-width:0;max-width:880px;min-height:100%;margin:0 auto;display:flex}.omcBaG_emptySurface{margin:auto;padding:32px 0}.omcBaG_emptySurface .omcBaG_emptyState{text-align:center;justify-items:center}.omcBaG_timelineAction{justify-content:center;padding:2px 0 8px;display:flex}.omcBaG_messageRow{gap:10px;padding:10px 0;display:flex}.omcBaG_messageRow[data-grouped]{padding-top:2px}.omcBaG_messageRow[data-grouped] .omcBaG_messageBody>:first-child,.omcBaG_messageRow[data-grouped] .omcBaG_messageBody>:first-child>:first-child{margin-top:0}.omcBaG_messageIdentity{background:hsl(var(--team-avatar-hue,212) 42% 46%);color:#fff;border-radius:50%;flex:0 0 28px;justify-content:center;align-items:center;height:28px;font-size:12px;font-weight:600;display:flex}.omcBaG_messageRow[data-human] .omcBaG_messageIdentity{background:var(--dsw-alias-state-business-primary)}.omcBaG_messageRow[data-grouped] .omcBaG_messageIdentity{visibility:hidden}.omcBaG_messageBody{min-width:0}.omcBaG_nameRow{flex-wrap:wrap;align-items:baseline;gap:8px;display:flex}.omcBaG_nameRow strong{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:20px}.omcBaG_messageTime{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:20px}.omcBaG_messageText{white-space:pre-wrap;word-break:break-word;margin:6px 0;font-size:14px;line-height:22px}.omcBaG_messageClamp{max-height:176px;overflow:hidden;-webkit-mask-image:linear-gradient(#000 72%,#0000 100%);mask-image:linear-gradient(#000 72%,#0000 100%)}.omcBaG_messageExpand{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;width:fit-content;margin-top:4px;padding:0;font-size:12px;line-height:20px;display:block}.omcBaG_messageExpand:hover,.omcBaG_messageExpand:focus-visible{color:var(--dsw-alias-label-primary);text-underline-offset:2px;outline:none;text-decoration:underline}.omcBaG_messageBody .omcBaG_messageMarkdown{font-size:14px;line-height:22px}.omcBaG_messageBody .omcBaG_messageMarkdown>div:first-child{color:var(--dsw-alias-label-primary);font:inherit}.omcBaG_messageBody .omcBaG_messageMarkdown p{margin:6px 0}.omcBaG_messageBody .omcBaG_messageMarkdown :where(ul,ol){margin:6px 0;padding-left:22px}.omcBaG_messageBody .omcBaG_messageMarkdown li+li{margin-top:2px}.omcBaG_messageBody .omcBaG_messageMarkdown strong{font-weight:600}.omcBaG_messageBody .omcBaG_messageMarkdown :where(h1,h2,h3,h4,h5,h6){margin:12px 0 4px}.omcBaG_messageBody .omcBaG_messageMarkdown :where(h1){font-size:17px;line-height:26px}.omcBaG_messageBody .omcBaG_messageMarkdown :where(h2){font-size:16px;line-height:24px}.omcBaG_messageBody .omcBaG_messageMarkdown :where(h3,h4,h5,h6){font-size:15px;line-height:22px}.omcBaG_messageBody .omcBaG_messageMarkdown pre{margin:8px 0;padding:10px 12px;font-size:13px}.omcBaG_messageBody .omcBaG_messageMarkdown blockquote{margin:6px 0}.omcBaG_messageBody .omcBaG_messageMarkdown :where(th,td){padding-block:5px}.omcBaG_emptyState,.omcBaG_loadingState{color:var(--dsw-alias-label-tertiary);margin:0;padding:14px 0;font-size:13px;line-height:20px}.omcBaG_emptyState{gap:3px;display:grid}.omcBaG_emptyState strong{color:var(--dsw-alias-label-secondary);font-weight:500}.omcBaG_emptyState span{font-size:12px}.omcBaG_loadingState{align-items:center;gap:8px;display:flex}.omcBaG_loadingMark{background:var(--dsw-alias-bg-skeleton);border-radius:50%;width:8px;height:8px;animation:1.2s ease-in-out infinite omcBaG_pulse}.omcBaG_error,.omcBaG_errorState{color:var(--dsw-alias-state-error-primary);max-width:880px;margin:0 auto;padding-top:6px;font-size:12px;line-height:18px}.omcBaG_errorState{justify-content:space-between;align-items:center;gap:8px;display:flex}.omcBaG_welcomeSurface{justify-content:center;align-items:center;min-width:0;height:100%;padding:32px;display:flex}.omcBaG_welcome{text-align:center;max-width:420px}.omcBaG_welcomeEyebrow{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;font-size:12px;line-height:18px}.omcBaG_welcome h1{color:var(--dsw-alias-label-primary);margin:8px 0;font-size:24px;font-weight:600;line-height:32px}.omcBaG_welcome p{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:20px}@keyframes omcBaG_pulse{0%,to{opacity:.35}50%{opacity:1}}@media (width<=600px){.omcBaG_surfaceHeader{padding:12px 12px 10px}.omcBaG_headerRow{flex-direction:column;align-items:stretch;gap:8px}.omcBaG_headerActions{flex-wrap:wrap}.omcBaG_backRow{margin-bottom:6px}.omcBaG_timeline{scrollbar-gutter:auto;padding:8px 12px 16px}.omcBaG_messageRow{padding:8px 0}}@media (prefers-reduced-motion:reduce){.omcBaG_loadingMark{animation:none}}.omcBaG_messageRun{margin:2px 0;padding:3px 0}.omcBaG_messageRow[data-grouped]:has(.omcBaG_messageBody>button:not([data-message-expand])){margin-top:3px;padding-top:7px;position:relative}.omcBaG_messageRow[data-grouped]:has(.omcBaG_messageBody>button:not([data-message-expand])):before{background:var(--dsw-alias-border-l2);content:\"\";height:1px;position:absolute;inset:0 0 auto 38px}.omcBaG_runDivider{border-top:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);margin:2px 0 0 38px;padding:5px 0 0;font-size:11px;line-height:16px}.omcBaG_runDivider+.omcBaG_messageRow[data-grouped]:has(.omcBaG_messageBody>button:not([data-message-expand])){margin-top:0}.omcBaG_runDivider+.omcBaG_messageRow[data-grouped]:has(.omcBaG_messageBody>button:not([data-message-expand])):before{content:none}.omcBaG_mention{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent);color:var(--dsw-alias-state-business-primary);border-radius:5px;padding:0 4px;font-weight:500;box-shadow:0 1px 2px #00000014}.omcBaG_mentionsRow{gap:4px;width:fit-content;margin-top:3px;font-size:.85em;display:flex}.omcBaG_attachmentStrip{flex-wrap:wrap;gap:6px;margin-top:4px;display:flex}.omcBaG_attachmentThumb{cursor:zoom-in;border:0;border-radius:8px;padding:0}.omcBaG_attachmentThumb img{object-fit:cover;border-radius:8px;width:128px;height:96px;display:block}.omcBaG_attachmentThumb:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,currentColor);outline-offset:1px}.omcBaG_confirmBody{margin:0 0 8px}.omcBaG_confirmList{gap:6px;margin:0;padding-left:18px;display:grid}.omcBaG_refLink{color:var(--dsw-alias-state-business-primary);cursor:pointer;font:inherit;text-align:left;text-underline-offset:3px;background:0 0;border:none;border-radius:4px;padding:0;text-decoration:underline}.omcBaG_refLink:hover{text-decoration-thickness:2px}.omcBaG_refLink:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}.omcBaG_attachmentModal{width:min(1100px,92vw)}.omcBaG_attachmentZoom{object-fit:contain;border-radius:12px;max-width:100%;max-height:78vh;margin:0 auto;display:block}.omcBaG_attachmentChip{background:var(--dsw-alias-interactive-bg-hover);border-radius:6px;align-items:baseline;gap:6px;max-width:100%;padding:3px 8px;display:inline-flex}.omcBaG_attachmentChipName{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.omcBaG_attachmentChipSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;font-size:11px;line-height:17px}";
7575
- const tagId$4 = "@wowyuarm/dsh-agent-team/conversation.module.css";
7576
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
7815
+ const css$5 = ".omcBaG_surface{grid-template-rows:auto minmax(0,1fr) auto;min-width:0;height:100%;min-height:0;display:grid;overflow:hidden}.omcBaG_surfaceHeader{border-bottom:1px solid var(--dsw-alias-border-l2);min-width:0;padding:14px clamp(18px,3vw,36px) 12px}.omcBaG_headerRow{justify-content:space-between;align-items:flex-start;gap:16px;min-width:0;max-width:880px;margin:0 auto;display:flex}.omcBaG_headerCopy{min-width:0}.omcBaG_headerCopy h1{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;margin:0;font-size:20px;font-weight:600;line-height:28px}.omcBaG_headerCopy p{color:var(--dsw-alias-label-secondary);margin:3px 0 0;font-size:13px;line-height:20px}.omcBaG_headerActions{flex:none;align-items:center;gap:6px;display:flex}.omcBaG_backRow{max-width:880px;margin:0 auto 8px}.omcBaG_timeline{overscroll-behavior:contain;scrollbar-gutter:stable;min-height:0;padding:12px clamp(18px,3vw,36px) 24px;overflow:hidden auto}.omcBaG_timelineContent{flex-direction:column;min-width:0;max-width:880px;min-height:100%;margin:0 auto;display:flex}.omcBaG_emptySurface{margin:auto;padding:32px 0}.omcBaG_emptySurface .omcBaG_emptyState{text-align:center;justify-items:center}.omcBaG_timelineAction{justify-content:center;padding:2px 0 8px;display:flex}.omcBaG_messageRow{gap:10px;padding:10px 0;display:flex}.omcBaG_messageRow[data-grouped]{padding-top:2px}.omcBaG_messageRow[data-grouped] .omcBaG_messageBody>:first-child,.omcBaG_messageRow[data-grouped] .omcBaG_messageBody>:first-child>:first-child{margin-top:0}.omcBaG_messageIdentity{background:hsl(var(--team-avatar-hue,212) 42% 46%);corner-shape:round;color:#fff;border-radius:50%;flex:0 0 28px;justify-content:center;align-items:center;height:28px;font-size:12px;font-weight:600;display:flex}.omcBaG_messageRow[data-human] .omcBaG_messageIdentity{background:var(--dsw-alias-state-business-primary)}.omcBaG_messageRow[data-grouped] .omcBaG_messageIdentity{visibility:hidden}.omcBaG_messageBody{min-width:0}.omcBaG_nameRow{flex-wrap:wrap;align-items:baseline;gap:8px;display:flex}.omcBaG_nameRow strong{color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:20px}.omcBaG_messageTime{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:20px}.omcBaG_messageText{white-space:pre-wrap;word-break:break-word;margin:6px 0;font-size:14px;line-height:22px}.omcBaG_messageClamp{max-height:176px;overflow:hidden;-webkit-mask-image:linear-gradient(#000 72%,#0000 100%);mask-image:linear-gradient(#000 72%,#0000 100%)}.omcBaG_messageExpand{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;width:fit-content;margin-top:4px;padding:0;font-size:12px;line-height:20px;display:block}.omcBaG_messageExpand:hover,.omcBaG_messageExpand:focus-visible{color:var(--dsw-alias-label-primary);text-underline-offset:2px;outline:none;text-decoration:underline}.omcBaG_messageBody .omcBaG_messageMarkdown{font-size:14px;line-height:22px}.omcBaG_messageBody .omcBaG_messageMarkdown>div:first-child{color:var(--dsw-alias-label-primary);font:inherit}.omcBaG_messageBody .omcBaG_messageMarkdown p{margin:6px 0}.omcBaG_messageBody .omcBaG_messageMarkdown :where(ul,ol){margin:6px 0;padding-left:22px}.omcBaG_messageBody .omcBaG_messageMarkdown li+li{margin-top:2px}.omcBaG_messageBody .omcBaG_messageMarkdown strong{font-weight:600}.omcBaG_messageBody .omcBaG_messageMarkdown :where(h1,h2,h3,h4,h5,h6){margin:12px 0 4px}.omcBaG_messageBody .omcBaG_messageMarkdown :where(h1){font-size:17px;line-height:26px}.omcBaG_messageBody .omcBaG_messageMarkdown :where(h2){font-size:16px;line-height:24px}.omcBaG_messageBody .omcBaG_messageMarkdown :where(h3,h4,h5,h6){font-size:15px;line-height:22px}.omcBaG_messageBody .omcBaG_messageMarkdown pre{margin:8px 0;padding:10px 12px;font-size:13px}.omcBaG_messageBody .omcBaG_messageMarkdown blockquote{margin:6px 0}.omcBaG_messageBody .omcBaG_messageMarkdown :where(th,td){padding-block:5px}.omcBaG_emptyState,.omcBaG_loadingState{color:var(--dsw-alias-label-tertiary);margin:0;padding:14px 0;font-size:13px;line-height:20px}.omcBaG_emptyState{gap:3px;display:grid}.omcBaG_emptyState strong{color:var(--dsw-alias-label-secondary);font-weight:500}.omcBaG_emptyState span{font-size:12px}.omcBaG_loadingState{align-items:center;gap:8px;display:flex}.omcBaG_loadingMark{background:var(--dsw-alias-bg-skeleton);corner-shape:round;border-radius:50%;width:8px;height:8px;animation:1.2s ease-in-out infinite omcBaG_pulse}.omcBaG_error,.omcBaG_errorState{color:var(--dsw-alias-state-error-primary);max-width:880px;margin:0 auto;padding-top:6px;font-size:12px;line-height:18px}.omcBaG_errorState{justify-content:space-between;align-items:center;gap:8px;display:flex}.omcBaG_welcomeSurface{justify-content:center;align-items:center;min-width:0;height:100%;padding:32px;display:flex}.omcBaG_welcome{text-align:center;max-width:420px}.omcBaG_welcomeEyebrow{color:var(--dsw-alias-label-tertiary);text-transform:uppercase;font-size:12px;line-height:18px}.omcBaG_welcome h1{color:var(--dsw-alias-label-primary);margin:8px 0;font-size:24px;font-weight:600;line-height:32px}.omcBaG_welcome p{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:20px}@keyframes omcBaG_pulse{0%,to{opacity:.35}50%{opacity:1}}@media (width<=600px){.omcBaG_surfaceHeader{padding:12px 12px 10px}.omcBaG_headerRow{flex-direction:column;align-items:stretch;gap:8px}.omcBaG_headerActions{flex-wrap:wrap}.omcBaG_backRow{margin-bottom:6px}.omcBaG_timeline{scrollbar-gutter:auto;padding:8px 12px 16px}.omcBaG_messageRow{padding:8px 0}}@media (prefers-reduced-motion:reduce){.omcBaG_loadingMark{animation:none}}.omcBaG_messageRun{margin:2px 0;padding:3px 0}.omcBaG_messageRow[data-grouped]:has(.omcBaG_messageBody>button:not([data-message-expand])){margin-top:3px;padding-top:7px;position:relative}.omcBaG_messageRow[data-grouped]:has(.omcBaG_messageBody>button:not([data-message-expand])):before{background:var(--dsw-alias-border-l2);content:\"\";height:1px;position:absolute;inset:0 0 auto 38px}.omcBaG_runDivider{border-top:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-tertiary);margin:2px 0 0 38px;padding:5px 0 0;font-size:11px;line-height:16px}.omcBaG_runDivider+.omcBaG_messageRow[data-grouped]:has(.omcBaG_messageBody>button:not([data-message-expand])){margin-top:0}.omcBaG_runDivider+.omcBaG_messageRow[data-grouped]:has(.omcBaG_messageBody>button:not([data-message-expand])):before{content:none}.omcBaG_mention{background:color-mix(in srgb, var(--dsw-alias-state-business-primary) 12%, transparent);color:var(--dsw-alias-state-business-primary);border-radius:6px;padding:0 4px;font-weight:500;box-shadow:0 1px 2px #00000014}.omcBaG_mentionsRow{gap:4px;width:fit-content;margin-top:3px;font-size:.85em;display:flex}.omcBaG_attachmentStrip{flex-wrap:wrap;gap:6px;margin-top:4px;display:flex}.omcBaG_attachmentThumb{cursor:zoom-in;border:0;border-radius:8px;padding:0}.omcBaG_attachmentThumb img{object-fit:cover;border-radius:8px;width:128px;height:96px;display:block}.omcBaG_attachmentThumb:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,currentColor);outline-offset:1px}.omcBaG_confirmBody{margin:0 0 8px}.omcBaG_confirmList{gap:6px;margin:0;padding-left:18px;display:grid}.omcBaG_refLink{color:var(--dsw-alias-state-business-primary);cursor:pointer;font:inherit;text-align:left;text-underline-offset:3px;background:0 0;border:none;border-radius:4px;padding:0;text-decoration:underline}.omcBaG_refLink:hover{text-decoration-thickness:2px}.omcBaG_refLink:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}.omcBaG_attachmentModal{width:min(1100px,92vw)}.omcBaG_attachmentZoom{object-fit:contain;border-radius:12px;max-width:100%;max-height:78vh;margin:0 auto;display:block}.omcBaG_attachmentChip{background:var(--dsw-alias-interactive-bg-hover);border-radius:6px;align-items:baseline;gap:6px;max-width:100%;padding:3px 8px;display:inline-flex}.omcBaG_attachmentChipName{text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:17px;overflow:hidden}.omcBaG_attachmentChipSize{color:var(--dsw-alias-label-tertiary);white-space:nowrap;font-size:11px;line-height:17px}";
7816
+ const tagId$5 = "@wowyuarm/dsh-agent-team/conversation.module.css";
7817
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$5) + "]") === null) {
7577
7818
  const tag = document.createElement("style");
7578
7819
  tag.dataset.plugin = "@wowyuarm/dsh-agent-team";
7579
- tag.dataset.pluginCss = tagId$4;
7580
- tag.textContent = css$4;
7820
+ tag.dataset.pluginCss = tagId$5;
7821
+ tag.textContent = css$5;
7581
7822
  document.head.appendChild(tag);
7582
7823
  }
7583
7824
  var conversation_module_css_default = {
@@ -7626,8 +7867,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7626
7867
  };
7627
7868
  //#endregion
7628
7869
  //#region src/client/TeamMessage.tsx
7629
- /** One chat message row with identity chrome and sender-appropriate rendering. */
7630
- function TeamMessage({ senderName, memberId, human, body, occurredAt, mentionNames, senderTitle, grouped, showGroupedTime, attachments, loadAttachment, t, onOpenRef, onResolveTaskRefs, children }) {
7870
+ /**
7871
+ * One chat message row with identity chrome and sender-appropriate rendering.
7872
+ *
7873
+ * Memoized because a timeline row is rendered by the page that owns the whole
7874
+ * Thread: the Task-ref subscription below lives inside this component, so
7875
+ * skipping a render here never detaches it. Callers must therefore keep the
7876
+ * props they derive per render (mention names, ref callbacks) identity-stable.
7877
+ */
7878
+ const TeamMessage = (0, react.memo)(function TeamMessage({ senderName, memberId, human, body, occurredAt, mentionNames, senderTitle, grouped, showGroupedTime, attachments, loadAttachment, t, onOpenRef, onResolveTaskRefs, children }) {
7631
7879
  const avatarStyle = human ? void 0 : { "--team-avatar-hue": memberHue(memberId) };
7632
7880
  const plan = planMessageBody(body, {
7633
7881
  human,
@@ -7707,7 +7955,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7707
7955
  }, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: renderRefs(segment.text, onOpenRef, taskLabel, refLabel) }, index))
7708
7956
  }) : plan.render === "literal" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7709
7957
  className: conversation_module_css_default.messageText,
7710
- children: onOpenRef === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MessageText, { text: displayBody }) : renderRefs(displayBody, onOpenRef, taskLabel, refLabel)
7958
+ children: onOpenRef === void 0 ? displayBody : renderRefs(displayBody, onOpenRef, taskLabel, refLabel)
7711
7959
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
7712
7960
  ref: markdownRef,
7713
7961
  className: conversation_module_css_default.messageMarkdown,
@@ -7780,7 +8028,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
7780
8028
  ]
7781
8029
  })]
7782
8030
  });
7783
- }
8031
+ });
7784
8032
  /** Text nodes that Markdown rendered as prose rather than code or a link. */
7785
8033
  function markdownProseTextNodes(root) {
7786
8034
  const nodes = [];
@@ -8142,13 +8390,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8142
8390
  }
8143
8391
  //#endregion
8144
8392
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/channel.module.css.mjs
8145
- const css$3 = ".MYaRJa_headerMeta{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;align-items:center;gap:6px;margin-top:7px;font-size:12px;line-height:18px;display:flex}.MYaRJa_headerMeta span+span:before{content:\"·\";margin-right:6px}.MYaRJa_taskFooter{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);cursor:pointer;text-align:left;background:0 0;border-radius:999px;align-items:center;gap:6px;max-width:100%;margin:6px 0 0;padding:2px 10px;transition:background-color .12s,border-color .12s,color .12s;display:inline-flex}.MYaRJa_taskFooter:hover,.MYaRJa_taskFooter:focus-visible{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary)}.MYaRJa_taskFooter:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.MYaRJa_taskNumber{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:600;line-height:18px}.MYaRJa_taskStatus,.MYaRJa_taskCount{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:18px}.MYaRJa_taskDot{flex:none;align-items:center;width:8px;display:inline-flex}.MYaRJa_taskArrow{color:var(--dsw-alias-label-tertiary);align-items:center;transition:transform .12s;display:inline-flex}.MYaRJa_taskFooter:hover .MYaRJa_taskArrow,.MYaRJa_taskFooter:focus-visible .MYaRJa_taskArrow{transform:translate(2px)}.MYaRJa_memberList{gap:3px;display:grid}.MYaRJa_memberRow{border-radius:6px;grid-template-columns:14px minmax(0,1fr) auto;align-items:center;gap:0 8px;min-height:40px;padding:4px 6px;display:grid}.MYaRJa_memberRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.MYaRJa_memberCopy{min-width:0;display:grid}.MYaRJa_memberCopy strong{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500;line-height:18px;overflow:hidden}.MYaRJa_memberCopy small{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:14px;overflow:hidden}.MYaRJa_memberAction{min-width:60px}.MYaRJa_memberError{color:var(--dsw-alias-state-error-primary);grid-column:2/-1;margin:2px 0;font-size:11px;line-height:16px}.MYaRJa_modalBody{max-height:min(65vh,520px);overflow-y:auto}@media (width<=600px){.MYaRJa_memberRow{grid-template-columns:14px minmax(0,1fr)}.MYaRJa_memberAction{grid-column:2;justify-self:start;margin-top:3px}}@media (prefers-reduced-motion:reduce){.MYaRJa_taskFooter,.MYaRJa_taskArrow{transition:none}.MYaRJa_taskFooter:hover .MYaRJa_taskArrow,.MYaRJa_taskFooter:focus-visible .MYaRJa_taskArrow{transform:none}}";
8146
- const tagId$3 = "@wowyuarm/dsh-agent-team/channel.module.css";
8147
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
8393
+ const css$4 = ".MYaRJa_headerMeta{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;align-items:center;gap:6px;margin-top:7px;font-size:12px;line-height:18px;display:flex}.MYaRJa_headerMeta span+span:before{content:\"·\";margin-right:6px}.MYaRJa_taskFooter{border:1px solid var(--dsw-alias-border-l2);corner-shape:round;color:var(--dsw-alias-label-secondary);cursor:pointer;text-align:left;background:0 0;border-radius:999px;align-items:center;gap:6px;max-width:100%;margin:6px 0 0;padding:2px 10px;transition:background-color .12s,border-color .12s,color .12s;display:inline-flex}.MYaRJa_taskFooter:hover,.MYaRJa_taskFooter:focus-visible{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-border-l3);color:var(--dsw-alias-label-primary)}.MYaRJa_taskFooter:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}.MYaRJa_taskNumber{color:var(--dsw-alias-label-primary);font-size:12px;font-weight:600;line-height:18px}.MYaRJa_taskStatus,.MYaRJa_taskCount{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:18px}.MYaRJa_taskDot{flex:none;align-items:center;width:8px;display:inline-flex}.MYaRJa_taskArrow{color:var(--dsw-alias-label-tertiary);align-items:center;transition:transform .12s;display:inline-flex}.MYaRJa_taskFooter:hover .MYaRJa_taskArrow,.MYaRJa_taskFooter:focus-visible .MYaRJa_taskArrow{transform:translate(2px)}.MYaRJa_memberList{gap:3px;display:grid}.MYaRJa_memberRow{border-radius:6px;grid-template-columns:14px minmax(0,1fr) auto;align-items:center;gap:0 8px;min-height:40px;padding:4px 6px;display:grid}.MYaRJa_memberRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.MYaRJa_memberCopy{min-width:0;display:grid}.MYaRJa_memberCopy strong{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500;line-height:18px;overflow:hidden}.MYaRJa_memberCopy small{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:14px;overflow:hidden}.MYaRJa_memberAction{min-width:60px}.MYaRJa_memberError{color:var(--dsw-alias-state-error-primary);grid-column:2/-1;margin:2px 0;font-size:11px;line-height:16px}.MYaRJa_modalBody{max-height:min(65vh,520px);overflow-y:auto}@media (width<=600px){.MYaRJa_memberRow{grid-template-columns:14px minmax(0,1fr)}.MYaRJa_memberAction{grid-column:2;justify-self:start;margin-top:3px}}@media (prefers-reduced-motion:reduce){.MYaRJa_taskFooter,.MYaRJa_taskArrow{transition:none}.MYaRJa_taskFooter:hover .MYaRJa_taskArrow,.MYaRJa_taskFooter:focus-visible .MYaRJa_taskArrow{transform:none}}";
8394
+ const tagId$4 = "@wowyuarm/dsh-agent-team/channel.module.css";
8395
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$4) + "]") === null) {
8148
8396
  const tag = document.createElement("style");
8149
8397
  tag.dataset.plugin = "@wowyuarm/dsh-agent-team";
8150
- tag.dataset.pluginCss = tagId$3;
8151
- tag.textContent = css$3;
8398
+ tag.dataset.pluginCss = tagId$4;
8399
+ tag.textContent = css$4;
8152
8400
  document.head.appendChild(tag);
8153
8401
  }
8154
8402
  var channel_module_css_default = {
@@ -8168,13 +8416,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8168
8416
  };
8169
8417
  //#endregion
8170
8418
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/thread.module.css.mjs
8171
- const css$2 = ".-Qiwua_titleLine{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.-Qiwua_titleLine h1{margin:0}.-Qiwua_workSection{border-top:1px solid var(--dsw-alias-border-l2);max-width:880px;margin:12px auto 0;padding-top:8px}.-Qiwua_riskSection{border-top:1px solid var(--dsw-alias-border-l2);max-width:880px;margin:12px auto 0;padding-top:10px}.-Qiwua_riskSection h2{color:var(--dsw-alias-state-error-primary);margin:0 0 5px;font-size:12px;font-weight:600;line-height:18px}.-Qiwua_riskRow{color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin:3px 0;font-size:12px;line-height:18px;display:flex}.-Qiwua_claimList{gap:4px;padding:4px 0 2px 22px;display:grid}.-Qiwua_claimRow{border-radius:6px;grid-template-columns:14px minmax(96px,auto) minmax(0,1fr) auto auto;align-items:center;gap:4px 8px;min-height:36px;padding:4px 6px;display:grid}.-Qiwua_claimRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.-Qiwua_claimOwner{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:18px;overflow:hidden}.-Qiwua_claimDirection{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;min-width:0;font-size:12px;line-height:18px}.-Qiwua_claimState{color:var(--dsw-alias-label-tertiary);white-space:nowrap;font-size:11px;line-height:18px}.-Qiwua_emptyClaims{color:var(--dsw-alias-label-tertiary);margin:0;padding:5px 6px;font-size:11px;line-height:18px}.-Qiwua_activityRow{color:var(--dsw-alias-label-tertiary);text-align:center;justify-content:center;align-items:center;gap:8px;max-width:100%;margin:4px auto;padding:5px 12px;font-size:11px;line-height:18px;display:flex}.-Qiwua_activityText{overflow-wrap:anywhere;min-width:0}.-Qiwua_activityMark{background:var(--dsw-alias-border-l3);border-radius:50%;flex:0 0 5px;width:5px;height:5px}.-Qiwua_activityRow:has(+.-Qiwua_activityRow),.-Qiwua_activityRow+.-Qiwua_activityRow{text-align:left;justify-content:flex-start;padding-left:38px}.-Qiwua_historySection{border-bottom:1px solid var(--dsw-alias-border-l2);max-width:100%;margin:0 auto 12px;padding-bottom:10px}.-Qiwua_historySection h2{color:var(--dsw-alias-label-tertiary);letter-spacing:.02em;text-transform:uppercase;margin:0 0 4px;font-size:11px;font-weight:600;line-height:16px}.-Qiwua_publicSection{min-width:0}.-Qiwua_unreadBoundary{color:var(--dsw-alias-label-tertiary);align-items:center;gap:10px;margin:10px 0 6px;font-size:11px;line-height:16px;display:flex}.-Qiwua_unreadBoundary:before,.-Qiwua_unreadBoundary:after{background:var(--dsw-alias-border-l3);content:\"\";flex:1;height:1px}.-Qiwua_unreadBoundary span{flex:none}.-Qiwua_daySeparator{color:var(--dsw-alias-label-tertiary);letter-spacing:.02em;align-items:center;gap:10px;margin:12px 0 4px;font-size:11px;line-height:16px;display:flex}.-Qiwua_daySeparator:before,.-Qiwua_daySeparator:after{background:var(--dsw-alias-border-l2);content:\"\";flex:1;height:1px}.-Qiwua_daySeparator span{flex:none}.-Qiwua_newUpdates{background:var(--dsw-specific-input-major,var(--dsw-alias-bg-layer-1));border:1px solid var(--dsw-alias-border-l2-darkmode-thin);box-shadow:var(--dsw-shadow-lv2);z-index:2;border-radius:999px;justify-content:center;align-items:center;width:fit-content;margin:8px auto;padding:4px 12px;font-size:12px;line-height:18px;display:flex;position:sticky;bottom:8px}.-Qiwua_newUpdatesJump{color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;line-height:inherit;background:0 0;border:0;padding:0}.-Qiwua_newUpdatesJump:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px;border-radius:6px}.-Qiwua_taskTitle{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin:2px 0 0;font-size:13px;line-height:20px;display:-webkit-box;overflow:hidden}.-Qiwua_closedBar{flex-direction:column;align-items:center;display:flex}.-Qiwua_closedNotice{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;justify-content:center;align-items:center;gap:12px;padding:10px 16px 14px;font-size:13px;line-height:20px;display:flex}@media (width<=600px){.-Qiwua_claimRow{grid-template-columns:14px minmax(0,1fr) auto;align-items:start}.-Qiwua_claimState{grid-area:1/3;justify-self:end}.-Qiwua_claimDirection{grid-column:2/-1}.-Qiwua_activityRow{padding-inline:0}.-Qiwua_newUpdates{max-width:calc(100% - 16px)}}";
8172
- const tagId$2 = "@wowyuarm/dsh-agent-team/thread.module.css";
8173
- if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
8419
+ const css$3 = ".-Qiwua_titleLine{flex-wrap:wrap;align-items:center;gap:10px;display:flex}.-Qiwua_titleLine h1{margin:0}.-Qiwua_workSection{border-top:1px solid var(--dsw-alias-border-l2);max-width:880px;margin:12px auto 0;padding-top:8px}.-Qiwua_riskSection{border-top:1px solid var(--dsw-alias-border-l2);max-width:880px;margin:12px auto 0;padding-top:10px}.-Qiwua_riskSection h2{color:var(--dsw-alias-state-error-primary);margin:0 0 5px;font-size:12px;font-weight:600;line-height:18px}.-Qiwua_riskRow{color:var(--dsw-alias-label-secondary);align-items:center;gap:8px;margin:3px 0;font-size:12px;line-height:18px;display:flex}.-Qiwua_claimList{gap:4px;padding:4px 0 2px 22px;display:grid}.-Qiwua_claimRow{border-radius:6px;grid-template-columns:14px minmax(96px,auto) minmax(0,1fr) auto auto;align-items:center;gap:4px 8px;min-height:36px;padding:4px 6px;display:grid}.-Qiwua_claimRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.-Qiwua_claimOwner{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;font-size:11px;font-weight:500;line-height:18px;overflow:hidden}.-Qiwua_claimDirection{color:var(--dsw-alias-label-primary);overflow-wrap:anywhere;min-width:0;font-size:12px;line-height:18px}.-Qiwua_claimState{color:var(--dsw-alias-label-tertiary);white-space:nowrap;font-size:11px;line-height:18px}.-Qiwua_emptyClaims{color:var(--dsw-alias-label-tertiary);margin:0;padding:5px 6px;font-size:11px;line-height:18px}.-Qiwua_activityRow{color:var(--dsw-alias-label-tertiary);text-align:center;justify-content:center;align-items:center;gap:8px;max-width:100%;margin:4px auto;padding:5px 12px;font-size:11px;line-height:18px;display:flex}.-Qiwua_activityText{overflow-wrap:anywhere;min-width:0}.-Qiwua_activityMark{background:var(--dsw-alias-border-l3);corner-shape:round;border-radius:50%;flex:0 0 5px;width:5px;height:5px}.-Qiwua_activityRow:has(+.-Qiwua_activityRow),.-Qiwua_activityRow+.-Qiwua_activityRow{text-align:left;justify-content:flex-start;padding-left:38px}.-Qiwua_historySection{border-bottom:1px solid var(--dsw-alias-border-l2);max-width:100%;margin:0 auto 12px;padding-bottom:10px}.-Qiwua_historySection h2{color:var(--dsw-alias-label-tertiary);letter-spacing:.02em;text-transform:uppercase;margin:0 0 4px;font-size:11px;font-weight:600;line-height:16px}.-Qiwua_publicSection{min-width:0}.-Qiwua_unreadBoundary{color:var(--dsw-alias-label-tertiary);align-items:center;gap:10px;margin:10px 0 6px;font-size:11px;line-height:16px;display:flex}.-Qiwua_unreadBoundary:before,.-Qiwua_unreadBoundary:after{background:var(--dsw-alias-border-l3);content:\"\";flex:1;height:1px}.-Qiwua_unreadBoundary span{flex:none}.-Qiwua_daySeparator{color:var(--dsw-alias-label-tertiary);letter-spacing:.02em;align-items:center;gap:10px;margin:12px 0 4px;font-size:11px;line-height:16px;display:flex}.-Qiwua_daySeparator:before,.-Qiwua_daySeparator:after{background:var(--dsw-alias-border-l2);content:\"\";flex:1;height:1px}.-Qiwua_daySeparator span{flex:none}.-Qiwua_newUpdates{background:var(--dsw-specific-input-major,var(--dsw-alias-bg-layer-1));border:1px solid var(--dsw-alias-border-l2-darkmode-thin);corner-shape:round;box-shadow:var(--dsw-shadow-lv2);z-index:2;border-radius:999px;justify-content:center;align-items:center;width:fit-content;margin:8px auto;padding:4px 12px;font-size:12px;line-height:18px;display:flex;position:sticky;bottom:8px}.-Qiwua_newUpdatesJump{color:var(--dsw-alias-label-secondary);cursor:pointer;font:inherit;line-height:inherit;background:0 0;border:0;padding:0}.-Qiwua_newUpdatesJump:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px;border-radius:6px}.-Qiwua_taskTitle{color:var(--dsw-alias-label-secondary);-webkit-line-clamp:2;overflow-wrap:anywhere;-webkit-box-orient:vertical;margin:2px 0 0;font-size:13px;line-height:20px;display:-webkit-box;overflow:hidden}.-Qiwua_closedBar{flex-direction:column;align-items:center;display:flex}.-Qiwua_closedNotice{color:var(--dsw-alias-label-tertiary);flex-wrap:wrap;justify-content:center;align-items:center;gap:12px;padding:10px 16px 14px;font-size:13px;line-height:20px;display:flex}@media (width<=600px){.-Qiwua_claimRow{grid-template-columns:14px minmax(0,1fr) auto;align-items:start}.-Qiwua_claimState{grid-area:1/3;justify-self:end}.-Qiwua_claimDirection{grid-column:2/-1}.-Qiwua_activityRow{padding-inline:0}.-Qiwua_newUpdates{max-width:calc(100% - 16px)}}";
8420
+ const tagId$3 = "@wowyuarm/dsh-agent-team/thread.module.css";
8421
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$3) + "]") === null) {
8174
8422
  const tag = document.createElement("style");
8175
8423
  tag.dataset.plugin = "@wowyuarm/dsh-agent-team";
8176
- tag.dataset.pluginCss = tagId$2;
8177
- tag.textContent = css$2;
8424
+ tag.dataset.pluginCss = tagId$3;
8425
+ tag.textContent = css$3;
8178
8426
  document.head.appendChild(tag);
8179
8427
  }
8180
8428
  var thread_module_css_default = {
@@ -8229,10 +8477,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8229
8477
  const [loadingOlder, setLoadingOlder] = (0, react.useState)(false);
8230
8478
  const [managingMembers, setManagingMembers] = (0, react.useState)(false);
8231
8479
  const draftKey = `channel:${channelRef}`;
8232
- const { draft, recipients } = (0, react.useSyncExternalStore)(drafts.subscribe, () => drafts.getSnapshot(draftKey));
8233
8480
  const manageTriggerRef = (0, react.useRef)(null);
8234
8481
  const memberListRef = (0, react.useRef)(null);
8235
8482
  const mountedRef = (0, react.useRef)(false);
8483
+ const loadedRef = (0, react.useRef)(false);
8236
8484
  const refreshSequenceRef = (0, react.useRef)(0);
8237
8485
  const channelLastItem = view?.items[view.items.length - 1];
8238
8486
  const openRef = (ref) => {
@@ -8282,7 +8530,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8282
8530
  if (!mountedRef.current) return false;
8283
8531
  const sequence = refreshSequenceRef.current + 1;
8284
8532
  refreshSequenceRef.current = sequence;
8285
- setLoading(true);
8533
+ if (!loadedRef.current) setLoading(true);
8286
8534
  if (clearError) {
8287
8535
  setError(void 0);
8288
8536
  setStatusMessage(void 0);
@@ -8297,8 +8545,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8297
8545
  limit: 20
8298
8546
  }), loadMembers({ workspaceId })]);
8299
8547
  if (!mountedRef.current || sequence !== refreshSequenceRef.current) return false;
8300
- if (loaded.ok) setView((current) => current === void 0 ? loaded.value : mergeChannelView(current, loaded.value));
8301
- else setError(loaded.error.message);
8548
+ if (loaded.ok) {
8549
+ setView((current) => current === void 0 ? loaded.value : mergeChannelView(current, loaded.value));
8550
+ loadedRef.current = true;
8551
+ } else setError(loaded.error.message);
8302
8552
  if (loadedMembers.ok) setMembers(loadedMembers.value);
8303
8553
  else setError(loadedMembers.error.message);
8304
8554
  return loaded.ok && loadedMembers.ok;
@@ -8322,32 +8572,47 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8322
8572
  };
8323
8573
  (0, react.useEffect)(() => {
8324
8574
  mountedRef.current = true;
8575
+ loadedRef.current = false;
8325
8576
  setView(void 0);
8326
8577
  setError(void 0);
8327
8578
  setLoading(true);
8328
8579
  setManagingMembers(false);
8329
8580
  refresh();
8330
- const disposers = [subscribeChanges({
8331
- kind: "channel",
8332
- channelRef
8333
- }, (update) => {
8334
- if (!mountedRef.current) return;
8335
- if (update.type === "failed") {
8336
- setError(update.message);
8337
- return;
8338
- }
8339
- refresh();
8340
- }), subscribeChanges({
8341
- kind: "workspace",
8342
- workspaceId
8343
- }, (update) => {
8344
- if (!mountedRef.current) return;
8345
- if (update.type === "failed") {
8346
- setError(update.message);
8347
- return;
8348
- }
8349
- refreshMembers();
8350
- })];
8581
+ const disposers = [
8582
+ subscribeChanges({
8583
+ kind: "channel",
8584
+ channelRef
8585
+ }, (update) => {
8586
+ if (!mountedRef.current) return;
8587
+ if (update.type === "failed") {
8588
+ setError(update.message);
8589
+ return;
8590
+ }
8591
+ refresh();
8592
+ }),
8593
+ subscribeChanges({
8594
+ kind: "workspace",
8595
+ workspaceId
8596
+ }, (update) => {
8597
+ if (!mountedRef.current) return;
8598
+ if (update.type === "failed") {
8599
+ setError(update.message);
8600
+ return;
8601
+ }
8602
+ refreshMembers();
8603
+ }),
8604
+ subscribeChanges({
8605
+ kind: "presence",
8606
+ workspaceId
8607
+ }, (update) => {
8608
+ if (!mountedRef.current) return;
8609
+ if (update.type === "failed") {
8610
+ setError(update.message);
8611
+ return;
8612
+ }
8613
+ refreshMembers();
8614
+ })
8615
+ ];
8351
8616
  return () => {
8352
8617
  mountedRef.current = false;
8353
8618
  refreshSequenceRef.current += 1;
@@ -8398,7 +8663,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8398
8663
  await refresh();
8399
8664
  });
8400
8665
  const pendingSendId = (0, react.useRef)();
8666
+ const clearSendState = (0, react.useCallback)(() => {
8667
+ setStatusMessage((current) => current === void 0 ? current : void 0);
8668
+ }, []);
8401
8669
  const send = async () => {
8670
+ const { draft, recipients } = drafts.getSnapshot(draftKey);
8402
8671
  if (pending || draft.trim() === "") return;
8403
8672
  const recipientIds = [...recipients].sort();
8404
8673
  const requestId = pendingSendId.current ?? mintRequestId();
@@ -8407,22 +8676,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8407
8676
  setError(void 0);
8408
8677
  setStatusMessage(void 0);
8409
8678
  try {
8410
- const attachmentIds = [];
8411
- for (const file of pendingFiles) {
8412
- const uploaded = await putAttachment({
8413
- requestId: mintRequestId(),
8414
- workspaceId,
8415
- name: file.name,
8416
- mediaType: file.type === "" ? void 0 : file.type,
8417
- bytesBase64: bytesToBase64(new Uint8Array(await file.arrayBuffer()))
8418
- });
8419
- if (!uploaded.ok) {
8420
- pendingSendId.current = void 0;
8421
- setError(uploaded.error.message);
8422
- return;
8423
- }
8424
- attachmentIds.push(uploaded.value.attachmentId);
8679
+ const upload = await uploadComposerFiles(putAttachment, workspaceId, pendingFiles);
8680
+ if (!upload.ok) {
8681
+ pendingSendId.current = void 0;
8682
+ setError(upload.error);
8683
+ return;
8425
8684
  }
8685
+ const attachmentIds = upload.attachmentIds;
8426
8686
  const result = await sendMessage({
8427
8687
  requestId,
8428
8688
  workspaceId,
@@ -8687,19 +8947,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8687
8947
  }),
8688
8948
  channel !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamComposer, {
8689
8949
  members: channelMembers,
8690
- recipients,
8691
- draft,
8950
+ drafts,
8951
+ draftKey,
8692
8952
  pending,
8693
8953
  ...statusMessage === void 0 ? {} : { confirmation: statusMessage },
8694
8954
  ...error === void 0 ? {} : { error },
8695
- onDraftChange: (next) => {
8696
- drafts.writeDraft(draftKey, next);
8697
- setStatusMessage(void 0);
8698
- },
8699
- onRecipientsChange: (next) => {
8700
- drafts.writeRecipients(draftKey, next);
8701
- setStatusMessage(void 0);
8702
- },
8955
+ onEdit: clearSendState,
8703
8956
  onSubmit: () => {
8704
8957
  send();
8705
8958
  },
@@ -8713,6 +8966,260 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8713
8966
  });
8714
8967
  }
8715
8968
  //#endregion
8969
+ //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/inbox.module.css.mjs
8970
+ const css$2 = ".s2ibaa_list{flex-direction:column;gap:2px;display:flex}.s2ibaa_headerMeta{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.s2ibaa_row{color:inherit;cursor:pointer;font:inherit;text-align:left;background:0 0;border:0;border-radius:8px;grid-template-columns:minmax(0,1fr) auto;align-items:baseline;gap:2px 12px;width:100%;padding:9px 8px;display:grid}.s2ibaa_row:hover,.s2ibaa_row:focus-visible{background:var(--dsw-alias-interactive-bg-hover)}.s2ibaa_row:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}.s2ibaa_rowCrumb{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;grid-column:1;min-width:0;font-size:12px;line-height:18px;overflow:hidden}.s2ibaa_rowChannel{color:var(--dsw-alias-label-secondary);font-weight:600}.s2ibaa_rowTask{border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);white-space:nowrap;border-radius:6px;margin-left:8px;padding:0 5px;font-size:11px;font-weight:600;line-height:15px}.s2ibaa_rowPreview{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;grid-column:1/-1;min-width:0;font-size:14px;line-height:22px;overflow:hidden}.s2ibaa_rowTime{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;white-space:nowrap;grid-area:1/2;font-size:11px;line-height:18px}";
8971
+ const tagId$2 = "@wowyuarm/dsh-agent-team/inbox.module.css";
8972
+ if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$2) + "]") === null) {
8973
+ const tag = document.createElement("style");
8974
+ tag.dataset.plugin = "@wowyuarm/dsh-agent-team";
8975
+ tag.dataset.pluginCss = tagId$2;
8976
+ tag.textContent = css$2;
8977
+ document.head.appendChild(tag);
8978
+ }
8979
+ var inbox_module_css_default = {
8980
+ "headerMeta": "s2ibaa_headerMeta",
8981
+ "list": "s2ibaa_list",
8982
+ "row": "s2ibaa_row",
8983
+ "rowChannel": "s2ibaa_rowChannel",
8984
+ "rowCrumb": "s2ibaa_rowCrumb",
8985
+ "rowPreview": "s2ibaa_rowPreview",
8986
+ "rowTask": "s2ibaa_rowTask",
8987
+ "rowTime": "s2ibaa_rowTime"
8988
+ };
8989
+ //#endregion
8990
+ //#region src/client/TeamInboxPage.tsx
8991
+ /**
8992
+ * Queue order: newest mention first, one total order across Workspaces. Each
8993
+ * Workspace slice arrives in the Host's own order (that order is the Host's
8994
+ * truncation policy); the merged display order is decided here, where the
8995
+ * merge happens, and the ledger sequence breaks ties so the queue never
8996
+ * reshuffles two rows that share an instant.
8997
+ */
8998
+ function compareInboxRows(left, right) {
8999
+ const leftAt = Date.parse(left.item.newestOccurredAt);
9000
+ const rightAt = Date.parse(right.item.newestOccurredAt);
9001
+ const byTime = (Number.isNaN(rightAt) ? 0 : rightAt) - (Number.isNaN(leftAt) ? 0 : leftAt);
9002
+ return byTime !== 0 ? byTime : right.item.newestSequence - left.item.newestSequence;
9003
+ }
9004
+ /**
9005
+ * The Human 「提到我」 queue: one direct-only Inbox call per visible Workspace,
9006
+ * merged into a single recency-ordered list — newest mention first across every
9007
+ * Workspace, since a queue is read by recency rather than by Workspace.
9008
+ * Opening the page never acknowledges anything — only a durable Thread read
9009
+ * consumes a mention marker, so rows and the badge drop after the Thread is
9010
+ * opened through the existing auto-ack path.
9011
+ */
9012
+ function TeamInboxPage({ useWorkspaces, loadInbox, subscribeChanges, selectWorkspace, selectThread, t }) {
9013
+ const workspaces = useWorkspaces((state) => state.items);
9014
+ const [rows, setRows] = (0, react.useState)();
9015
+ const [loading, setLoading] = (0, react.useState)(true);
9016
+ const [error, setError] = (0, react.useState)();
9017
+ const loadedRef = (0, react.useRef)(false);
9018
+ const refresh = (0, react.useCallback)(async () => {
9019
+ if (!loadedRef.current) setLoading(true);
9020
+ const results = await Promise.all(workspaces.map(async (workspace) => {
9021
+ const result = await loadInbox({
9022
+ workspaceId: workspace.workspaceId,
9023
+ directOnly: true,
9024
+ limit: 100
9025
+ });
9026
+ return result.ok ? {
9027
+ ok: true,
9028
+ workspaceId: workspace.workspaceId,
9029
+ workspaceTitle: workspace.title,
9030
+ items: result.value.items
9031
+ } : {
9032
+ ok: false,
9033
+ message: result.error.message
9034
+ };
9035
+ }));
9036
+ const failure = results.find((result) => !result.ok);
9037
+ setRows(results.flatMap((result) => result.ok ? result.items.map((item) => ({
9038
+ workspaceId: result.workspaceId,
9039
+ workspaceTitle: result.workspaceTitle,
9040
+ item
9041
+ })) : []).sort(compareInboxRows));
9042
+ setError(failure?.ok === false ? failure.message : void 0);
9043
+ loadedRef.current = true;
9044
+ setLoading(false);
9045
+ }, [loadInbox, workspaces]);
9046
+ (0, react.useEffect)(() => {
9047
+ refresh();
9048
+ }, [refresh]);
9049
+ (0, react.useEffect)(() => subscribeChanges(void 0, (update) => {
9050
+ if (update.type === "failed") {
9051
+ setError(update.message);
9052
+ return;
9053
+ }
9054
+ refresh();
9055
+ }), [subscribeChanges, refresh]);
9056
+ const open = (row) => {
9057
+ selectWorkspace(row.workspaceId);
9058
+ selectThread(row.item.thread.threadRef, row.item.channelRef, row.item.task?.taskRef, row.item.taskNumber);
9059
+ };
9060
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("main", {
9061
+ className: conversation_module_css_default.surface,
9062
+ "data-team-inbox": true,
9063
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9064
+ className: conversation_module_css_default.surfaceHeader,
9065
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("header", {
9066
+ className: conversation_module_css_default.headerRow,
9067
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9068
+ className: conversation_module_css_default.headerCopy,
9069
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", { children: t("mentionsOfMe") }), rows !== void 0 && rows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9070
+ className: inbox_module_css_default.headerMeta,
9071
+ children: t("inboxHeaderMeta", {
9072
+ threads: rows.length,
9073
+ mentions: rows.reduce((sum, row) => sum + row.item.directCount, 0)
9074
+ })
9075
+ })]
9076
+ })
9077
+ })
9078
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9079
+ className: conversation_module_css_default.timeline,
9080
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9081
+ className: conversation_module_css_default.timelineContent,
9082
+ children: [
9083
+ loading && rows === void 0 && error === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9084
+ className: conversation_module_css_default.emptySurface,
9085
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
9086
+ className: conversation_module_css_default.loadingState,
9087
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9088
+ className: conversation_module_css_default.loadingMark,
9089
+ "aria-hidden": "true"
9090
+ }), t("loadingInbox")]
9091
+ })
9092
+ }),
9093
+ !loading && rows === void 0 && error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9094
+ className: conversation_module_css_default.errorState,
9095
+ role: "alert",
9096
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: error }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
9097
+ size: "sm",
9098
+ variant: "outline",
9099
+ onClick: () => {
9100
+ refresh();
9101
+ },
9102
+ children: t("retry")
9103
+ })]
9104
+ }),
9105
+ rows !== void 0 && (rows.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9106
+ className: conversation_module_css_default.emptySurface,
9107
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9108
+ className: conversation_module_css_default.emptyState,
9109
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("inboxEmptyTitle") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("inboxEmptyHint") })]
9110
+ })
9111
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9112
+ className: inbox_module_css_default.list,
9113
+ children: rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
9114
+ type: "button",
9115
+ className: inbox_module_css_default.row,
9116
+ onClick: () => {
9117
+ open(row);
9118
+ },
9119
+ children: [
9120
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9121
+ className: inbox_module_css_default.rowCrumb,
9122
+ children: [
9123
+ row.workspaceTitle,
9124
+ " / ",
9125
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
9126
+ className: inbox_module_css_default.rowChannel,
9127
+ children: ["#", row.item.channelName]
9128
+ }),
9129
+ row.item.taskNumber !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9130
+ className: inbox_module_css_default.rowTask,
9131
+ children: t("taskLabel", { number: row.item.taskNumber })
9132
+ })
9133
+ ]
9134
+ }),
9135
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
9136
+ className: inbox_module_css_default.rowPreview,
9137
+ children: row.item.previewText
9138
+ }),
9139
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("time", {
9140
+ className: inbox_module_css_default.rowTime,
9141
+ dateTime: row.item.newestOccurredAt,
9142
+ title: formatAbsoluteTime(row.item.newestOccurredAt),
9143
+ children: formatInboxTime(row.item.newestOccurredAt, t)
9144
+ })
9145
+ ]
9146
+ }, `${row.workspaceId} ${row.item.thread.threadRef}`))
9147
+ })),
9148
+ rows !== void 0 && error !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9149
+ className: conversation_module_css_default.error,
9150
+ role: "alert",
9151
+ children: error
9152
+ })
9153
+ ]
9154
+ })
9155
+ })]
9156
+ });
9157
+ }
9158
+ //#endregion
9159
+ //#region src/client/scope-coverage.ts
9160
+ /**
9161
+ * Per-scope coverage of the change versions one surface has already answered.
9162
+ *
9163
+ * A version is only comparable inside the scope that issued it: the Host
9164
+ * answers a workspace scope from the durable ledger position and a presence
9165
+ * scope from its process-local wake epoch, which starts low and climbs on every
9166
+ * Agent transition. One high-water mark shared by both would therefore let a
9167
+ * presence epoch swallow a later, smaller ledger sequence and park the surface
9168
+ * on stale data, so coverage and pending versions are kept per scope.
9169
+ *
9170
+ * One round answers one version per scope. The Host delivers one event to every
9171
+ * matching scope, so the first version a round sees in a scope it has not
9172
+ * answered yet is that event reaching a second scope, and joins the round
9173
+ * already fetching instead of earning a second identical read. A newer version
9174
+ * in a scope the round has answered arrived after the round issued its fetch,
9175
+ * so it owes one trailing round.
9176
+ */
9177
+ var ScopeCoverage = class {
9178
+ covered = /* @__PURE__ */ new Map();
9179
+ pending = /* @__PURE__ */ new Map();
9180
+ /** The scopes the open round has an answer for. */
9181
+ answered = /* @__PURE__ */ new Set();
9182
+ fetching = false;
9183
+ /** Folds one wake in and answers whether it opens a round. */
9184
+ wake(scope, version) {
9185
+ if (version <= this.coveredOf(scope)) return false;
9186
+ if (this.fetching && this.answered.has(scope)) {
9187
+ this.pending.set(scope, Math.max(this.pending.get(scope) ?? 0, version));
9188
+ return false;
9189
+ }
9190
+ this.answered.add(scope);
9191
+ this.covered.set(scope, version);
9192
+ return !this.fetching;
9193
+ }
9194
+ /** Opens a round's fetch window; versions observed from here on are pending. */
9195
+ beginRound() {
9196
+ this.pending.clear();
9197
+ this.fetching = true;
9198
+ }
9199
+ /** Closes a round's fetch window and answers whether a trailing round is owed. */
9200
+ finishRound() {
9201
+ this.fetching = false;
9202
+ this.answered.clear();
9203
+ let owed = false;
9204
+ for (const [scope, version] of this.pending) {
9205
+ if (version <= this.coveredOf(scope)) continue;
9206
+ this.covered.set(scope, version);
9207
+ owed = true;
9208
+ }
9209
+ return owed;
9210
+ }
9211
+ /** Drops every observation: a new owner starts with nothing covered. */
9212
+ reset() {
9213
+ this.covered.clear();
9214
+ this.pending.clear();
9215
+ this.answered.clear();
9216
+ this.fetching = false;
9217
+ }
9218
+ coveredOf(scope) {
9219
+ return this.covered.get(scope) ?? 0;
9220
+ }
9221
+ };
9222
+ //#endregion
8716
9223
  //#region src/client/TeamThreadPage.tsx
8717
9224
  function factKey(fact) {
8718
9225
  return fact.kind === "message" ? `message:${fact.message.messageRef}` : `activity:${fact.activity.activityRef}`;
@@ -8722,9 +9229,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8722
9229
  kind: "message",
8723
9230
  sequence: message.sequence,
8724
9231
  message,
8725
- mentions
9232
+ mentions,
9233
+ occurredAt: message.occurredAt
8726
9234
  };
8727
9235
  }
9236
+ /**
9237
+ * A fact owns its mention array, so the rendered name list is cached against
9238
+ * that array. Every roster refresh replaces the handles map with a fresh Map of
9239
+ * identical content, so the cache compares the resolved names rather than the
9240
+ * map identity: identity stays stable while the names are unchanged, which is
9241
+ * what keeps a memoized row from re-rendering on every refresh.
9242
+ */
9243
+ const mentionNamesCache = /* @__PURE__ */ new WeakMap();
9244
+ function stableMentionNames(mentions, handles) {
9245
+ const names = mentionNamesOf(mentions, handles);
9246
+ const cached = mentionNamesCache.get(mentions);
9247
+ if (cached !== void 0 && cached.length === names.length && cached.every((name, index) => name === names[index])) return cached;
9248
+ mentionNamesCache.set(mentions, names);
9249
+ return names;
9250
+ }
8728
9251
  function mergeFacts(...groups) {
8729
9252
  const byKey = /* @__PURE__ */ new Map();
8730
9253
  for (const group of groups) for (const fact of group) byKey.set(factKey(fact), fact);
@@ -8755,7 +9278,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8755
9278
  const [autoReadExhausted, setAutoReadExhausted] = (0, react.useState)(false);
8756
9279
  const [newFactsCount, setNewFactsCount] = (0, react.useState)(0);
8757
9280
  const draftKey = `thread:${threadRef}`;
8758
- const { draft, recipients } = (0, react.useSyncExternalStore)(drafts.subscribe, () => drafts.getSnapshot(draftKey));
8759
9281
  const [claimsOpen, setClaimsOpen] = (0, react.useState)(false);
8760
9282
  const [confirmingAccept, setConfirmingAccept] = (0, react.useState)(false);
8761
9283
  (0, react.useEffect)(() => {
@@ -8825,7 +9347,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8825
9347
  if (mountedRef.current && sequence === sequenceRef.current) setLoading(false);
8826
9348
  }
8827
9349
  };
8828
- const refreshSupplemental = async () => {
9350
+ /** One roster + view read. Answers false once the page is gone. */
9351
+ const applySupplemental = async () => {
8829
9352
  try {
8830
9353
  const [loadedMembers, loadedView] = await Promise.all([loadMembers({ workspaceId }), loadChannels({
8831
9354
  workspaceId,
@@ -8834,15 +9357,36 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8834
9357
  includeActivities: false,
8835
9358
  limit: 1
8836
9359
  })]);
8837
- if (!mountedRef.current) return;
9360
+ if (!mountedRef.current) return false;
8838
9361
  if (loadedMembers.ok) setMembers(loadedMembers.value);
8839
9362
  if (loadedView.ok) setChannelView(loadedView.value);
8840
9363
  const failure = [loadedMembers, loadedView].find((result) => !result.ok);
8841
9364
  if (failure !== void 0 && !failure.ok) setError(failure.error.message);
9365
+ return true;
8842
9366
  } catch (cause) {
8843
9367
  if (mountedRef.current) setError(cause instanceof Error ? cause.message : String(cause));
9368
+ return mountedRef.current;
8844
9369
  }
8845
9370
  };
9371
+ const supplementalRef = (0, react.useRef)();
9372
+ const supplementalCoverageRef = (0, react.useRef)(new ScopeCoverage());
9373
+ const refreshSupplemental = (wake) => {
9374
+ const inFlight = supplementalRef.current;
9375
+ if (wake === void 0) {
9376
+ if (inFlight !== void 0) return inFlight;
9377
+ } else if (!supplementalCoverageRef.current.wake(wake.scope, wake.version)) return inFlight ?? Promise.resolve();
9378
+ const coverage = supplementalCoverageRef.current;
9379
+ const round = (async () => {
9380
+ for (;;) {
9381
+ coverage.beginRound();
9382
+ if (!await applySupplemental() || !coverage.finishRound()) return;
9383
+ }
9384
+ })().finally(() => {
9385
+ if (supplementalRef.current === round) supplementalRef.current = void 0;
9386
+ });
9387
+ supplementalRef.current = round;
9388
+ return round;
9389
+ };
8846
9390
  const refreshPassiveFacts = async () => {
8847
9391
  try {
8848
9392
  const result = await loadThreadHistory({
@@ -8889,6 +9433,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8889
9433
  };
8890
9434
  (0, react.useEffect)(() => {
8891
9435
  mountedRef.current = true;
9436
+ supplementalRef.current = void 0;
9437
+ supplementalCoverageRef.current.reset();
8892
9438
  projectionRef.current = void 0;
8893
9439
  setProjection(void 0);
8894
9440
  setChannelView(void 0);
@@ -8947,28 +9493,48 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
8947
9493
  await drainUnread();
8948
9494
  })();
8949
9495
  refreshSupplemental();
8950
- const disposers = [subscribeChanges({
8951
- kind: "thread",
8952
- threadRef
8953
- }, (update) => {
8954
- if (!mountedRef.current) return;
8955
- if (update.type === "failed") {
8956
- setError(update.message);
8957
- return;
8958
- }
8959
- refreshPassiveFacts();
8960
- refreshFollowers();
8961
- }), subscribeChanges({
8962
- kind: "workspace",
8963
- workspaceId
8964
- }, (update) => {
8965
- if (!mountedRef.current) return;
8966
- if (update.type === "failed") {
8967
- setError(update.message);
8968
- return;
8969
- }
8970
- refreshSupplemental();
8971
- })];
9496
+ const disposers = [
9497
+ subscribeChanges({
9498
+ kind: "thread",
9499
+ threadRef
9500
+ }, (update) => {
9501
+ if (!mountedRef.current) return;
9502
+ if (update.type === "failed") {
9503
+ setError(update.message);
9504
+ return;
9505
+ }
9506
+ refreshPassiveFacts();
9507
+ refreshFollowers();
9508
+ }),
9509
+ subscribeChanges({
9510
+ kind: "workspace",
9511
+ workspaceId
9512
+ }, (update) => {
9513
+ if (!mountedRef.current) return;
9514
+ if (update.type === "failed") {
9515
+ setError(update.message);
9516
+ return;
9517
+ }
9518
+ refreshSupplemental({
9519
+ scope: "workspace",
9520
+ version: update.version
9521
+ });
9522
+ }),
9523
+ subscribeChanges({
9524
+ kind: "presence",
9525
+ workspaceId
9526
+ }, (update) => {
9527
+ if (!mountedRef.current) return;
9528
+ if (update.type === "failed") {
9529
+ setError(update.message);
9530
+ return;
9531
+ }
9532
+ refreshSupplemental({
9533
+ scope: "presence",
9534
+ version: update.version
9535
+ });
9536
+ })
9537
+ ];
8972
9538
  return () => {
8973
9539
  mountedRef.current = false;
8974
9540
  sequenceRef.current += 1;
@@ -9044,7 +9610,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9044
9610
  };
9045
9611
  const messageSender = (fact) => fact.kind === "message" ? fact.message.sender : void 0;
9046
9612
  const [pendingFiles, setPendingFiles] = (0, react.useState)([]);
9047
- const openRef = (ref) => {
9613
+ const openRef = (0, react.useCallback)((ref) => {
9048
9614
  if (ref.startsWith("channel:") && ref !== channelRef) {
9049
9615
  selectChannel(ref);
9050
9616
  return;
@@ -9065,8 +9631,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9065
9631
  return;
9066
9632
  }
9067
9633
  if (ref.startsWith("task:") && ref !== taskRef) jumpToTaskThread(resolveTaskRefs, workspaceId, ref, selectThread);
9068
- };
9069
- const lookupTaskRefs = hostTaskRefLookup(resolveTaskRefs, workspaceId);
9634
+ }, [
9635
+ channelRef,
9636
+ threadRef,
9637
+ taskRef,
9638
+ workspaceId,
9639
+ selectChannel,
9640
+ selectThread,
9641
+ loadChannels,
9642
+ resolveTaskRefs
9643
+ ]);
9644
+ const lookupTaskRefs = (0, react.useMemo)(() => hostTaskRefLookup(resolveTaskRefs, workspaceId), [resolveTaskRefs, workspaceId]);
9070
9645
  const renderFact = (fact, grouped = false) => {
9071
9646
  if (fact.kind === "message") {
9072
9647
  const sender = memberName(fact.message.sender);
@@ -9080,7 +9655,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9080
9655
  loadAttachment: getAttachment,
9081
9656
  t,
9082
9657
  occurredAt: fact.message.occurredAt,
9083
- mentionNames: mentionNamesOf(fact.mentions, mentionHandlesMap),
9658
+ mentionNames: stableMentionNames(fact.mentions, mentionHandlesMap),
9084
9659
  onOpenRef: openRef,
9085
9660
  onResolveTaskRefs: lookupTaskRefs,
9086
9661
  grouped,
@@ -9184,7 +9759,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9184
9759
  const merged = mergeFacts(current, [{
9185
9760
  kind: "activity",
9186
9761
  sequence: committed.activity.sequence,
9187
- activity: committed.activity
9762
+ activity: committed.activity,
9763
+ occurredAt: committed.receipt.occurredAt
9188
9764
  }]);
9189
9765
  currentFactsRef.current = merged;
9190
9766
  return merged;
@@ -9240,7 +9816,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9240
9816
  const merged = mergeFacts(current, [{
9241
9817
  kind: "activity",
9242
9818
  sequence: committed.activity.sequence,
9243
- activity: committed.activity
9819
+ activity: committed.activity,
9820
+ occurredAt: committed.receipt.occurredAt
9244
9821
  }]);
9245
9822
  currentFactsRef.current = merged;
9246
9823
  return merged;
@@ -9263,28 +9840,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9263
9840
  setMutating(void 0);
9264
9841
  }
9265
9842
  };
9843
+ const clearSendState = (0, react.useCallback)(() => {
9844
+ setConfirmation((current) => current === void 0 ? current : void 0);
9845
+ setReplyRequestId((current) => current === void 0 ? current : void 0);
9846
+ setStatusMessage((current) => current === void 0 ? current : void 0);
9847
+ }, []);
9266
9848
  const sendReply = async () => {
9849
+ const { draft, recipients } = drafts.getSnapshot(draftKey);
9267
9850
  if (pending || thread === void 0 || draft.trim() === "") return;
9268
9851
  const id = replyRequestId ?? mintRequestId();
9269
9852
  setReplyRequestId(id);
9270
9853
  setPending(true);
9271
9854
  setError(void 0);
9272
9855
  try {
9273
- const attachmentIds = [];
9274
- for (const file of pendingFiles) {
9275
- const uploaded = await putAttachment({
9276
- requestId: mintRequestId(),
9277
- workspaceId,
9278
- name: file.name,
9279
- mediaType: file.type === "" ? void 0 : file.type,
9280
- bytesBase64: bytesToBase64(new Uint8Array(await file.arrayBuffer()))
9281
- });
9282
- if (!uploaded.ok) {
9283
- setError(uploaded.error.message);
9284
- return;
9285
- }
9286
- attachmentIds.push(uploaded.value.attachmentId);
9856
+ const upload = await uploadComposerFiles(putAttachment, workspaceId, pendingFiles);
9857
+ if (!upload.ok) {
9858
+ setError(upload.error);
9859
+ return;
9287
9860
  }
9861
+ const attachmentIds = upload.attachmentIds;
9288
9862
  const result = await reply({
9289
9863
  requestId: id,
9290
9864
  workspaceId,
@@ -9307,7 +9881,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9307
9881
  kind: "message",
9308
9882
  sequence: committed.message.sequence,
9309
9883
  message: committed.message,
9310
- mentions: [...recipients].sort()
9884
+ mentions: [...recipients].sort(),
9885
+ occurredAt: committed.receipt.occurredAt
9311
9886
  }]);
9312
9887
  currentFactsRef.current = merged;
9313
9888
  return merged;
@@ -9452,7 +10027,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9452
10027
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
9453
10028
  t("runtimeRiskDetail", {
9454
10029
  member: status.member.handle,
9455
- diagnostic: status.diagnostic ?? t("statusError")
10030
+ diagnostic: diagnosticText(status) || t("statusError")
9456
10031
  }),
9457
10032
  " · ",
9458
10033
  claim.direction
@@ -9642,23 +10217,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9642
10217
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamComposer, {
9643
10218
  members: channelMembers,
9644
10219
  followerMemberIds: followerIds,
9645
- recipients,
9646
- draft,
10220
+ drafts,
10221
+ draftKey,
9647
10222
  pending,
9648
10223
  ...statusMessage === void 0 ? {} : { confirmation: statusMessage },
9649
10224
  ...error === void 0 ? {} : { error },
9650
- onDraftChange: (next) => {
9651
- drafts.writeDraft(draftKey, next);
9652
- setConfirmation(void 0);
9653
- setReplyRequestId(void 0);
9654
- setStatusMessage(void 0);
9655
- },
9656
- onRecipientsChange: (next) => {
9657
- drafts.writeRecipients(draftKey, next);
9658
- setConfirmation(void 0);
9659
- setReplyRequestId(void 0);
9660
- setStatusMessage(void 0);
9661
- },
10225
+ onEdit: clearSendState,
9662
10226
  onSubmit: () => {
9663
10227
  sendReply();
9664
10228
  },
@@ -9672,9 +10236,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9672
10236
  }
9673
10237
  //#endregion
9674
10238
  //#region src/client/TeamConversation.tsx
9675
- function TeamConversation({ t, useWorkspaces, navigation, drafts, putAttachment, getAttachment, loadChannels, readThread, loadThreadHistory, threadObservations, subscribeChanges, loadMembers, sendMessage, joinChannel, removeChannelMember, reply, changeTask, promoteThread, selectThread, selectChannel, backToWorkspace, backToChannels, resolveTaskRefs }) {
10239
+ function TeamConversation({ t, useWorkspaces, navigation, drafts, putAttachment, getAttachment, loadChannels, readThread, loadThreadHistory, threadObservations, subscribeChanges, loadMembers, loadInbox, sendMessage, joinChannel, removeChannelMember, reply, changeTask, promoteThread, selectThread, selectChannel, selectWorkspace, backToWorkspace, backToChannels, resolveTaskRefs }) {
9676
10240
  const navigationState = (0, react.useSyncExternalStore)(navigation.subscribe, navigation.getSnapshot, navigation.getSnapshot);
9677
10241
  const current = useWorkspaces((state) => state.items).find((workspace) => workspace.workspaceId === navigationState.workspaceId);
10242
+ if (navigationState.inbox === true) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamInboxPage, {
10243
+ useWorkspaces,
10244
+ loadInbox,
10245
+ subscribeChanges,
10246
+ selectWorkspace,
10247
+ selectThread,
10248
+ t
10249
+ }, "inbox");
9678
10250
  if (current !== void 0 && navigationState.threadRef !== void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamThreadPage, {
9679
10251
  workspaceId: current.workspaceId,
9680
10252
  putAttachment,
@@ -9744,7 +10316,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9744
10316
  }
9745
10317
  //#endregion
9746
10318
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/sidebar.module.css.mjs
9747
- const css$1 = "html[data-agent-team-mode=team] button[class*=newSession]{display:none}.d0xfxa_workspaceBrowser{flex-direction:column;height:100%;min-height:0;padding:0 8px 8px;display:flex}.d0xfxa_railButton{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0;display:inline-flex}.d0xfxa_railButton:hover,.d0xfxa_railButton:focus-visible{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);outline:none}.d0xfxa_workspaceList{flex-direction:column;gap:2px;padding-bottom:2px;display:flex}.d0xfxa_workspaceRow{color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;align-items:center;gap:6px;width:100%;height:34px;padding:0 8px;display:flex}.d0xfxa_workspaceRow:hover,.d0xfxa_workspaceRow:focus-visible,.d0xfxa_workspaceRow[aria-current=page]{background:var(--dsw-alias-interactive-bg-hover);outline:none}.d0xfxa_workspaceRow:focus-visible{box-shadow:inset 0 0 0 1px var(--dsw-alias-border-l3)}.d0xfxa_workspaceIcon{color:var(--dsw-alias-label-tertiary);flex:0 0 16px;justify-content:center;align-items:center;height:20px;display:inline-flex}.d0xfxa_workspaceRow[data-selected] .d0xfxa_workspaceIcon{color:var(--dsw-alias-state-business-primary)}.d0xfxa_workspaceCopy{min-width:0;display:flex}.d0xfxa_workspaceCopy strong{text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:400;line-height:20px;overflow:hidden}.d0xfxa_emptyState{color:var(--dsw-alias-label-tertiary);margin:8px;font-size:12px;line-height:18px}.d0xfxa_railWorkspace{flex-direction:column;align-items:center;gap:8px;padding-top:8px;display:flex}.d0xfxa_railButton{border-radius:50%;width:36px;height:36px}.d0xfxa_railButton[data-active]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.d0xfxa_workspaceSection{flex-direction:column;flex:1;gap:4px;min-height:0;margin-top:2px;display:flex;overflow-y:auto}.d0xfxa_section{flex-direction:column;display:flex}.d0xfxa_sectionHeader{align-items:center;min-height:26px;padding-right:2px;display:flex}.d0xfxa_sectionToggle{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;align-items:center;gap:4px;min-width:0;min-height:24px;padding:0 6px;font-size:12px;line-height:18px;display:inline-flex}.d0xfxa_sectionToggle:focus-visible{outline:none}.d0xfxa_sectionToggle:hover .d0xfxa_sectionChevron,.d0xfxa_sectionToggle:focus-visible .d0xfxa_sectionChevron{color:var(--dsw-alias-label-primary)}.d0xfxa_sectionChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .12s,color .12s}.d0xfxa_sectionToggle[aria-expanded=false] .d0xfxa_sectionChevron{transform:rotate(-90deg)}.d0xfxa_sectionTitle{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.d0xfxa_sectionActions{align-items:center;margin-left:auto;display:inline-flex}.d0xfxa_panel{flex-direction:column;display:flex}.d0xfxa_iconButton{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:50%;justify-content:center;align-items:center;width:24px;height:24px;padding:0;display:inline-flex}.d0xfxa_iconButton:hover,.d0xfxa_iconButton:focus-visible{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);outline:none}.d0xfxa_textButton{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:5px;padding:2px 5px;font-size:11px;line-height:18px}.d0xfxa_textButton:hover,.d0xfxa_textButton:focus-visible{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);outline:none}.d0xfxa_textButton:disabled{cursor:not-allowed;opacity:.4}.d0xfxa_channelList,.d0xfxa_agentList{flex-direction:column;gap:1px;padding:0 4px 4px;display:flex}.d0xfxa_sidebarRowDragging{opacity:.5}.d0xfxa_sidebarRowDropBefore,.d0xfxa_sidebarRowDropAfter{position:relative}.d0xfxa_sidebarRowDropBefore:before,.d0xfxa_sidebarRowDropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.d0xfxa_sidebarRowDropBefore:before{top:-7px}.d0xfxa_sidebarRowDropAfter:after{bottom:-7px}.d0xfxa_channelRow{color:var(--dsw-alias-label-primary);border-radius:8px;align-items:center;min-height:30px;display:flex;position:relative}.d0xfxa_channelSelect{box-sizing:border-box;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0;flex:1;align-items:center;min-width:0;min-height:30px;padding:3px 4px 3px 8px;display:flex}.d0xfxa_channelSelect:focus-visible{outline:none}.d0xfxa_channelName{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:400;line-height:18px;overflow:hidden}.d0xfxa_agentRow{color:var(--dsw-alias-label-primary);border-radius:8px;align-items:center;min-height:38px;display:flex;position:relative}.d0xfxa_agentSelect{box-sizing:border-box;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0;flex:1;grid-template-columns:24px minmax(0,1fr);align-items:center;gap:0 8px;min-width:0;min-height:38px;padding:3px 4px 3px 8px;display:grid}.d0xfxa_agentSelect:focus-visible{outline:none}.d0xfxa_agentSelect[aria-current=page]{background:var(--dsw-alias-interactive-bg-hover);border-radius:8px}.d0xfxa_agentRow:hover .d0xfxa_agentSelect[aria-current=page],.d0xfxa_agentRow:focus-within .d0xfxa_agentSelect[aria-current=page],.d0xfxa_agentRow[data-menu-open] .d0xfxa_agentSelect[aria-current=page]{background:0 0}.d0xfxa_agentAvatar{background:hsl(var(--team-avatar-hue,212) 42% 46%);color:#fff;cursor:default;border-radius:50%;flex:0 0 24px;justify-content:center;align-items:center;width:24px;height:24px;font-size:11px;font-weight:600;display:inline-flex;position:relative}.d0xfxa_agentAvatarBadge{background:var(--dsw-specific-sidebar-fill);box-shadow:0 0 0 1px var(--dsw-specific-sidebar-fill);border-radius:50%;justify-content:center;align-items:center;width:12px;height:12px;padding:1px;line-height:0;display:inline-flex;position:absolute;bottom:-3px;right:-3px}.d0xfxa_agentCopy{flex-direction:column;min-width:0;display:flex}.d0xfxa_agentCopy strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:400;line-height:17px;overflow:hidden}.d0xfxa_agentCopy small{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:13px;overflow:hidden}.d0xfxa_unavailableDot{background:var(--dsw-alias-label-tertiary);border-radius:50%;width:7px;height:7px;display:inline-block}.d0xfxa_rowMenu{flex:none;align-items:center;padding-right:4px;display:none}.d0xfxa_channelRow:hover .d0xfxa_rowMenu,.d0xfxa_channelRow:focus-within .d0xfxa_rowMenu,.d0xfxa_channelRow[data-menu-open] .d0xfxa_rowMenu,.d0xfxa_agentRow:hover .d0xfxa_rowMenu,.d0xfxa_agentRow:focus-within .d0xfxa_rowMenu,.d0xfxa_agentRow[data-menu-open] .d0xfxa_rowMenu{display:inline-flex}.d0xfxa_channelRow[data-menu-open],.d0xfxa_agentRow[data-menu-open],.d0xfxa_channelRow:hover,.d0xfxa_agentRow:hover,.d0xfxa_channelRow:focus-within,.d0xfxa_agentRow:focus-within,.d0xfxa_channelRow[aria-current=page]{background:var(--dsw-alias-interactive-bg-hover)}.d0xfxa_rowMenuButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:4px;justify-content:center;align-items:center;width:20px;height:20px;padding:0;display:inline-flex}.d0xfxa_rowMenuButton:hover,.d0xfxa_rowMenuButton:focus-visible{color:var(--dsw-alias-label-primary);outline:none}.d0xfxa_retryError{color:var(--dsw-alias-state-error-primary);justify-content:space-between;align-items:center;gap:8px;padding:8px;font-size:11px;display:flex}.d0xfxa_rowAlert{color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;padding:2px 8px 6px;font-size:11px}.d0xfxa_editDescription{color:var(--dsw-alias-label-secondary);margin:0 0 10px;font-size:12px;line-height:18px}.d0xfxa_editMemberList{gap:3px;display:grid}.d0xfxa_editMemberRow{border-radius:6px;grid-template-columns:14px minmax(0,1fr) auto;align-items:center;gap:0 8px;min-height:40px;padding:3px 6px;display:grid}.d0xfxa_editMemberRowChannels{grid-template-columns:minmax(0,1fr) auto}.d0xfxa_editMemberRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.d0xfxa_editMemberCopy{min-width:0;display:grid}.d0xfxa_editMemberCopy strong{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500;line-height:18px;overflow:hidden}.d0xfxa_editMemberCopy small{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:14px;overflow:hidden}.d0xfxa_editChannelName{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:400;line-height:18px;overflow:hidden}.d0xfxa_editMemberRow button{min-width:60px}.d0xfxa_editHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:11px;line-height:16px}.d0xfxa_menuHint{color:var(--dsw-alias-label-tertiary);margin-left:4px;font-size:10px;line-height:14px}.d0xfxa_rowError{color:var(--dsw-alias-state-error-primary);grid-column:1/-1;margin:2px 0;font-size:11px;line-height:16px}";
10319
+ const css$1 = "html[data-agent-team-mode=team] button[class*=newSession]{display:none}.d0xfxa_workspaceBrowser{flex-direction:column;height:100%;min-height:0;padding:0 8px 8px;display:flex}.d0xfxa_railButton{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0;display:inline-flex}.d0xfxa_railButton:hover,.d0xfxa_railButton:focus-visible{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.d0xfxa_railButton:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:1px}.d0xfxa_workspaceList{flex-direction:column;gap:2px;padding-bottom:2px;display:flex}.d0xfxa_workspaceRow{color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;align-items:center;gap:6px;width:100%;height:34px;padding:0 8px;display:flex}.d0xfxa_workspaceRow:hover,.d0xfxa_workspaceRow:focus-visible,.d0xfxa_workspaceRow[aria-current=page]{background:var(--dsw-alias-interactive-bg-hover)}.d0xfxa_workspaceRow:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}.d0xfxa_workspaceIcon{color:var(--dsw-alias-label-tertiary);flex:0 0 16px;justify-content:center;align-items:center;height:20px;display:inline-flex}.d0xfxa_workspaceRow[data-selected] .d0xfxa_workspaceIcon{color:var(--dsw-alias-state-business-primary)}.d0xfxa_workspaceCopy{min-width:0;display:flex}.d0xfxa_workspaceCopy strong{text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:400;line-height:20px;overflow:hidden}.d0xfxa_emptyState{color:var(--dsw-alias-label-tertiary);margin:8px;font-size:12px;line-height:18px}.d0xfxa_inboxCard{color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;flex:none;align-items:center;gap:6px;width:100%;height:34px;margin:4px 0 2px;padding:0 8px;display:flex}.d0xfxa_inboxCard:hover,.d0xfxa_inboxCard:focus-visible,.d0xfxa_inboxCard[aria-current=page]{background:var(--dsw-alias-interactive-bg-hover)}.d0xfxa_inboxCard:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}.d0xfxa_inboxCard>svg{color:var(--dsw-alias-label-tertiary);flex:0 0 16px}.d0xfxa_inboxCardLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:14px;line-height:20px;overflow:hidden}.d0xfxa_inboxBadge{background:var(--dsw-alias-state-business-primary);box-sizing:border-box;color:var(--dsw-alias-label-primary-foreground);corner-shape:round;border-radius:999px;flex:none;justify-content:center;align-items:center;min-width:18px;height:18px;margin-left:auto;padding:0 5px;font-size:11px;font-weight:600;line-height:18px;display:inline-flex}.d0xfxa_railButton .d0xfxa_inboxBadge{margin-left:0;position:absolute;top:0;right:0}.d0xfxa_railWorkspace{flex-direction:column;align-items:center;gap:8px;padding-top:8px;display:flex}.d0xfxa_railButton{corner-shape:round;border-radius:50%;width:36px;height:36px;position:relative}.d0xfxa_railButton[data-active]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.d0xfxa_workspaceSection{flex-direction:column;flex:1;gap:4px;min-height:0;margin-top:2px;display:flex;overflow-y:auto}.d0xfxa_section{flex-direction:column;display:flex}.d0xfxa_sectionHeader{align-items:center;min-height:26px;padding-right:2px;display:flex}.d0xfxa_sectionToggle{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:4px;align-items:center;gap:4px;min-width:0;min-height:24px;padding:0 6px;font-size:12px;line-height:18px;display:inline-flex}.d0xfxa_sectionToggle:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:1px}.d0xfxa_sectionToggle:hover .d0xfxa_sectionChevron,.d0xfxa_sectionToggle:focus-visible .d0xfxa_sectionChevron{color:var(--dsw-alias-label-primary)}.d0xfxa_sectionChevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .12s,color .12s}.d0xfxa_sectionToggle[aria-expanded=false] .d0xfxa_sectionChevron{transform:rotate(-90deg)}.d0xfxa_sectionTitle{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.d0xfxa_sectionActions{align-items:center;margin-left:auto;display:inline-flex}.d0xfxa_panel{flex-direction:column;display:flex}.d0xfxa_iconButton{corner-shape:round;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:50%;justify-content:center;align-items:center;width:24px;height:24px;padding:0;display:inline-flex}.d0xfxa_iconButton:hover,.d0xfxa_iconButton:focus-visible{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.d0xfxa_iconButton:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:1px}.d0xfxa_textButton{color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:5px;padding:2px 5px;font-size:11px;line-height:18px}.d0xfxa_textButton:hover,.d0xfxa_textButton:focus-visible{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}.d0xfxa_textButton:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:1px}.d0xfxa_textButton:disabled{cursor:not-allowed;opacity:.4}.d0xfxa_channelList,.d0xfxa_agentList{flex-direction:column;gap:1px;padding:0 4px 4px;display:flex}.d0xfxa_sidebarRowDragging{opacity:.5}.d0xfxa_sidebarRowDropBefore,.d0xfxa_sidebarRowDropAfter{position:relative}.d0xfxa_sidebarRowDropBefore:before,.d0xfxa_sidebarRowDropAfter:after{content:\"\";z-index:1;background:linear-gradient(55deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 0 / 5px 7px no-repeat, linear-gradient(125deg, transparent calc(50% - 1px), var(--dsw-alias-state-business-primary) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)) 0 5px / 5px 7px no-repeat, linear-gradient(var(--dsw-alias-state-business-primary) 0 0) 4px 5px / calc(100% - 4px) 2px no-repeat;pointer-events:none;height:12px;position:absolute;left:0;right:4px}.d0xfxa_sidebarRowDropBefore:before{top:-7px}.d0xfxa_sidebarRowDropAfter:after{bottom:-7px}.d0xfxa_channelRow{color:var(--dsw-alias-label-primary);border-radius:8px;align-items:center;min-height:30px;display:flex;position:relative}.d0xfxa_channelSelect{box-sizing:border-box;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;flex:1;align-items:center;min-width:0;min-height:30px;padding:3px 4px 3px 8px;display:flex}.d0xfxa_channelSelect:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}.d0xfxa_channelName{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:400;line-height:18px;overflow:hidden}.d0xfxa_agentRow{color:var(--dsw-alias-label-primary);border-radius:8px;align-items:center;min-height:38px;display:flex;position:relative}.d0xfxa_agentSelect{box-sizing:border-box;color:inherit;cursor:pointer;text-align:left;background:0 0;border:0;border-radius:8px;flex:1;grid-template-columns:24px minmax(0,1fr);align-items:center;gap:0 8px;min-width:0;min-height:38px;padding:3px 4px 3px 8px;display:grid}.d0xfxa_agentSelect:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:-2px}.d0xfxa_agentSelect[aria-current=page]{background:var(--dsw-alias-interactive-bg-hover);border-radius:8px}.d0xfxa_agentRow:hover .d0xfxa_agentSelect[aria-current=page],.d0xfxa_agentRow:focus-within .d0xfxa_agentSelect[aria-current=page],.d0xfxa_agentRow[data-menu-open] .d0xfxa_agentSelect[aria-current=page]{background:0 0}.d0xfxa_agentAvatar{background:hsl(var(--team-avatar-hue,212) 42% 46%);corner-shape:round;color:#fff;cursor:default;border-radius:50%;flex:0 0 24px;justify-content:center;align-items:center;width:24px;height:24px;font-size:11px;font-weight:600;display:inline-flex;position:relative}.d0xfxa_agentAvatarBadge{background:var(--dsw-specific-sidebar-fill);corner-shape:round;box-shadow:0 0 0 1px var(--dsw-specific-sidebar-fill);border-radius:50%;justify-content:center;align-items:center;width:12px;height:12px;padding:1px;line-height:0;display:inline-flex;position:absolute;bottom:-3px;right:-3px}.d0xfxa_agentCopy{flex-direction:column;min-width:0;display:flex}.d0xfxa_agentCopy strong{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:400;line-height:17px;overflow:hidden}.d0xfxa_agentCopy small{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:13px;overflow:hidden}.d0xfxa_unavailableDot{background:var(--dsw-alias-label-tertiary);corner-shape:round;border-radius:50%;width:7px;height:7px;display:inline-block}.d0xfxa_rowMenu{flex:none;align-items:center;padding-right:4px;display:none}.d0xfxa_channelRow:hover .d0xfxa_rowMenu,.d0xfxa_channelRow:focus-within .d0xfxa_rowMenu,.d0xfxa_channelRow[data-menu-open] .d0xfxa_rowMenu,.d0xfxa_agentRow:hover .d0xfxa_rowMenu,.d0xfxa_agentRow:focus-within .d0xfxa_rowMenu,.d0xfxa_agentRow[data-menu-open] .d0xfxa_rowMenu{display:inline-flex}.d0xfxa_channelRow[data-menu-open],.d0xfxa_agentRow[data-menu-open],.d0xfxa_channelRow:hover,.d0xfxa_agentRow:hover,.d0xfxa_channelRow:focus-within,.d0xfxa_agentRow:focus-within,.d0xfxa_channelRow[aria-current=page]{background:var(--dsw-alias-interactive-bg-hover)}.d0xfxa_rowMenuButton{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;border-radius:4px;justify-content:center;align-items:center;width:20px;height:20px;padding:0;display:inline-flex}.d0xfxa_rowMenuButton:hover,.d0xfxa_rowMenuButton:focus-visible{color:var(--dsw-alias-label-primary)}.d0xfxa_rowMenuButton:focus-visible{outline:2px solid var(--dsw-alias-label-primary);outline-offset:1px}.d0xfxa_retryError{color:var(--dsw-alias-state-error-primary);justify-content:space-between;align-items:center;gap:8px;padding:8px;font-size:11px;display:flex}.d0xfxa_rowAlert{color:var(--dsw-alias-state-error-primary);overflow-wrap:anywhere;padding:2px 8px 6px;font-size:11px}.d0xfxa_editDescription{color:var(--dsw-alias-label-secondary);margin:0 0 10px;font-size:12px;line-height:18px}.d0xfxa_editMemberList{gap:3px;display:grid}.d0xfxa_editMemberRow{border-radius:6px;grid-template-columns:14px minmax(0,1fr) auto;align-items:center;gap:0 8px;min-height:40px;padding:3px 6px;display:grid}.d0xfxa_editMemberRowChannels{grid-template-columns:minmax(0,1fr) auto}.d0xfxa_editMemberRow:hover{background:var(--dsw-alias-interactive-bg-hover)}.d0xfxa_editMemberCopy{min-width:0;display:grid}.d0xfxa_editMemberCopy strong{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500;line-height:18px;overflow:hidden}.d0xfxa_editMemberCopy small{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;font-size:10px;line-height:14px;overflow:hidden}.d0xfxa_editChannelName{text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:400;line-height:18px;overflow:hidden}.d0xfxa_editMemberRow button{min-width:60px}.d0xfxa_editHint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:11px;line-height:16px}.d0xfxa_menuHint{color:var(--dsw-alias-label-tertiary);margin-left:4px;font-size:10px;line-height:14px}.d0xfxa_rowError{color:var(--dsw-alias-state-error-primary);grid-column:1/-1;margin:2px 0;font-size:11px;line-height:16px}";
9748
10320
  const tagId$1 = "@wowyuarm/dsh-agent-team/sidebar.module.css";
9749
10321
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
9750
10322
  const tag = document.createElement("style");
@@ -9773,6 +10345,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
9773
10345
  "editMemberRowChannels": "d0xfxa_editMemberRowChannels",
9774
10346
  "emptyState": "d0xfxa_emptyState",
9775
10347
  "iconButton": "d0xfxa_iconButton",
10348
+ "inboxBadge": "d0xfxa_inboxBadge",
10349
+ "inboxCard": "d0xfxa_inboxCard",
10350
+ "inboxCardLabel": "d0xfxa_inboxCardLabel",
9776
10351
  "menuHint": "d0xfxa_menuHint",
9777
10352
  "panel": "d0xfxa_panel",
9778
10353
  "railButton": "d0xfxa_railButton",
@@ -10235,8 +10810,45 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10235
10810
  });
10236
10811
  }
10237
10812
  //#endregion
10813
+ //#region src/client/team-dialog-save.ts
10814
+ /**
10815
+ * Shared edit-dialog save lifecycle: one in-flight durable update, the dialog
10816
+ * held disabled while it runs, a refusal reported in place, and a close only
10817
+ * after the parent has re-read the committed state. Callers keep their own
10818
+ * payload and request reuse, and hold `pendingRequest` so that editing a field
10819
+ * drops a request the Host may already have committed.
10820
+ */
10821
+ function useEditDialogSave({ save, onCommitted, onClose }) {
10822
+ const [saving, setSaving] = (0, react.useState)(false);
10823
+ const [error, setError] = (0, react.useState)();
10824
+ const pendingRequest = (0, react.useRef)();
10825
+ const submit = async (request) => {
10826
+ pendingRequest.current = request;
10827
+ setSaving(true);
10828
+ setError(void 0);
10829
+ try {
10830
+ const result = await save(request);
10831
+ if (result.ok) {
10832
+ pendingRequest.current = void 0;
10833
+ await onCommitted();
10834
+ onClose();
10835
+ } else setError(result.error.message);
10836
+ } catch (cause) {
10837
+ setError(cause instanceof Error ? cause.message : String(cause));
10838
+ } finally {
10839
+ setSaving(false);
10840
+ }
10841
+ };
10842
+ return {
10843
+ saving,
10844
+ error,
10845
+ pendingRequest,
10846
+ save: submit
10847
+ };
10848
+ }
10849
+ //#endregion
10238
10850
  //#region \0dsh-css:/home/yu/projects/dsh-agent-team/packages/client-agent-team/src/client/create.module.css.mjs
10239
- const css = "._1henIG_form{gap:16px;display:grid}._1henIG_field{color:var(--dsw-alias-label-secondary);gap:6px;font-size:12px;line-height:18px;display:grid}._1henIG_input{box-sizing:border-box;width:100%}._1henIG_menuCap{max-height:min(320px,56vh)}._1henIG_selectTrigger{background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);box-sizing:border-box;color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;border-radius:8px;justify-content:space-between;align-items:center;gap:8px;min-height:32px;padding:4px 10px;font-size:14px;line-height:22px;display:flex}._1henIG_selectTrigger:disabled{cursor:default;opacity:.6}._1henIG_selectTrigger:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}._1henIG_selectValue{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._1henIG_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .12s;display:inline-flex}._1henIG_chevronOpen{transform:rotate(180deg)}._1henIG_memberPicker{border:0;gap:4px;max-height:220px;margin:0;padding:0;display:grid;overflow-y:auto}._1henIG_memberPicker legend{color:var(--dsw-alias-label-secondary);padding:0 0 6px;font-size:12px;line-height:18px}._1henIG_memberOption{color:var(--dsw-alias-label-primary);border-radius:6px;grid-template-columns:auto 14px minmax(0,1fr);align-items:center;gap:0 7px;min-height:32px;padding:3px 6px;display:grid}._1henIG_memberOption:hover{background:var(--dsw-alias-interactive-bg-hover)}._1henIG_memberOption input{margin:0}._1henIG_memberOption small{color:var(--dsw-alias-label-tertiary);grid-column:3;font-size:10px;line-height:14px}._1henIG_unavailableDot{background:var(--dsw-alias-label-tertiary);border-radius:50%;justify-self:center;width:7px;height:7px;display:inline-block}._1henIG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}._1henIG_dialogContent{max-height:min(70vh,560px);overflow-y:auto}@media (width<=600px){._1henIG_dialogContent{max-height:calc(100vh - 180px)}._1henIG_memberPicker{max-height:180px}}";
10851
+ const css = "._1henIG_form{gap:16px;display:grid}._1henIG_field{color:var(--dsw-alias-label-secondary);gap:6px;font-size:12px;line-height:18px;display:grid}._1henIG_input{box-sizing:border-box;width:100%}._1henIG_menuCap{max-height:min(320px,56vh)}._1henIG_selectTrigger{background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);box-sizing:border-box;color:var(--dsw-alias-label-primary);cursor:pointer;text-align:left;border-radius:8px;justify-content:space-between;align-items:center;gap:8px;min-height:32px;padding:4px 10px;font-size:14px;line-height:22px;display:flex}._1henIG_selectTrigger:disabled{cursor:default;opacity:.6}._1henIG_selectTrigger:focus-visible{border-color:var(--dsw-alias-brand-primary);outline:none}._1henIG_selectValue{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._1henIG_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .12s;display:inline-flex}._1henIG_chevronOpen{transform:rotate(180deg)}._1henIG_memberPicker{border:0;gap:4px;max-height:220px;margin:0;padding:0;display:grid;overflow-y:auto}._1henIG_memberPicker legend{color:var(--dsw-alias-label-secondary);padding:0 0 6px;font-size:12px;line-height:18px}._1henIG_memberOption{color:var(--dsw-alias-label-primary);border-radius:6px;grid-template-columns:auto 14px minmax(0,1fr);align-items:center;gap:0 7px;min-height:32px;padding:3px 6px;display:grid}._1henIG_memberOption:hover{background:var(--dsw-alias-interactive-bg-hover)}._1henIG_memberOption input{margin:0}._1henIG_memberOption small{color:var(--dsw-alias-label-tertiary);grid-column:3;font-size:10px;line-height:14px}._1henIG_unavailableDot{background:var(--dsw-alias-label-tertiary);corner-shape:round;border-radius:50%;justify-self:center;width:7px;height:7px;display:inline-block}._1henIG_error{color:var(--dsw-alias-state-error-primary);margin:0;font-size:12px;line-height:18px}._1henIG_dialogContent{max-height:min(70vh,560px);overflow-y:auto}@media (width<=600px){._1henIG_dialogContent{max-height:calc(100vh - 180px)}._1henIG_memberPicker{max-height:180px}}";
10240
10852
  const tagId = "@wowyuarm/dsh-agent-team/create.module.css";
10241
10853
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
10242
10854
  const tag = document.createElement("style");
@@ -10429,9 +11041,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10429
11041
  const [handle, setHandle] = (0, react.useState)(status.member.handle);
10430
11042
  const [description, setDescription] = (0, react.useState)(status.member.description);
10431
11043
  const [model, setModel] = (0, react.useState)(status.member.model);
10432
- const [saving, setSaving] = (0, react.useState)(false);
10433
- const [error, setError] = (0, react.useState)();
10434
- const pendingRequest = (0, react.useRef)();
11044
+ const { saving, error, pendingRequest, save } = useEditDialogSave({
11045
+ save: updateMember,
11046
+ onCommitted,
11047
+ onClose
11048
+ });
10435
11049
  const dirty = handle.trim() !== status.member.handle || description.trim() !== status.member.description || !sameModel(model, status.member.model);
10436
11050
  const submit = async (event) => {
10437
11051
  event.preventDefault();
@@ -10445,25 +11059,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10445
11059
  ...model === void 0 ? {} : { model },
10446
11060
  ...status.member.capabilities === void 0 ? {} : { capabilities: status.member.capabilities }
10447
11061
  };
10448
- const request = pendingRequest.current !== void 0 && pendingRequest.current.memberId === payload.memberId && pendingRequest.current.handle === payload.handle && pendingRequest.current.description === payload.description && sameModel(pendingRequest.current.model, model) ? pendingRequest.current : {
11062
+ await save(pendingRequest.current !== void 0 && pendingRequest.current.memberId === payload.memberId && pendingRequest.current.handle === payload.handle && pendingRequest.current.description === payload.description && sameModel(pendingRequest.current.model, model) ? pendingRequest.current : {
10449
11063
  requestId: mintRequestId(),
10450
11064
  ...payload
10451
- };
10452
- pendingRequest.current = request;
10453
- setSaving(true);
10454
- setError(void 0);
10455
- try {
10456
- const result = await updateMember(request);
10457
- if (result.ok) {
10458
- pendingRequest.current = void 0;
10459
- await onCommitted();
10460
- onClose();
10461
- } else setError(result.error.message);
10462
- } catch (cause) {
10463
- setError(cause instanceof Error ? cause.message : String(cause));
10464
- } finally {
10465
- setSaving(false);
10466
- }
11065
+ });
10467
11066
  };
10468
11067
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
10469
11068
  open: true,
@@ -10598,14 +11197,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10598
11197
  }
10599
11198
  }
10600
11199
  }, []);
11200
+ const loadedRef = (0, react.useRef)(false);
10601
11201
  const refresh = (0, react.useCallback)(async () => {
10602
- setLoading(true);
11202
+ if (!loadedRef.current) setLoading(true);
10603
11203
  const result = await loadMembers({ workspaceId });
10604
11204
  if (result.ok) {
10605
11205
  const next = result.value.filter((status) => status.member.state !== "inactive" && status.member.state !== "archived");
10606
11206
  setMembers(next);
10607
11207
  followRollover(next);
10608
11208
  setError(void 0);
11209
+ loadedRef.current = true;
10609
11210
  } else setError(result.error.message);
10610
11211
  setLoading(false);
10611
11212
  }, [
@@ -10630,6 +11231,20 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10630
11231
  refresh,
10631
11232
  workspaceId
10632
11233
  ]);
11234
+ (0, react.useEffect)(() => subscribeChanges({
11235
+ kind: "presence",
11236
+ workspaceId
11237
+ }, (update) => {
11238
+ if (update.type === "failed") {
11239
+ setError(update.message);
11240
+ return;
11241
+ }
11242
+ refresh();
11243
+ }), [
11244
+ subscribeChanges,
11245
+ refresh,
11246
+ workspaceId
11247
+ ]);
10633
11248
  const closeForm = () => {
10634
11249
  if (creating) return;
10635
11250
  setFormOpen(false);
@@ -10653,7 +11268,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10653
11268
  setDescription("");
10654
11269
  setModel(void 0);
10655
11270
  setFormOpen(false);
10656
- if (result.value.status.presence === "unavailable") setError(result.value.status.diagnostic ?? t("statusUnavailable"));
11271
+ if (result.value.status.presence === "unavailable") setError(diagnosticText(result.value.status) || t("statusUnavailable"));
10657
11272
  else setRetryRequest(void 0);
10658
11273
  queueMicrotask(() => {
10659
11274
  triggerRef.current?.focus();
@@ -10845,7 +11460,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10845
11460
  return;
10846
11461
  }
10847
11462
  if (result.value.status.availability === "unavailable") {
10848
- setRowAlert(t("restartStillUnavailable", { diagnostic: result.value.status.diagnostic ?? t("statusUnavailable") }));
11463
+ const diagnostic = result.value.status.diagnostic;
11464
+ if (diagnostic?.class === "session-refused" && diagnostic.remediable === false) {
11465
+ setRowAlert(t("restartRefusedNoRestart", { detail: diagnosticText(result.value.status) }));
11466
+ return;
11467
+ }
11468
+ setRowAlert(t("restartStillUnavailable", { diagnostic: diagnosticText(result.value.status) || t("statusUnavailable") }));
10849
11469
  return;
10850
11470
  }
10851
11471
  setRowAlert(void 0);
@@ -10901,7 +11521,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
10901
11521
  label: t("resumeAgent"),
10902
11522
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconPlayOutline16, {})
10903
11523
  }] : [],
10904
- ...status.availability === "unavailable" ? [{
11524
+ ...status.availability === "unavailable" && restartOffered(status) ? [{
10905
11525
  id: "restart",
10906
11526
  label: t("restartAgent"),
10907
11527
  icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutline16, {})
@@ -11058,8 +11678,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11058
11678
  onCommit: applyMove
11059
11679
  });
11060
11680
  const sectionOpen = useSidebarSectionOpen(workspaceId, "channels");
11681
+ const loadedRef = (0, react.useRef)(false);
11061
11682
  const refresh = (0, react.useCallback)(async () => {
11062
- setLoading(true);
11683
+ if (!loadedRef.current) setLoading(true);
11063
11684
  const [channelResult, memberResult] = await Promise.all([loadChannels({
11064
11685
  workspaceId,
11065
11686
  limit: 1
@@ -11071,6 +11692,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11071
11692
  const selectable = new Set(visibleMembers.filter((status) => status.presence !== "unavailable").map((status) => status.member.memberId));
11072
11693
  setSelected((current) => new Set([...current].filter((memberId) => selectable.has(memberId))));
11073
11694
  setError(void 0);
11695
+ loadedRef.current = true;
11074
11696
  } else if (!channelResult.ok) setError(channelResult.error.message);
11075
11697
  else if (!memberResult.ok) setError(memberResult.error.message);
11076
11698
  setLoading(false);
@@ -11427,9 +12049,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11427
12049
  function ChannelEditorDialog({ channel, members, joinedIds, updateChannel, joinChannel, removeChannelMember, onCommitted, onClose, t }) {
11428
12050
  const [name, setName] = (0, react.useState)(channel.name);
11429
12051
  const [description, setDescription] = (0, react.useState)(channel.description);
11430
- const [saving, setSaving] = (0, react.useState)(false);
11431
- const [error, setError] = (0, react.useState)();
11432
- const pendingRequest = (0, react.useRef)();
12052
+ const { saving, error, pendingRequest, save } = useEditDialogSave({
12053
+ save: updateChannel,
12054
+ onCommitted,
12055
+ onClose
12056
+ });
11433
12057
  const membership = useChannelMembership({
11434
12058
  joinChannel,
11435
12059
  removeChannelMember
@@ -11442,28 +12066,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11442
12066
  const normalizedName = name.trim();
11443
12067
  const normalizedDescription = description.trim();
11444
12068
  if (saving || !dirty || normalizedName === "") return;
11445
- const request = pendingRequest.current !== void 0 && pendingRequest.current.channelRef === channel.channelRef && pendingRequest.current.name === normalizedName && pendingRequest.current.description === normalizedDescription ? pendingRequest.current : {
12069
+ await save(pendingRequest.current !== void 0 && pendingRequest.current.channelRef === channel.channelRef && pendingRequest.current.name === normalizedName && pendingRequest.current.description === normalizedDescription ? pendingRequest.current : {
11446
12070
  requestId: mintRequestId(),
11447
12071
  workspaceId: channel.workspaceId,
11448
12072
  channelRef: channel.channelRef,
11449
12073
  name: normalizedName,
11450
12074
  description: normalizedDescription
11451
- };
11452
- pendingRequest.current = request;
11453
- setSaving(true);
11454
- setError(void 0);
11455
- try {
11456
- const result = await updateChannel(request);
11457
- if (result.ok) {
11458
- pendingRequest.current = void 0;
11459
- await onCommitted();
11460
- onClose();
11461
- } else setError(result.error.message);
11462
- } catch (cause) {
11463
- setError(cause instanceof Error ? cause.message : String(cause));
11464
- } finally {
11465
- setSaving(false);
11466
- }
12075
+ });
11467
12076
  };
11468
12077
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Modal, {
11469
12078
  open: true,
@@ -11570,20 +12179,60 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11570
12179
  }
11571
12180
  //#endregion
11572
12181
  //#region src/client/TeamWorkspaceBrowser.tsx
11573
- function TeamWorkspaceBrowser({ wide, expandSidebar, navigation, selectWorkspace, selectChannel, t, useWorkspaces, loadMembers, subscribeChanges, addMember, loadChannels, createChannel, updateChannel, archiveChannel, updateMember, recoverMember, archiveMember, joinChannel, removeChannelMember, loadModels, openMemberSession }) {
12182
+ function TeamWorkspaceBrowser({ wide, expandSidebar, navigation, selectWorkspace, selectChannel, selectInbox, t, useWorkspaces, loadMembers, loadInbox, subscribeChanges, subscribeReads, addMember, loadChannels, createChannel, updateChannel, archiveChannel, updateMember, recoverMember, archiveMember, joinChannel, removeChannelMember, loadModels, openMemberSession }) {
11574
12183
  const navigationState = (0, react.useSyncExternalStore)(navigation.subscribe, navigation.getSnapshot, navigation.getSnapshot);
11575
12184
  const workspaces = useWorkspaces((state) => state.items);
11576
12185
  const selected = navigationState.workspaceId;
11577
12186
  const selectedId = selected !== void 0 && workspaces.some((workspace) => workspace.workspaceId === selected) ? selected : workspaces[0]?.workspaceId;
11578
- const overviewIsCurrent = navigationState.channelRef === void 0 && navigationState.memberSessionId === void 0;
12187
+ const overviewIsCurrent = navigationState.channelRef === void 0 && navigationState.memberSessionId === void 0 && navigationState.inbox !== true;
12188
+ const inboxIsCurrent = navigationState.inbox === true;
11579
12189
  const [creatingAgents, setCreatingAgents] = (0, react.useState)([]);
11580
12190
  const [pendingSection, setPendingSection] = (0, react.useState)();
11581
12191
  const channelsRef = (0, react.useRef)(null);
11582
12192
  const agentsRef = (0, react.useRef)(null);
11583
12193
  const workspacesOpen = useSidebarSectionOpen(void 0, "workspaces");
12194
+ const [inboxTotal, setInboxTotal] = (0, react.useState)(0);
11584
12195
  (0, react.useEffect)(() => {
12196
+ let disposed = false;
12197
+ let scheduled;
12198
+ const refresh = async () => {
12199
+ const results = await Promise.all(workspaces.map((workspace) => loadInbox({
12200
+ workspaceId: workspace.workspaceId,
12201
+ directOnly: true,
12202
+ limit: 1
12203
+ })));
12204
+ if (disposed) return;
12205
+ setInboxTotal(results.reduce((sum, result) => result.ok ? sum + result.value.totalUnreadCount : sum, 0));
12206
+ };
12207
+ const schedule = () => {
12208
+ if (scheduled !== void 0) return;
12209
+ scheduled = setTimeout(() => {
12210
+ scheduled = void 0;
12211
+ refresh();
12212
+ }, 200);
12213
+ };
12214
+ refresh();
12215
+ const unsubscribe = subscribeChanges(void 0, (update) => {
12216
+ if (update.type === "changed") schedule();
12217
+ });
12218
+ const unsubscribeReads = subscribeReads(schedule);
12219
+ return () => {
12220
+ disposed = true;
12221
+ if (scheduled !== void 0) clearTimeout(scheduled);
12222
+ unsubscribe();
12223
+ unsubscribeReads();
12224
+ };
12225
+ }, [
12226
+ loadInbox,
12227
+ subscribeChanges,
12228
+ subscribeReads,
12229
+ workspaces
12230
+ ]);
12231
+ (0, react.useEffect)(() => {
12232
+ if (navigationState.inbox === true) return;
11585
12233
  if (navigationState.mode === "team" && selectedId !== void 0 && selectedId !== selected) selectWorkspace(selectedId);
11586
12234
  }, [
12235
+ navigationState.inbox,
11587
12236
  navigationState.mode,
11588
12237
  selected,
11589
12238
  selectedId,
@@ -11600,96 +12249,140 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11600
12249
  if (!wide) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("nav", {
11601
12250
  className: sidebar_module_css_default.railWorkspace,
11602
12251
  "aria-label": t("workspaceSections"),
11603
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
11604
- label: t("channels"),
11605
- side: "right",
11606
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11607
- type: "button",
11608
- className: sidebar_module_css_default.railButton,
11609
- "aria-label": t("channels"),
11610
- onClick: () => {
11611
- setPendingSection("channels");
11612
- expandSidebar();
11613
- },
11614
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconListPenOutline16, { size: 16 })
11615
- })
11616
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
11617
- label: t("agents"),
11618
- side: "right",
11619
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
11620
- type: "button",
11621
- className: sidebar_module_css_default.railButton,
11622
- "aria-label": t("agents"),
11623
- onClick: () => {
11624
- setPendingSection("agents");
11625
- expandSidebar();
11626
- },
11627
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 16 })
12252
+ children: [
12253
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
12254
+ label: t("mentionsOfMe"),
12255
+ side: "right",
12256
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
12257
+ type: "button",
12258
+ className: sidebar_module_css_default.railButton,
12259
+ "aria-label": inboxTotal > 0 ? t("mentionsOfMeWithCount", { count: inboxTotal }) : t("mentionsOfMe"),
12260
+ "aria-current": inboxIsCurrent ? "page" : void 0,
12261
+ onClick: () => {
12262
+ selectInbox();
12263
+ expandSidebar();
12264
+ },
12265
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQueueOutline14, { size: 16 }), inboxTotal > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12266
+ className: sidebar_module_css_default.inboxBadge,
12267
+ "aria-hidden": "true",
12268
+ children: inboxTotal > 99 ? "99+" : inboxTotal
12269
+ })]
12270
+ })
12271
+ }),
12272
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
12273
+ label: t("channels"),
12274
+ side: "right",
12275
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12276
+ type: "button",
12277
+ className: sidebar_module_css_default.railButton,
12278
+ "aria-label": t("channels"),
12279
+ onClick: () => {
12280
+ setPendingSection("channels");
12281
+ expandSidebar();
12282
+ },
12283
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconListPenOutline16, { size: 16 })
12284
+ })
12285
+ }),
12286
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
12287
+ label: t("agents"),
12288
+ side: "right",
12289
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
12290
+ type: "button",
12291
+ className: sidebar_module_css_default.railButton,
12292
+ "aria-label": t("agents"),
12293
+ onClick: () => {
12294
+ setPendingSection("agents");
12295
+ expandSidebar();
12296
+ },
12297
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconAgentPresetOutline16, { size: 16 })
12298
+ })
11628
12299
  })
11629
- })]
12300
+ ]
11630
12301
  });
11631
12302
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
11632
12303
  className: sidebar_module_css_default.workspaceBrowser,
11633
12304
  "aria-label": t("workspaces"),
11634
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamSidebarSection, {
11635
- title: t("workspaces"),
11636
- open: workspacesOpen,
11637
- onToggle: (open) => {
11638
- setSidebarSectionOpen(void 0, "workspaces", open);
11639
- },
11640
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11641
- className: sidebar_module_css_default.workspaceList,
11642
- children: [workspaces.map((workspace) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamWorkspaceRow, {
11643
- workspaceId: workspace.workspaceId,
11644
- title: workspace.title,
11645
- path: workspace.path,
11646
- selected: workspace.workspaceId === selectedId,
11647
- current: workspace.workspaceId === selectedId && overviewIsCurrent,
11648
- onSelect: selectWorkspace
11649
- }, workspace.workspaceId)), workspaces.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
11650
- className: sidebar_module_css_default.emptyState,
11651
- children: t("empty")
12305
+ children: [
12306
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
12307
+ type: "button",
12308
+ className: sidebar_module_css_default.inboxCard,
12309
+ "aria-label": inboxTotal > 0 ? t("mentionsOfMeWithCount", { count: inboxTotal }) : t("mentionsOfMe"),
12310
+ "aria-current": inboxIsCurrent ? "page" : void 0,
12311
+ onClick: selectInbox,
12312
+ children: [
12313
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconQueueOutline14, { size: 16 }),
12314
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12315
+ className: sidebar_module_css_default.inboxCardLabel,
12316
+ children: t("mentionsOfMe")
12317
+ }),
12318
+ inboxTotal > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
12319
+ className: sidebar_module_css_default.inboxBadge,
12320
+ "aria-hidden": "true",
12321
+ children: inboxTotal > 99 ? "99+" : inboxTotal
12322
+ })
12323
+ ]
12324
+ }),
12325
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamSidebarSection, {
12326
+ title: t("workspaces"),
12327
+ open: workspacesOpen,
12328
+ onToggle: (open) => {
12329
+ setSidebarSectionOpen(void 0, "workspaces", open);
12330
+ },
12331
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12332
+ className: sidebar_module_css_default.workspaceList,
12333
+ children: [workspaces.map((workspace) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamWorkspaceRow, {
12334
+ workspaceId: workspace.workspaceId,
12335
+ title: workspace.title,
12336
+ path: workspace.path,
12337
+ selected: workspace.workspaceId === selectedId,
12338
+ current: workspace.workspaceId === selectedId && overviewIsCurrent,
12339
+ onSelect: selectWorkspace
12340
+ }, workspace.workspaceId)), workspaces.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
12341
+ className: sidebar_module_css_default.emptyState,
12342
+ children: t("empty")
12343
+ })]
12344
+ })
12345
+ }),
12346
+ selectedId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
12347
+ className: sidebar_module_css_default.workspaceSection,
12348
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12349
+ ref: channelsRef,
12350
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamChannelsPanel, {
12351
+ workspaceId: selectedId,
12352
+ loadMembers,
12353
+ loadChannels,
12354
+ subscribeChanges,
12355
+ createChannel,
12356
+ updateChannel,
12357
+ archiveChannel,
12358
+ joinChannel,
12359
+ removeChannelMember,
12360
+ creatingAgents: creatingAgents.filter((request) => request.workspaceId === selectedId),
12361
+ ...navigationState.memberSessionId !== void 0 || navigationState.channelRef === void 0 ? {} : { selectedChannelRef: navigationState.channelRef },
12362
+ selectChannel,
12363
+ t
12364
+ }, selectedId)
12365
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
12366
+ ref: agentsRef,
12367
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamAgentsPanel, {
12368
+ workspaceId: selectedId,
12369
+ loadMembers,
12370
+ subscribeChanges,
12371
+ addMember,
12372
+ updateMember,
12373
+ recoverMember,
12374
+ archiveMember,
12375
+ loadModels,
12376
+ ...navigationState.memberSessionId === void 0 ? {} : { memberSessionId: navigationState.memberSessionId },
12377
+ openMemberSession,
12378
+ onCreatingChange: (request, creating) => {
12379
+ setCreatingAgents((current) => creating ? [...current.filter((item) => item.requestId !== request.requestId), request] : current.filter((item) => item.requestId !== request.requestId));
12380
+ },
12381
+ t
12382
+ }, selectedId)
11652
12383
  })]
11653
12384
  })
11654
- }), selectedId !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
11655
- className: sidebar_module_css_default.workspaceSection,
11656
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11657
- ref: channelsRef,
11658
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamChannelsPanel, {
11659
- workspaceId: selectedId,
11660
- loadMembers,
11661
- loadChannels,
11662
- subscribeChanges,
11663
- createChannel,
11664
- updateChannel,
11665
- archiveChannel,
11666
- joinChannel,
11667
- removeChannelMember,
11668
- creatingAgents: creatingAgents.filter((request) => request.workspaceId === selectedId),
11669
- ...navigationState.memberSessionId !== void 0 || navigationState.channelRef === void 0 ? {} : { selectedChannelRef: navigationState.channelRef },
11670
- selectChannel,
11671
- t
11672
- }, selectedId)
11673
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
11674
- ref: agentsRef,
11675
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TeamAgentsPanel, {
11676
- workspaceId: selectedId,
11677
- loadMembers,
11678
- subscribeChanges,
11679
- addMember,
11680
- updateMember,
11681
- recoverMember,
11682
- archiveMember,
11683
- loadModels,
11684
- ...navigationState.memberSessionId === void 0 ? {} : { memberSessionId: navigationState.memberSessionId },
11685
- openMemberSession,
11686
- onCreatingChange: (request, creating) => {
11687
- setCreatingAgents((current) => creating ? [...current.filter((item) => item.requestId !== request.requestId), request] : current.filter((item) => item.requestId !== request.requestId));
11688
- },
11689
- t
11690
- }, selectedId)
11691
- })]
11692
- })]
12385
+ ]
11693
12386
  });
11694
12387
  }
11695
12388
  //#endregion
@@ -11723,6 +12416,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11723
12416
  statusError: "错误",
11724
12417
  statusUnavailable: "不可用",
11725
12418
  addChannel: "新建频道",
12419
+ mentionsOfMe: "提到我",
12420
+ mentionsOfMeWithCount: "提到我,{count} 条未读提及",
12421
+ loadingInbox: "正在加载提到我…",
12422
+ inboxEmptyTitle: "还没有人提到你",
12423
+ inboxEmptyHint: "需要你知道或做决定时,成员会提到你",
12424
+ inboxTimeToday: "今天",
12425
+ inboxTimeYesterday: "昨天",
12426
+ inboxHeaderMeta: "共 {threads} 个 Thread · {mentions} 条提及,按最新提及排序",
11726
12427
  channelName: "名称",
11727
12428
  channelDescription: "说明",
11728
12429
  initialMembers: "初始成员",
@@ -11736,6 +12437,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11736
12437
  resumeAgent: "恢复",
11737
12438
  restartAgent: "重启",
11738
12439
  restartStillUnavailable: "重启已执行,成员仍不可用:{diagnostic}",
12440
+ restartRefusedNoRestart: "会话日志被确定拒绝,修复无可用项,重启无法解决:{detail}",
11739
12441
  restartFailed: "重启执行失败:{message}",
11740
12442
  archiveAgent: "归档",
11741
12443
  archiveAgentTitle: "归档 Agent:{name}",
@@ -11871,6 +12573,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11871
12573
  statusError: "Error",
11872
12574
  statusUnavailable: "Unavailable",
11873
12575
  addChannel: "New Channel",
12576
+ mentionsOfMe: "Mentions of me",
12577
+ mentionsOfMeWithCount: "Mentions of me, {count} unread mention(s)",
12578
+ loadingInbox: "Loading mentions…",
12579
+ inboxEmptyTitle: "Nobody has mentioned you yet",
12580
+ inboxEmptyHint: "Members will mention you when you must know or decide",
12581
+ inboxTimeToday: "Today",
12582
+ inboxTimeYesterday: "Yesterday",
12583
+ inboxHeaderMeta: "{threads} Thread(s) · {mentions} mention(s), newest first",
11874
12584
  channelName: "Name",
11875
12585
  channelDescription: "Description",
11876
12586
  initialMembers: "Initial members",
@@ -11884,6 +12594,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
11884
12594
  resumeAgent: "Resume",
11885
12595
  restartAgent: "Restart",
11886
12596
  restartStillUnavailable: "Restart ran, but the Member is still unavailable: {diagnostic}",
12597
+ restartRefusedNoRestart: "The session log is deterministically refused with nothing repairable; restarting cannot fix it: {detail}",
11887
12598
  restartFailed: "Restart failed: {message}",
11888
12599
  archiveAgent: "Archive",
11889
12600
  archiveAgentTitle: "Archive Agent: {name}",
@@ -12003,7 +12714,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12003
12714
  "connection",
12004
12715
  "conversation"
12005
12716
  ];
12006
- function registerModeShadow(ctx, navigation, changes, drafts, name, component, extraInject) {
12717
+ function registerModeShadow(ctx, navigation, changes, reads, drafts, name, component, extraInject, entryKey) {
12007
12718
  const openMemberSessionImpl = (sessionId) => {
12008
12719
  const sessions = ctx.sessions;
12009
12720
  const snapshot = navigation.getSnapshot();
@@ -12014,6 +12725,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12014
12725
  };
12015
12726
  const sharedRemotes = {
12016
12727
  loadChannels: (request) => ctx.remote.agentTeam.view(request),
12728
+ loadInbox: (request) => ctx.remote.agentTeam.inbox(request),
12729
+ subscribeReads: (listener) => reads.subscribe(listener),
12017
12730
  subscribeChanges: (scope, listener) => changes.subscribe(scope, listener),
12018
12731
  drafts,
12019
12732
  loadMembers: (request) => ctx.remote.agentTeam.members(request),
@@ -12032,9 +12745,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12032
12745
  let dispose;
12033
12746
  const reconcile = () => {
12034
12747
  const snapshot = navigation.getSnapshot();
12035
- const active = snapshot.mode === "team" && !(name === "conversation" && snapshot.memberSessionId !== void 0);
12748
+ const active = snapshot.mode === "team" && !(name === "main" && snapshot.memberSessionId !== void 0);
12036
12749
  if (active && dispose === void 0) dispose = ctx.slots.register({
12037
12750
  name,
12751
+ ...entryKey === void 0 ? {} : { key: entryKey },
12038
12752
  priority: -100,
12039
12753
  locale: NS,
12040
12754
  inject: () => ({
@@ -12042,8 +12756,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12042
12756
  ...extraInject?.(),
12043
12757
  ...navigation.actions(),
12044
12758
  ...sharedRemotes,
12045
- ...name === "conversation" ? {
12046
- readThread: (request) => ctx.remote.agentTeam.readThread(request),
12759
+ ...name === "main" ? {
12760
+ readThread: async (request) => {
12761
+ const result = await ctx.remote.agentTeam.readThread(request);
12762
+ if (result.ok) reads.bump();
12763
+ return result;
12764
+ },
12047
12765
  loadThreadHistory: (request) => ctx.remote.agentTeam.threadHistory(request),
12048
12766
  threadObservations: (request) => ctx.remote.agentTeam.threadObservations(request),
12049
12767
  sendMessage: (request) => ctx.remote.agentTeam.sendMessage(request),
@@ -12109,6 +12827,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12109
12827
  };
12110
12828
  }, "agent-team: member session restore");
12111
12829
  const changes = new TeamChangeStream((request, signal) => ctx.remote.agentTeam.changes(request, signal));
12830
+ const reads = new TeamReadStream();
12112
12831
  const loadMemberGroups = async () => {
12113
12832
  const workspaces = ctx.workspaces.list.getSnapshot().items;
12114
12833
  return (await Promise.all(workspaces.map(async (workspace) => {
@@ -12137,9 +12856,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
12137
12856
  loadMemberGroups
12138
12857
  })
12139
12858
  }, TeamFooterAction));
12140
- registerModeShadow(ctx, navigation, changes, drafts, "sidebar.workspaces", TeamWorkspaceBrowser);
12141
- registerModeShadow(ctx, navigation, changes, drafts, "conversation", TeamConversation);
12142
- registerModeShadow(ctx, navigation, changes, drafts, "sidebar.settings", TeamSettings, () => ({ loadMemberGroups }));
12859
+ registerModeShadow(ctx, navigation, changes, reads, drafts, "sidebar.workspaces", TeamWorkspaceBrowser);
12860
+ registerModeShadow(ctx, navigation, changes, reads, drafts, "main", TeamConversation, void 0, "conversation");
12861
+ registerModeShadow(ctx, navigation, changes, reads, drafts, "sidebar.settings", TeamSettings, () => ({ loadMemberGroups }));
12143
12862
  }
12144
12863
  async function apply(ctx) {
12145
12864
  const disposeRemote = await ctx.remote.$mount(TYPERT_REMOTE);