@teammy/server 0.2.21 → 0.2.23

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 (30) hide show
  1. package/dist/main.js +587 -36
  2. package/dist/web/assets/Assistant-Dks48Y5w.js +1 -0
  3. package/dist/web/assets/Computers-BtcIsnDD.css +1 -0
  4. package/dist/web/assets/Computers-CaCzZeCc.js +13 -0
  5. package/dist/web/assets/{Conversation-C5pZE7z5.js → Conversation-kAMzKADw.js} +1 -1
  6. package/dist/web/assets/{Dashboard-yaqwUqGh.js → Dashboard-ComNJNOg.js} +1 -1
  7. package/dist/web/assets/{Dropdown-DXEtBxVr.js → Dropdown-DGFI68Vd.js} +1 -1
  8. package/dist/web/assets/Files-Blsq_C-B.js +1 -0
  9. package/dist/web/assets/{Help-6fa7XqA5.js → Help-BM23uS-t.js} +58 -20
  10. package/dist/web/assets/{Markdown-nuwEQZ64.js → Markdown-CXnZDm5J.js} +4 -4
  11. package/dist/web/assets/{MessageComposer-0eprbRl2.js → MessageComposer-BoOgfyPA.js} +1 -1
  12. package/dist/web/assets/ResourceLibrary-C12_47kE.js +6 -0
  13. package/dist/web/assets/{TerminalPane-B0w1stXs.js → TerminalPane-BTRM-36z.js} +2 -2
  14. package/dist/web/assets/WorkspaceTree-Co7XG2RG.js +1 -0
  15. package/dist/web/assets/{file-links-Bo7XBz3i.js → file-links-CoVqmrXg.js} +1 -1
  16. package/dist/web/assets/index-mhJ33-bH.js +10 -0
  17. package/dist/web/assets/task-links-BE36-8mc.js +1 -0
  18. package/dist/web/downloads/teammy-inbox-skill.zip +0 -0
  19. package/dist/web/downloads/teammy-skill.zip +0 -0
  20. package/dist/web/index.html +2 -2
  21. package/dist/web/notification-worker.js +126 -0
  22. package/package.json +1 -1
  23. package/dist/web/assets/Assistant-3mdmSDTD.js +0 -1
  24. package/dist/web/assets/Computers-6l6HpFis.js +0 -13
  25. package/dist/web/assets/Computers-CBnQX-2p.css +0 -1
  26. package/dist/web/assets/Files-1vHzvDD3.js +0 -1
  27. package/dist/web/assets/ResourceLibrary-Cs01blNf.js +0 -6
  28. package/dist/web/assets/WorkspaceTree-DmSApj8i.js +0 -1
  29. package/dist/web/assets/index-Rry2cw7w.js +0 -10
  30. package/dist/web/assets/task-links-BJwIQ3SE.js +0 -1
package/dist/main.js CHANGED
@@ -599,7 +599,13 @@ var sessionMessagePageSize = 60;
599
599
  function questionNeedsAnswer(question) {
600
600
  return question.state === "pending" && (!question.response || ["human_routed", "failed", "handled"].includes(question.submissionState ?? ""));
601
601
  }
602
+ var LocalSessionAttentionSchema = z5.object({
603
+ title: z5.string(),
604
+ completion: z5.number().int().positive().nullable(),
605
+ question: z5.enum(["question", "approval", "plan"]).nullable()
606
+ });
602
607
  var LocalSessionChatSchema = z5.object({
608
+ attention: LocalSessionAttentionSchema.optional(),
603
609
  canRewind: z5.boolean().default(false),
604
610
  cursor: z5.number().int(),
605
611
  olderBefore: z5.number().int().positive().nullable().default(null),
@@ -5735,17 +5741,17 @@ function recordTaskChanges(hub, project) {
5735
5741
  const ref = reference(hub, project, target2);
5736
5742
  references[ref] = target2;
5737
5743
  const change = !task.active ? "\u5F52\u6863" : !old ? "\u65B0\u589E" : previous && !previous.active ? "\u6062\u590D" : "\u66F4\u65B0";
5738
- const fields2 = Object.entries(task.fields).filter(
5744
+ const fields3 = Object.entries(task.fields).filter(
5739
5745
  ([key3, field]) => key3 !== "title" && (previous ? JSON.stringify(previous.fields[key3]) !== JSON.stringify(field) : field != null && field !== "" && field !== false)
5740
5746
  ).map(
5741
5747
  ([key3, field]) => `${labels[key3] ?? key3}\uFF1A${previous ? value(previous.fields[key3]) + " \u2192 " : ""}${value(field)}`
5742
5748
  );
5743
5749
  if (previous && previous.fields.title !== task.fields.title)
5744
- fields2.unshift(`\u539F\u6807\u9898\uFF1A${previous.fields.title}`);
5750
+ fields3.unshift(`\u539F\u6807\u9898\uFF1A${previous.fields.title}`);
5745
5751
  if (previous && previous.owner !== task.owner)
5746
- fields2.unshift(`\u8D1F\u8D23\u4EBA\uFF1A${previous.owner} \u2192 ${task.owner}`);
5752
+ fields3.unshift(`\u8D1F\u8D23\u4EBA\uFF1A${previous.owner} \u2192 ${task.owner}`);
5747
5753
  lines2.push(
5748
- `[${ref}] ${task.owner} \xB7 ${change}\u300C${task.fields.title}\u300D${fields2.length ? "\n" + fields2.join("\n") : ""}`
5754
+ `[${ref}] ${task.owner} \xB7 ${change}\u300C${task.fields.title}\u300D${fields3.length ? "\n" + fields3.join("\n") : ""}`
5749
5755
  );
5750
5756
  }
5751
5757
  if (!lines2.length) return;
@@ -6987,9 +6993,29 @@ function transcriptPage(hub, identity, session, window) {
6987
6993
  ).get(...scope2, window.question);
6988
6994
  if (target2 && Number(target2.seq) < olderBefore) return range(Number(target2.seq));
6989
6995
  }
6996
+ if (window.message !== void 0 && olderBefore !== null && window.message < olderBefore) {
6997
+ const target2 = hub.db.prepare(`SELECT m.seq FROM member_session_messages m WHERE ${filter2} AND m.seq=?`).get(...scope2, window.message);
6998
+ if (target2) return range(Number(target2.seq));
6999
+ }
6990
7000
  return { rows, olderBefore };
6991
7001
  }
6992
7002
 
7003
+ // apps/server/member-execution/attention.ts
7004
+ var completedMessage = `m.superseded_by IS NULL AND m.role='assistant'
7005
+ AND ((m.state='succeeded' AND json_extract(m.activity_json,'$.kind')='turn'
7006
+ AND json_type(m.activity_json,'$.completedWork') IS NOT 'null')
7007
+ OR (m.state IN ('sent','succeeded') AND m.activity_json IS NULL AND m.source='agent-final'))`;
7008
+ var unansweredQuestion = `m.superseded_by IS NULL AND q.state='pending'
7009
+ AND NOT EXISTS(SELECT 1 FROM member_session_question_views v WHERE v.question_id=q.id)
7010
+ AND COALESCE((SELECT i.state FROM member_agent_inputs i
7011
+ JOIN member_session_messages a ON a.id='input:'||i.id
7012
+ WHERE i.project_id=q.project_id AND i.member_id=q.member_id AND a.session_id=m.session_id
7013
+ AND a.superseded_by IS NULL AND json_extract(i.payload_json,'$.source.type')='web_session'
7014
+ AND json_extract(i.payload_json,'$.interaction.action')='answer'
7015
+ AND json_extract(i.payload_json,'$.interaction.question')=q.id
7016
+ ORDER BY a.seq DESC LIMIT 1), CASE WHEN json_extract(q.content_json,'$.response') IS NULL
7017
+ THEN 'failed' ELSE 'submitted' END) IN ('failed','human_routed','handled')`;
7018
+
6993
7019
  // apps/server/member-execution/sessions.ts
6994
7020
  import { randomUUID as randomUUID13 } from "node:crypto";
6995
7021
  import { z as z26 } from "zod";
@@ -7456,6 +7482,28 @@ var MemberSessions = class {
7456
7482
  if (!row) throw new HubError(404, "SESSION_NOT_FOUND", "\u627E\u4E0D\u5230\u672C\u4EBA\u7684\u4F1A\u8BDD\u3002");
7457
7483
  return Number(row.seq);
7458
7484
  }
7485
+ attention(identity, id2) {
7486
+ const session = this.get(identity, id2);
7487
+ const completion = this.hub.db.prepare(
7488
+ `SELECT m.seq FROM member_session_messages m
7489
+ JOIN member_agent_sessions s ON s.project_id=m.project_id AND s.id=m.session_id
7490
+ WHERE m.project_id=? AND m.session_id=? AND m.seq>s.read_seq
7491
+ AND ${completedMessage}
7492
+ ORDER BY m.seq DESC LIMIT 1`
7493
+ ).get(identity.workspaceId, id2);
7494
+ const question = this.hub.db.prepare(
7495
+ `SELECT json_extract(q.content_json,'$.kind') kind,
7496
+ json_extract(q.content_json,'$.approval') approval
7497
+ FROM member_agent_questions q JOIN member_session_messages m ON m.id=q.id
7498
+ WHERE q.project_id=? AND q.member_id=? AND m.session_id=? AND ${unansweredQuestion}
7499
+ ORDER BY m.seq DESC LIMIT 1`
7500
+ ).get(identity.workspaceId, identity.memberId, id2);
7501
+ return {
7502
+ title: session.title,
7503
+ completion: completion ? Number(completion.seq) : null,
7504
+ question: question ? question.kind === "plan" ? "plan" : question.kind === "approval" || question.approval ? "approval" : "question" : null
7505
+ };
7506
+ }
7459
7507
  chat(identity, id2, window = {}) {
7460
7508
  const cursor = this.eventCursor(identity, id2);
7461
7509
  const session = this.get(identity, id2);
@@ -7591,6 +7639,7 @@ var MemberSessions = class {
7591
7639
  });
7592
7640
  return {
7593
7641
  session,
7642
+ attention: this.attention(identity, id2),
7594
7643
  messages,
7595
7644
  olderBefore,
7596
7645
  pendingQuestions,
@@ -7599,20 +7648,19 @@ var MemberSessions = class {
7599
7648
  canRewind: rewindAvailable(this.hub, identity, session)
7600
7649
  };
7601
7650
  }
7602
- read(identity, id2) {
7651
+ read(identity, id2, through) {
7603
7652
  this.get(identity, id2);
7604
- const last = Number(
7605
- this.hub.db.prepare(
7606
- "SELECT COALESCE(MAX(seq),0) seq FROM member_session_messages WHERE project_id=? AND session_id=?"
7607
- ).get(identity.workspaceId, id2).seq
7653
+ const last = Math.min(
7654
+ through ?? Infinity,
7655
+ Number(
7656
+ this.hub.db.prepare(
7657
+ "SELECT COALESCE(MAX(seq),0) seq FROM member_session_messages WHERE project_id=? AND session_id=?"
7658
+ ).get(identity.workspaceId, id2).seq
7659
+ )
7608
7660
  );
7609
- if (Number(
7610
- this.hub.db.prepare("SELECT read_seq FROM member_agent_sessions WHERE project_id=? AND id=?").get(identity.workspaceId, id2).read_seq
7611
- ) >= last)
7612
- return { ok: true };
7613
7661
  this.hub.db.prepare(
7614
- "UPDATE member_agent_sessions SET read_seq=(SELECT COALESCE(MAX(seq),0) FROM member_session_messages WHERE project_id=? AND session_id=?) WHERE project_id=? AND id=?"
7615
- ).run(identity.workspaceId, id2, identity.workspaceId, id2);
7662
+ "UPDATE member_agent_sessions SET read_seq=? WHERE project_id=? AND id=? AND read_seq<?"
7663
+ ).run(last, identity.workspaceId, id2, last);
7616
7664
  return { ok: true };
7617
7665
  }
7618
7666
  question(identity, session, question) {
@@ -7626,7 +7674,11 @@ var MemberSessions = class {
7626
7674
  presented(identity, session, question) {
7627
7675
  const row = this.question(identity, session, question);
7628
7676
  if (row.state === "pending")
7629
- this.hub.db.prepare("INSERT OR IGNORE INTO member_session_question_views VALUES(?,?)").run(question, Date.now());
7677
+ diagnosticTransaction(this.hub, () => {
7678
+ const inserted = this.hub.db.prepare("INSERT OR IGNORE INTO member_session_question_views VALUES(?,?)").run(question, Date.now());
7679
+ if (inserted.changes)
7680
+ this.hub.db.prepare("INSERT INTO member_session_events(project_id,session_id) VALUES(?,?)").run(identity.workspaceId, session);
7681
+ });
7630
7682
  return { ok: true };
7631
7683
  }
7632
7684
  command(identity, id2, input) {
@@ -8717,7 +8769,7 @@ var MemberExecution = class {
8717
8769
  hash3,
8718
8770
  JSON.stringify(payload),
8719
8771
  reason ? "human_routed" : "offered",
8720
- this.now() + (selecting ? 3e5 : withAttachments ? attachmentDeliveryWindow : 6e4),
8772
+ offer.source.type === "request.reply" ? Number.MAX_SAFE_INTEGER : this.now() + (selecting ? 3e5 : withAttachments ? attachmentDeliveryWindow : 6e4),
8721
8773
  reason,
8722
8774
  selecting ? null : directory?.deviceId ?? null
8723
8775
  );
@@ -8885,6 +8937,14 @@ var MemberExecution = class {
8885
8937
  continuation
8886
8938
  ) : "\u6CA1\u6709\u5DF2\u767B\u8BB0\u7684\u76EE\u5F55";
8887
8939
  const binding = input.target.directory ? this.binding(identity.workspaceId, input.target.directory, input.target.session) : void 0;
8940
+ if (input.source.type === "request.reply") {
8941
+ const session = new MemberSessions(this.hub).get(identity, input.target.session);
8942
+ if (session.hidden || session.archived) {
8943
+ this.humanRoute(identity, input, "\u539F\u4F1A\u8BDD\u5DF2\u9690\u85CF\u6216\u5F52\u6863\uFF0C\u7B54\u590D\u5DF2\u4FDD\u7559\u3002");
8944
+ return this.input(identity, id2);
8945
+ }
8946
+ if (reason) return input;
8947
+ }
8888
8948
  if (reason || !input.target.session && input.target.consumer !== "coordinator" && binding && Number(binding.revision) !== input.target.bindingRevision) {
8889
8949
  this.humanRoute(identity, input, reason ?? "\u4E13\u7528\u7FA4\u7ED1\u5B9A\u5DF2\u66F4\u66FF");
8890
8950
  return this.input(identity, id2);
@@ -8993,7 +9053,7 @@ var MemberExecution = class {
8993
9053
  this.fallback(identity, { ...input, state: "human_routed", reason });
8994
9054
  }
8995
9055
  fallback(identity, input) {
8996
- if (input.schedule) return;
9056
+ if (input.schedule || input.source.type === "request.reply") return;
8997
9057
  const body = handoffFailure(input);
8998
9058
  this.hub.db.prepare(
8999
9059
  "INSERT OR IGNORE INTO member_agent_fallbacks(input_id,project_id,member_id,body,reply_context) VALUES(?,?,?,?,?)"
@@ -9120,6 +9180,307 @@ ${JSON.stringify(snapshot)}`,
9120
9180
 
9121
9181
  // apps/server/messaging/runtime.ts
9122
9182
  import { randomUUID as randomUUID16 } from "node:crypto";
9183
+
9184
+ // apps/server/messaging/request-replies.ts
9185
+ function sourceDetails(hub, run) {
9186
+ const row = hub.db.prepare(
9187
+ `SELECT r.task_id,c.project_id,d.details_json FROM project_agent_runs r
9188
+ JOIN project_agent_conversations c ON c.id=r.conversation_id
9189
+ LEFT JOIN agent_run_details d ON d.run_id=r.id WHERE r.id=?`
9190
+ ).get(run);
9191
+ if (!row) return {};
9192
+ return row.task_id != null ? inputDetails(hub, String(row.project_id), Number(row.task_id)) : JSON.parse(String(row.details_json ?? "{}"));
9193
+ }
9194
+ function replyTarget(hub, project, message) {
9195
+ const source = hub.db.prepare(
9196
+ `SELECT o.source_run_id,o.source_user_id,r.conversation_id,c.owner FROM project_agent_outbox o
9197
+ JOIN project_agent_runs r ON r.id=o.source_run_id
9198
+ JOIN project_agent_conversations c ON c.id=r.conversation_id
9199
+ WHERE o.id=? AND o.project_id=? AND c.project_id=?`
9200
+ ).get(message, project, project);
9201
+ if (!source) return null;
9202
+ const details2 = sourceDetails(hub, String(source.source_run_id));
9203
+ if (details2.localExecution) {
9204
+ const original = hub.db.prepare("SELECT * FROM member_agent_inputs WHERE id=? AND project_id=?").get(details2.localExecution.inputId, project);
9205
+ if (!original)
9206
+ return { kind: "unavailable", project, reason: "\u539F\u672C\u5730\u8F93\u5165\u4E0D\u5B58\u5728\uFF0C\u7B54\u590D\u5DF2\u4FDD\u7559\u3002" };
9207
+ const payload = JSON.parse(String(original.payload_json));
9208
+ if (!payload.target.session || !payload.target.directory || !original.device_id)
9209
+ return { kind: "unavailable", project, reason: "\u539F\u672C\u5730\u8F93\u5165\u672A\u5173\u8054\u5177\u4F53\u4F1A\u8BDD\uFF0C\u7B54\u590D\u5DF2\u4FDD\u7559\u3002" };
9210
+ return {
9211
+ kind: "local",
9212
+ project,
9213
+ member: String(original.member_id),
9214
+ device: String(original.device_id),
9215
+ directory: payload.target.directory,
9216
+ session: payload.target.session,
9217
+ input: String(original.id),
9218
+ consultationRun: details2.localExecution.consultationRunId ?? String(source.source_run_id)
9219
+ };
9220
+ }
9221
+ let target2 = {
9222
+ kind: "cloud",
9223
+ project,
9224
+ member: String(source.source_user_id ?? source.owner ?? ""),
9225
+ run: String(source.source_run_id),
9226
+ conversation: String(source.conversation_id)
9227
+ };
9228
+ const visited = /* @__PURE__ */ new Set();
9229
+ while (!visited.has(target2.run)) {
9230
+ visited.add(target2.run);
9231
+ if (hub.db.prepare("SELECT 1 FROM agent_matters WHERE conversation_id=?").get(target2.conversation))
9232
+ break;
9233
+ const delegated = hub.db.prepare(
9234
+ `SELECT COALESCE(a.reply_run_id,a.source_run_id) run,
9235
+ COALESCE(a.reply_conversation_id,a.source_conversation_id) conversation,a.source_member
9236
+ FROM agent_collaborations a JOIN project_agent_runs r ON r.id=?
9237
+ WHERE a.project_id=? AND (a.target_run_id=r.id OR a.target_task_id=r.task_id)`
9238
+ ).get(target2.run, project);
9239
+ if (!delegated) break;
9240
+ target2 = {
9241
+ kind: "cloud",
9242
+ project,
9243
+ member: String(delegated.source_member),
9244
+ run: String(delegated.run),
9245
+ conversation: String(delegated.conversation)
9246
+ };
9247
+ }
9248
+ return target2;
9249
+ }
9250
+ function bindPrivateRequestReplies(hub, project, message) {
9251
+ const rows = hub.db.prepare(
9252
+ `SELECT r.id FROM routing_requests r JOIN routing_events e ON e.id=r.event_id
9253
+ WHERE e.project_id=? AND json_extract(e.context_json,'$.message')=?
9254
+ AND e.kind='private.message' AND e.meaning='request' AND r.reply_target_json IS NULL
9255
+ AND (r.state='waiting' OR r.outcome IN ('handoff_failed','external_handoff'))`
9256
+ ).all(project, message);
9257
+ if (!rows.length) return;
9258
+ const target2 = replyTarget(hub, project, message);
9259
+ if (!target2) return;
9260
+ for (const row of rows)
9261
+ hub.db.prepare("UPDATE routing_requests SET reply_target_json=? WHERE id=?").run(JSON.stringify(target2), row.id);
9262
+ }
9263
+ var requestReplyReceipt = "\u56DE\u590D\u5DF2\u8BB0\u5F55\u3002";
9264
+ function respondToPrivateRequest(hub, identity, input) {
9265
+ return diagnosticTransaction(hub, () => {
9266
+ requireProjectActor(hub, identity);
9267
+ const routing = new EventRouting(hub);
9268
+ const row = hub.db.prepare(
9269
+ `SELECT r.*,e.project_id,e.kind,e.meaning,e.context_json FROM routing_requests r
9270
+ JOIN routing_events e ON e.id=r.event_id WHERE r.id=? AND r.member_id=? AND e.project_id=?`
9271
+ ).get(input.request, identity.memberId, identity.workspaceId);
9272
+ if (!row) throw new HubError(404, "REQUEST_NOT_FOUND", "\u8BF7\u6C42\u4E0D\u5B58\u5728\u3002");
9273
+ if (row.kind !== "private.message" || row.meaning !== "request") return null;
9274
+ if (input.actorKind === "local_agent" && (row.handler !== "managed" || row.requires_human))
9275
+ throw new HubError(403, "ROUTED_REQUEST_OWNER", "\u8BE5\u8BF7\u6C42\u4E0D\u7531\u5F53\u524D Agent \u56DE\u5E94\u3002");
9276
+ const prior = JSON.parse(String(row.response_json ?? "null"));
9277
+ if (["answered", "replied"].includes(String(row.outcome))) {
9278
+ if (prior?.operation === input.operation && prior.body === input.body)
9279
+ return { status: "replied", requestId: input.request };
9280
+ throw new HubError(409, "REQUEST_ALREADY_ANSWERED", "\u8BE5\u8BF7\u6C42\u5DF2\u7B54\u590D\uFF0C\u672C\u6761\u672A\u518D\u6B21\u8F6C\u4EA4\u3002");
9281
+ }
9282
+ if (row.state !== "waiting" && !["handoff_failed", "external_handoff"].includes(String(row.outcome)))
9283
+ throw new HubError(409, "ROUTED_REQUEST_CLOSED", "\u8BF7\u6C42\u5DF2\u7ED3\u675F\u3002");
9284
+ const event = routing.event(String(row.event_id));
9285
+ if (!routing.recipientAvailable(event, identity.memberId))
9286
+ throw new HubError(403, "ROUTED_SOURCE_UNAVAILABLE", "\u63A5\u6536\u6210\u5458\u6216\u6765\u6E90\u8BBF\u95EE\u6743\u9650\u5DF2\u53D8\u66F4\u3002");
9287
+ const message = String(event.context.message);
9288
+ bindPrivateRequestReplies(hub, identity.workspaceId, message);
9289
+ const target2 = hub.db.prepare("SELECT reply_target_json FROM routing_requests WHERE id=?").get(input.request).reply_target_json;
9290
+ const answer = {
9291
+ operation: input.operation,
9292
+ body: input.body,
9293
+ actor: identity.memberId,
9294
+ actorKind: input.actorKind,
9295
+ answeredAt: (/* @__PURE__ */ new Date()).toISOString()
9296
+ };
9297
+ hub.db.prepare(
9298
+ "UPDATE routing_requests SET state='ended',outcome='replied',response_json=?,ended_at=? WHERE id=?"
9299
+ ).run(JSON.stringify(answer), answer.answeredAt, input.request);
9300
+ if (target2) routing.delivery(input.request, "request_return", "origin");
9301
+ if (input.actorKind === "member" && row.input_id) {
9302
+ hub.db.prepare(
9303
+ "UPDATE member_agent_inputs SET state='human_routed',reason='\u6210\u5458\u5DF2\u76F4\u63A5\u56DE\u5E94' WHERE id=? AND state='offered'"
9304
+ ).run(row.input_id);
9305
+ hub.db.prepare("UPDATE member_agent_fallbacks SET delivered=1 WHERE input_id=?").run(row.input_id);
9306
+ }
9307
+ hub.db.prepare(
9308
+ "UPDATE routing_deliveries SET state='closed',receipt_json=? WHERE request_id=? AND channel IN ('managed','hook') AND state='pending'"
9309
+ ).run(JSON.stringify({ reason: "\u8BF7\u6C42\u5DF2\u7B54\u590D" }), input.request);
9310
+ if (input.actorKind === "local_agent") {
9311
+ const notices = event.context.notices;
9312
+ if (notices?.[identity.memberId])
9313
+ new AgentMessages(hub).put({
9314
+ conversation: notices[identity.memberId],
9315
+ key: `request-answer:${input.request}`,
9316
+ role: "assistant",
9317
+ author: `\u672C\u5730 Agent\uFF08${identity.memberId}\uFF09`,
9318
+ body: input.body,
9319
+ source: "local_agent"
9320
+ });
9321
+ }
9322
+ return { status: "replied", requestId: input.request };
9323
+ });
9324
+ }
9325
+ function returnText(question, answer) {
9326
+ return `\u539F\u8BF7\u6C42\u7684\u7B54\u590D
9327
+ \u539F\u95EE\u9898\uFF1A${question}
9328
+ \u56DE\u7B54\u8005\uFF1A${answer.actor}${answer.actorKind === "local_agent" ? " \u7684\u672C\u5730 Agent" : ""}
9329
+ \u7B54\u590D\u539F\u6587\uFF1A
9330
+ ${answer.body}
9331
+
9332
+ \u8FD9\u662F\u539F\u8BF7\u6C42\u7684\u8865\u5145\u4FE1\u606F\uFF0C\u6309\u539F\u76EE\u6807\u548C\u6743\u9650\u7EE7\u7EED\uFF1B\u4E0D\u4EE3\u8868\u53D1\u8D77\u7528\u6237\u65B0\u589E\u6388\u6743\u3002\u65E0\u9700\u91CD\u590D\u53D1\u9001\u5DF2\u5F97\u5230\u7B54\u590D\u7684\u95EE\u9898\u3002`;
9333
+ }
9334
+ function flushPrivateRequestReplies(hub) {
9335
+ const routing = new EventRouting(hub);
9336
+ const rows = hub.db.prepare(
9337
+ `SELECT d.*,r.reply_target_json,r.response_json,e.body,e.project_id FROM routing_deliveries d
9338
+ JOIN routing_requests r ON r.id=d.request_id JOIN routing_events e ON e.id=r.event_id
9339
+ WHERE d.channel='request_return' AND d.state='pending' AND d.due_at<=? ORDER BY d.seq LIMIT 100`
9340
+ ).all(Date.now());
9341
+ for (const row of rows) {
9342
+ try {
9343
+ diagnosticTransaction(hub, () => {
9344
+ const target2 = JSON.parse(String(row.reply_target_json));
9345
+ const answer = JSON.parse(String(row.response_json));
9346
+ const text2 = returnText(String(row.body), answer);
9347
+ const requestReply = {
9348
+ requestId: String(row.request_id),
9349
+ actor: answer.actor,
9350
+ actorKind: answer.actorKind
9351
+ };
9352
+ const key3 = `request-return:${row.request_id}`;
9353
+ if (target2.project !== row.project_id)
9354
+ throw new HubError(403, "REPLY_TARGET_INVALID", "\u7B54\u590D\u6765\u6E90\u9879\u76EE\u4E0D\u4E00\u81F4\u3002");
9355
+ if (target2.kind === "unavailable")
9356
+ throw new HubError(409, "REPLY_TARGET_UNAVAILABLE", target2.reason);
9357
+ if (target2.kind === "cloud") {
9358
+ const source = hub.db.prepare(
9359
+ `SELECT c.role,c.owner FROM project_agent_runs r JOIN project_agent_conversations c ON c.id=r.conversation_id
9360
+ WHERE r.id=? AND c.id=? AND c.project_id=?`
9361
+ ).get(target2.run, target2.conversation, target2.project);
9362
+ if (!source)
9363
+ throw new HubError(404, "REPLY_TARGET_UNAVAILABLE", "\u539F\u4F1A\u8BDD\u5DF2\u4E0D\u53EF\u7528\uFF0C\u7B54\u590D\u5DF2\u4FDD\u7559\u3002");
9364
+ if (target2.member)
9365
+ requireProjectActor(hub, { workspaceId: target2.project, memberId: target2.member });
9366
+ const handoff = handedOffMatter(hub, target2.run);
9367
+ if (source.role === "lifetime" && !handoff) {
9368
+ const original2 = sourceDetails(hub, target2.run);
9369
+ const taskId = enqueueInput(hub, target2.project, text2, key3, {
9370
+ origin: { kind: "report", ...target2.member ? { actor: target2.member } : {} },
9371
+ ...original2.sourceActor ? { sourceActor: original2.sourceActor } : {},
9372
+ visible: false,
9373
+ audit: { sourceRunId: target2.run, requestId: row.request_id },
9374
+ requestReply
9375
+ });
9376
+ routing.receipt(String(row.id), "sent", { taskId });
9377
+ } else {
9378
+ const run = queueAgentReturn(hub, target2, text2, key3, { requestReply });
9379
+ routing.receipt(String(row.id), "sent", { runId: run });
9380
+ }
9381
+ return;
9382
+ }
9383
+ const identity = {
9384
+ workspaceId: target2.project,
9385
+ memberId: target2.member,
9386
+ deviceId: target2.device
9387
+ };
9388
+ const execution = new MemberExecution(hub), sessions2 = new MemberSessions(hub);
9389
+ const previous = JSON.parse(String(row.receipt_json ?? "{}"));
9390
+ let input = previous.inputId ? execution.input(identity, previous.inputId) : null;
9391
+ if (input?.state === "accepted") {
9392
+ routing.receipt(String(row.id), "sent", { inputId: input.id, accepted: true });
9393
+ return;
9394
+ }
9395
+ const original = execution.input(identity, target2.input);
9396
+ const session = sessions2.get(identity, target2.session);
9397
+ if (session.directory !== target2.directory || session.hidden || session.archived)
9398
+ throw new HubError(
9399
+ 409,
9400
+ "REPLY_TARGET_UNAVAILABLE",
9401
+ "\u539F\u4F1A\u8BDD\u5DF2\u9690\u85CF\u3001\u5F52\u6863\u6216\u53D8\u66F4\uFF0C\u7B54\u590D\u5DF2\u4FDD\u7559\u3002"
9402
+ );
9403
+ if (!input) {
9404
+ const reason = execution.reason(identity, target2.directory, false);
9405
+ if (reason) throw new Error(reason);
9406
+ input = execution.offer(identity, {
9407
+ operation: key3,
9408
+ kind: "directory.message",
9409
+ source: { type: "request.reply", ref: String(row.request_id) },
9410
+ session: target2.session,
9411
+ directory: target2.directory,
9412
+ continuation: target2.input,
9413
+ delivery: "queue",
9414
+ work: original.work,
9415
+ replyContext: session.replyContext,
9416
+ content: {
9417
+ originalText: text2,
9418
+ brief: "\u7EE7\u7EED\u5904\u7406\u672C\u4F1A\u8BDD\u53D1\u8D77\u7684\u539F\u8BF7\u6C42\u3002",
9419
+ intent: original.content.intent,
9420
+ constraints: original.content.constraints
9421
+ }
9422
+ });
9423
+ hub.db.prepare("UPDATE routing_deliveries SET receipt_json=? WHERE id=?").run(JSON.stringify({ inputId: input.id }), row.id);
9424
+ }
9425
+ if (input.state === "accepted")
9426
+ routing.receipt(String(row.id), "sent", { inputId: input.id, accepted: true });
9427
+ else if (input.state === "human_routed")
9428
+ routing.receipt(String(row.id), "closed", { inputId: input.id, reason: input.reason });
9429
+ else
9430
+ hub.db.prepare("UPDATE routing_deliveries SET due_at=? WHERE id=?").run(Date.now() + 1e3, row.id);
9431
+ });
9432
+ } catch (error) {
9433
+ const reason = error instanceof Error ? error.message : "\u7B54\u590D\u6682\u672A\u56DE\u9001";
9434
+ if (error instanceof HubError && [403, 404].includes(error.statusCode) || error instanceof HubError && error.code === "REPLY_TARGET_UNAVAILABLE") {
9435
+ const receipt = JSON.parse(
9436
+ String(
9437
+ hub.db.prepare("SELECT receipt_json FROM routing_deliveries WHERE id=?").get(row.id)?.receipt_json ?? "{}"
9438
+ )
9439
+ );
9440
+ if (receipt.inputId && hub.db.prepare("SELECT 1 FROM member_agent_inputs WHERE id=? AND project_id=?").get(receipt.inputId, row.project_id)) {
9441
+ const target2 = JSON.parse(String(row.reply_target_json));
9442
+ const execution = new MemberExecution(hub), identity = { workspaceId: target2.project, memberId: target2.member };
9443
+ const input = execution.input(identity, receipt.inputId);
9444
+ if (input.state === "offered") execution.humanRoute(identity, input, reason);
9445
+ }
9446
+ routing.receipt(String(row.id), "closed", { ...receipt, reason });
9447
+ } else
9448
+ hub.db.prepare(
9449
+ "UPDATE routing_deliveries SET attempts=attempts+1,error=?,due_at=? WHERE id=? AND state='pending'"
9450
+ ).run(
9451
+ reason,
9452
+ Date.now() + Math.min(6e4, 1e3 * 2 ** Math.min(Number(row.attempts), 6)),
9453
+ row.id
9454
+ );
9455
+ }
9456
+ }
9457
+ }
9458
+ function consultationRequests(hub, project, run) {
9459
+ return hub.db.prepare(
9460
+ `SELECT r.*,d.state return_state,d.error return_error,d.receipt_json FROM routing_requests r
9461
+ JOIN routing_events e ON e.id=r.event_id
9462
+ LEFT JOIN routing_deliveries d ON d.request_id=r.id AND d.channel='request_return'
9463
+ WHERE e.project_id=? AND e.meaning='request' AND e.kind='private.message'
9464
+ AND (json_extract(r.reply_target_json,'$.consultationRun')=? OR json_extract(e.context_json,'$.run')=?)
9465
+ ORDER BY r.rowid`
9466
+ ).all(project, run, run).map((row) => {
9467
+ const answer = JSON.parse(String(row.response_json ?? "null"));
9468
+ const receipt = JSON.parse(String(row.receipt_json ?? "null"));
9469
+ return {
9470
+ id: String(row.id),
9471
+ member: String(row.member_id),
9472
+ state: String(row.state),
9473
+ outcome: row.outcome,
9474
+ answer: ["answered", "replied"].includes(String(row.outcome)) ? answer : null,
9475
+ delivery: row.return_state ? {
9476
+ state: String(row.return_state),
9477
+ reason: row.return_state === "sent" ? null : receipt?.reason ?? row.return_error ?? null
9478
+ } : null
9479
+ };
9480
+ });
9481
+ }
9482
+
9483
+ // apps/server/messaging/runtime.ts
9123
9484
  function requireAttention(hub, request, reason) {
9124
9485
  const routing = new EventRouting(hub);
9125
9486
  const row = hub.db.prepare("SELECT * FROM routing_requests WHERE id=?").get(request);
@@ -9153,6 +9514,7 @@ ${event.body}`, requiresHuman: true },
9153
9514
  );
9154
9515
  }
9155
9516
  function flushEventRouting(hub) {
9517
+ flushPrivateRequestReplies(hub);
9156
9518
  const routing = new EventRouting(hub);
9157
9519
  diagnosticTransaction(hub, () => {
9158
9520
  for (const row of hub.db.prepare(
@@ -9272,6 +9634,13 @@ function replyToRoutedRequest(hub, identity, input) {
9272
9634
  const row = hub.db.prepare("SELECT * FROM routing_requests WHERE id=? AND member_id=? AND input_id=?").get(source.source.ref, identity.memberId, source.id);
9273
9635
  if (!row || row.handler !== "managed" || row.requires_human)
9274
9636
  throw new HubError(403, "ROUTED_REQUEST_OWNER", "\u8BE5\u8BF7\u6C42\u4E0D\u7531\u5F53\u524D Agent \u56DE\u5E94\u3002");
9637
+ const privateReply = respondToPrivateRequest(hub, identity, {
9638
+ request: String(row.id),
9639
+ operation: value.requestId,
9640
+ body: value.body,
9641
+ actorKind: "local_agent"
9642
+ });
9643
+ if (privateReply) return privateReply;
9275
9644
  const prior = row.response_json ? JSON.parse(String(row.response_json)) : null;
9276
9645
  if (prior?.operation === value.requestId && prior.body === value.body)
9277
9646
  return { status: "replied", requestId: String(row.id) };
@@ -11294,6 +11663,38 @@ var AgentNotices = class {
11294
11663
  identity.memberId,
11295
11664
  String(thread.message_id)
11296
11665
  );
11666
+ const receiptRun = randomUUID21();
11667
+ if (original && respondToPrivateRequest(this.hub, identity, {
11668
+ request: String(original.id),
11669
+ operation: requestId ?? receiptRun,
11670
+ body,
11671
+ actorKind: "member"
11672
+ })) {
11673
+ const date3 = (/* @__PURE__ */ new Date()).toISOString();
11674
+ this.hub.db.prepare(
11675
+ "INSERT INTO project_agent_runs(id,conversation_id,text,answer,state,created_at,updated_at) VALUES(?,?,?,?,'succeeded',?,?)"
11676
+ ).run(receiptRun, conversation, body, requestReplyReceipt, date3, date3);
11677
+ this.hub.db.prepare("INSERT INTO agent_run_actors VALUES(?,?)").run(receiptRun, identity.memberId);
11678
+ const messages2 = new AgentMessages(this.hub);
11679
+ messages2.input(conversation, receiptRun, body, identity.memberId);
11680
+ messages2.put({
11681
+ conversation,
11682
+ runId: receiptRun,
11683
+ key: `answer:${receiptRun}`,
11684
+ role: "assistant",
11685
+ body: requestReplyReceipt,
11686
+ source: "receipt"
11687
+ });
11688
+ this.hub.db.prepare(
11689
+ "UPDATE project_agent_recipients SET read_at=COALESCE(read_at,?) WHERE message_id=? AND user_id=?"
11690
+ ).run(date3, thread.message_id, identity.memberId);
11691
+ return {
11692
+ ...store.runView(
11693
+ this.hub.db.prepare("SELECT * FROM project_agent_runs WHERE id=?").get(receiptRun)
11694
+ ),
11695
+ conversationId: conversation
11696
+ };
11697
+ }
11297
11698
  if (original?.state === "waiting") {
11298
11699
  if (original.input_id) {
11299
11700
  this.hub.db.prepare(
@@ -11741,11 +12142,13 @@ var AgentStore = class {
11741
12142
  AND NOT EXISTS(SELECT 1 FROM agent_matter_handoffs h JOIN project_agent_runs sender ON sender.id=h.source_run_id
11742
12143
  WHERE h.target_run_id=r.id AND sender.state IN('queued','running'))
11743
12144
  AND (COALESCE(json_extract((SELECT hold_json FROM agent_matters WHERE conversation_id=r.conversation_id),'$.scope'),'')<>'all'
11744
- OR json_extract((SELECT details_json FROM agent_run_details WHERE run_id=r.id),'$.origin.kind')='human')
12145
+ OR json_extract((SELECT details_json FROM agent_run_details WHERE run_id=r.id),'$.origin.kind')='human'
12146
+ OR json_extract((SELECT details_json FROM agent_run_details WHERE run_id=r.id),'$.requestReply.actorKind')='member')
11745
12147
  AND NOT EXISTS(SELECT 1 FROM project_agent_runs earlier WHERE earlier.conversation_id=r.conversation_id
11746
12148
  AND earlier.rowid<r.rowid AND earlier.state IN('queued','running')
11747
12149
  AND (COALESCE(json_extract((SELECT hold_json FROM agent_matters WHERE conversation_id=r.conversation_id),'$.scope'),'')<>'all'
11748
- OR json_extract((SELECT details_json FROM agent_run_details WHERE run_id=earlier.id),'$.origin.kind')='human'))
12150
+ OR json_extract((SELECT details_json FROM agent_run_details WHERE run_id=earlier.id),'$.origin.kind')='human'
12151
+ OR json_extract((SELECT details_json FROM agent_run_details WHERE run_id=earlier.id),'$.requestReply.actorKind')='member'))
11749
12152
  AND NOT EXISTS(SELECT 1 FROM project_agent_runs active WHERE active.conversation_id=r.conversation_id AND active.state='running')
11750
12153
  ORDER BY r.rowid LIMIT 1`
11751
12154
  ).get(project, at);
@@ -11920,13 +12323,13 @@ var AgentStore = class {
11920
12323
  LEFT JOIN agent_run_actors a ON a.run_id=r.id
11921
12324
  LEFT JOIN agent_run_details d ON d.run_id=r.id WHERE r.id=?`
11922
12325
  ).get(sourceRunId) : null;
11923
- const sourceDetails = source?.task_id != null ? inputDetails(this.hub, project, Number(source.task_id)) : source?.details_json ? JSON.parse(String(source.details_json)) : void 0;
11924
- const sourceAudit = sourceDetails?.audit;
12326
+ const sourceDetails2 = source?.task_id != null ? inputDetails(this.hub, project, Number(source.task_id)) : source?.details_json ? JSON.parse(String(source.details_json)) : void 0;
12327
+ const sourceAudit = sourceDetails2?.audit;
11925
12328
  const sourceUser = source?.context_kind === "group" ? new WecomIdentities(this.hub).groupActor(
11926
12329
  project,
11927
12330
  sourceRunId,
11928
12331
  String(source.member_id ?? "")
11929
- ) || null : source?.member_id || source?.owner || sourceAudit?.requester || sourceDetails?.origin?.actor || null;
12332
+ ) || null : source?.member_id || source?.owner || sourceAudit?.requester || sourceDetails2?.origin?.actor || null;
11930
12333
  const id2 = randomUUID22();
11931
12334
  this.hub.db.prepare(
11932
12335
  `INSERT INTO project_agent_outbox
@@ -11998,6 +12401,7 @@ var AgentStore = class {
11998
12401
  ).run(Number(row.handler !== "human" && !policy.notify), id2, row.member_id);
11999
12402
  }
12000
12403
  }
12404
+ bindPrivateRequestReplies(this.hub, project, id2);
12001
12405
  return { messageId: id2 };
12002
12406
  }
12003
12407
  send(project, task, input, operationKey = null, sourceRunId = null, routing) {
@@ -13006,8 +13410,8 @@ var ProjectRepository = class {
13006
13410
  const current2 = this.config(identity);
13007
13411
  if (value.expectedRevision !== void 0 && current2.configRevision !== value.expectedRevision)
13008
13412
  throw new HubError(409, "STALE_CONFIG", "Project settings changed; reload before saving.");
13009
- const { expectedRevision: _, ...fields2 } = value;
13010
- const next = { ...current2, ...fields2 };
13413
+ const { expectedRevision: _, ...fields3 } = value;
13414
+ const next = { ...current2, ...fields3 };
13011
13415
  if (JSON.stringify(next) !== JSON.stringify(current2)) next.configRevision++;
13012
13416
  this.hub.db.prepare("UPDATE projects SET config_json=? WHERE id=?").run(JSON.stringify(next), identity.workspaceId);
13013
13417
  return next;
@@ -13835,6 +14239,10 @@ CREATE UNIQUE INDEX schedule_occurrence_slot ON schedule_occurrences(schedule_id
13835
14239
  `;
13836
14240
 
13837
14241
  // apps/server/messaging/schema.ts
14242
+ var privateRequestRepliesMigration = `
14243
+ ALTER TABLE routing_requests ADD COLUMN reply_target_json TEXT;
14244
+ CREATE INDEX routing_request_consultation ON routing_requests(json_extract(reply_target_json,'$.consultationRun'));
14245
+ `;
13838
14246
  var eventRoutingMigration = `
13839
14247
  CREATE TABLE routing_events (
13840
14248
  id TEXT PRIMARY KEY, project_id TEXT NOT NULL, source_key TEXT NOT NULL, kind TEXT NOT NULL,
@@ -20133,7 +20541,8 @@ var migrations = [
20133
20541
  taskCardNumbersMigration,
20134
20542
  sessionTranscriptIndexMigration,
20135
20543
  clientUpdateMigration,
20136
- schedulesMigration
20544
+ schedulesMigration,
20545
+ privateRequestRepliesMigration
20137
20546
  ];
20138
20547
  var HubStore = class {
20139
20548
  constructor(directory) {
@@ -22750,8 +23159,8 @@ var SaveMaterialSchema = z62.discriminatedUnion("action", [
22750
23159
  OrganizeMaterialSchema
22751
23160
  ]);
22752
23161
  var fieldsWithoutAction = (schema) => {
22753
- const { action: _action, ...fields2 } = schema.shape;
22754
- return z62.object(fields2).strict();
23162
+ const { action: _action, ...fields3 } = schema.shape;
23163
+ return z62.object(fields3).strict();
22755
23164
  };
22756
23165
  var materialToolSchemas = {
22757
23166
  create_project_material: fieldsWithoutAction(create),
@@ -23347,8 +23756,8 @@ var descriptions2 = {
23347
23756
  ...queryDescriptions,
23348
23757
  ...personalQueryDescriptions,
23349
23758
  report_task_issue: "\u63D0\u4EA4\u5F53\u524D\u5DE5\u4F5C\u4E2D\u6709\u5B9E\u9645\u5F71\u54CD\u7684\u4EFB\u52A1\u51B2\u7A81\u6216\u91CD\u590D\u3002tasks \u586B\u76F8\u5173\u4EFB\u52A1\u7684 ID \u548C\u5F53\u524D revision\uFF1Bkind \u4E3A conflict \u6216 duplicate\u3002summary \u5199\u540C\u4E8B\u59D3\u540D\u3001\u5177\u4F53\u4E8B\u5B9E\u548C\u5B9E\u9645\u5F71\u54CD\uFF0C\u4F7F\u7528\u9648\u8FF0\u53E5\u3002\u5BBF\u4E3B\u6821\u9A8C\u7248\u672C\u3001\u8D1F\u8D23\u4EBA\u5E76\u53BB\u91CD\uFF1Aconflict \u4EC5\u6D89\u53CA\u4E00\u4F4D\u8D1F\u8D23\u4EBA\u65F6\u53EA\u53D1\u79C1\u804A\uFF0C\u6D89\u53CA\u591A\u4F4D\u8D1F\u8D23\u4EBA\u65F6\u53D1\u9891\u9053\u53CA\u5404\u8D1F\u8D23\u4EBA\u79C1\u804A\uFF0C\u4E0D\u6295\u9012\u672C\u5730 Agent\uFF1Bduplicate \u4FDD\u7559\u79C1\u4EBA\u63D0\u9192\u3002queued \u8868\u793A\u5DF2\u6392\u961F\uFF0Calready_reported \u8868\u793A\u5DF2\u8BB0\u5F55\uFF0C\u65E0\u9700\u53E6\u53D1\u6D88\u606F\u3002",
23350
- reply_to_project_notice: "\u4EE3\u5F53\u524D\u7528\u6237\u63D0\u4EA4\u5176\u660E\u786E\u63D0\u4F9B\u7684\u7B54\u590D\uFF0C\u56DE\u5E94\u5176\u6536\u5230\u7684 Tim \u901A\u77E5\u3002\u5148 read_message \u6838\u5BF9\u539F\u95EE\u9898\uFF1B\u7B54\u590D\u4EE5\u7528\u6237\u8EAB\u4EFD\u8FDB\u5165\u901A\u77E5\u7684\u79C1\u4EBA\u8DDF\u8FDB\uFF0C\u53EF\u591A\u8F6E\u7EE7\u7EED\u3002\u4E0D\u662F Tim \u56DE\u590D\u5F53\u524D\u4F1A\u8BDD\u7684\u51FA\u53E3\uFF0C\u4E0D\u731C\u6D4B\u7528\u6237\u51B3\u5B9A\u3002",
23351
- send_private_message: "\u5411\u9879\u76EE\u6210\u5458\u53D1\u9001\u72EC\u7ACB\u6D88\u606F\u3002to \u586B\u6210\u5458 ID\uFF1Bmeaning=inform \u662F\u544A\u77E5\uFF0Crequest \u9700\u8981\u56DE\u5E94\uFF0CexpectedReply \u8BF4\u660E\u6240\u9700\u7ED3\u679C\u3002\u9700\u8981\u672C\u4EBA\u4F5C\u51FA\u7684\u51B3\u5B9A\u8BBE\u7F6E requiresHuman=true\uFF0C\u5176\u4F59\u7531\u6536\u4EF6\u4EBA\u7684\u7B56\u7565\u627F\u63A5\u5E76\u5728\u5B9E\u9645\u6743\u9650\u8303\u56F4\u5185\u5904\u7406\u3002\u6D88\u606F\u5148\u4FDD\u5B58\u7F51\u9875\uFF0C\u4F01\u5FAE\u6309\u6536\u4EF6\u4EBA\u504F\u597D\u540C\u6B65\uFF1B\u4E0D\u4EE3\u66FF\u5F53\u524D\u4F1A\u8BDD\u56DE\u7B54\u3002\u72EC\u7ACB\u6D88\u606F\u7528\u4E0D\u540C branch\u3002",
23759
+ reply_to_project_notice: "\u4EE3\u5F53\u524D\u7528\u6237\u63D0\u4EA4\u5176\u660E\u786E\u63D0\u4F9B\u7684\u7B54\u590D\uFF0C\u56DE\u5E94\u5176\u6536\u5230\u7684 Tim \u901A\u77E5\u3002\u5148 read_message \u6838\u5BF9\u539F\u95EE\u9898\uFF1B\u8BF7\u6C42\u53EA\u63A5\u53D7\u4E00\u6B21\u6709\u6548\u7B54\u590D\uFF0C\u7531\u5BBF\u4E3B\u56DE\u9001\u6765\u6E90\u5E76\u8FD4\u56DE\u56DE\u6267\uFF0C\u666E\u901A\u544A\u77E5\u53EF\u7EE7\u7EED\u8DDF\u8FDB\u3002\u4E0D\u662F Tim \u56DE\u590D\u5F53\u524D\u4F1A\u8BDD\u7684\u51FA\u53E3\uFF0C\u4E0D\u731C\u6D4B\u7528\u6237\u51B3\u5B9A\u3002",
23760
+ send_private_message: "\u5411\u9879\u76EE\u6210\u5458\u53D1\u9001\u72EC\u7ACB\u6D88\u606F\u3002to \u586B\u6210\u5458 ID\uFF1Bmeaning=inform \u662F\u544A\u77E5\uFF0Crequest \u9700\u8981\u56DE\u5E94\uFF0CexpectedReply \u8BF4\u660E\u6240\u9700\u7ED3\u679C\u3002request \u7684\u9996\u6761\u6709\u6548\u7B54\u590D\u7531\u5BBF\u4E3B\u81EA\u52A8\u9001\u56DE\u6765\u6E90\u4E0A\u4E0B\u6587\u5E76\u6392\u961F\u7EED\u63A5\uFF0C\u53D1\u51FA\u540E\u65E0\u9700\u7B49\u5F85\u6216\u8F6E\u8BE2\uFF1B\u8FFD\u95EE\u53E6\u5EFA\u8BF7\u6C42\u3002\u660E\u786E\u8981\u6C42\u672C\u4EBA\u56DE\u7B54\u6216\u9700\u8981\u672C\u4EBA\u51B3\u5B9A\u65F6\u8BBE\u7F6E requiresHuman=true\uFF0C\u5176\u4F59\u7531\u6536\u4EF6\u4EBA\u7684\u7B56\u7565\u627F\u63A5\u5E76\u5728\u5B9E\u9645\u6743\u9650\u8303\u56F4\u5185\u5904\u7406\u3002\u6D88\u606F\u5148\u4FDD\u5B58\u7F51\u9875\uFF0C\u4F01\u5FAE\u6309\u6536\u4EF6\u4EBA\u504F\u597D\u540C\u6B65\uFF1B\u4E0D\u4EE3\u66FF\u5F53\u524D\u4F1A\u8BDD\u56DE\u7B54\u3002\u72EC\u7ACB\u6D88\u606F\u7528\u4E0D\u540C branch\u3002",
23352
23761
  send_channel_post: "\u5411\u9879\u76EE\u9891\u9053\u53D1\u65B0\u5E16\u3002title \u4E3A\u6807\u9898\uFF0Cbody \u4FDD\u7559\u6B63\u6587\uFF0Cmembers \u586B\u9700\u8981\u63D0\u9192\u7684\u6210\u5458\u3002\u5148\u4FDD\u5B58\u7F51\u9875\uFF0C\u5DF2\u7ED1\u5B9A\u4F01\u5FAE\u9891\u9053\u65F6\u53E6\u884C\u540C\u6B65\uFF1Bweb \u8868\u793A\u4EC5\u7F51\u9875\uFF0Cqueued/sent/cancelled \u8868\u793A\u4F01\u5FAE\u6295\u9012\u60C5\u51B5\uFF0C\u4E0D\u5F71\u54CD\u7F51\u9875\u8BB0\u5F55\u3002\u53D1\u5E03\u4E0D\u76F4\u63A5\u4FEE\u6539\u4EFB\u52A1\uFF1B\u6210\u5458\u76F8\u5173\u4E8B\u4EF6\u6309\u5404\u81EA\u7B56\u7565\u63A5\u6536\u3002\u91CD\u8BD5\u6CBF\u7528 branch\u3002",
23353
23762
  post_pr_comment: "\u6309\u7528\u6237\u7684\u53D1\u5E03\u8981\u6C42\u5199\u4E00\u6761 PR \u666E\u901A\u8BC4\u8BBA\u3002\u6309\u8BC4\u8BBA\u76EE\u7684\u6838\u5BF9\u76F8\u5173\u4F9D\u636E\uFF1B\u6B63\u5F0F\u5BA1\u9605\u6309\u201C\u5BA1\u9605\u7ED3\u8BBA\u3001\u9700\u8981\u5904\u7406\u7684\u95EE\u9898\u3001\u9700\u8981\u786E\u8BA4\u7684\u4E8B\u9879\u3001\u68C0\u67E5\u8303\u56F4\u4E0E\u9650\u5236\u201D\u5206\u5C0F\u6807\u9898\uFF0C\u7A7A\u7684\u95EE\u9898\u4E0E\u786E\u8BA4\u7AE0\u8282\u7701\u7565\u3002\u8BF4\u660E\u5177\u4F53\u95EE\u9898\u3001\u5F71\u54CD\u53CA\u5FC5\u8981\u5EFA\u8BAE\uFF0C\u9644\u771F\u5B9E\u4F9D\u636E\uFF1B\u63CF\u8FF0\u5F85\u8865\u5145\u4E0E\u4EE3\u7801\u95EE\u9898\u5206\u5F00\uFF0C\u4E0D\u91CD\u590D\u5DF2\u77E5\u95EE\u9898\u6216\u5BBF\u4E3B\u7F72\u540D\u3002\u666E\u901A\u8BA8\u8BBA\u76F4\u63A5\u56DE\u7B54\uFF0C\u7528\u6237\u6307\u5B9A\u6B63\u6587\u65F6\u4FDD\u7559\u539F\u6587\u3002\u91CD\u8BD5\u590D\u7528\u539F\u8BC4\u8BBA\uFF0C\u72EC\u7ACB\u8BC4\u8BBA\u4F7F\u7528\u4E0D\u540C branch\u3002\u4E0D\u4FEE\u6539\u8BC4\u5BA1\u6216\u5408\u5E76\u72B6\u6001\u3002\u81EA\u52A8\u5BA1\u9605\u53EF\u5728 audience \u4E2D\u9644 summary\u3001recipients\u3001localRecipients\uFF1B\u4E24\u7C7B\u6536\u4EF6\u4EBA\u5206\u522B\u8BF4\u660E\u4F9D\u636E\uFF0C\u672A\u586B\u5199\u5219\u4E0D\u989D\u5916\u901A\u77E5\u3002",
23354
23763
  merge_pr: "\u6309\u7528\u6237\u660E\u786E\u7684\u5408\u5E76\u59D4\u6258\u6267\u884C\u5F53\u524D\u9879\u76EE PR/MR \u5408\u5E76\u3002\u7ED3\u5408\u5F53\u524D\u7248\u672C\u3001\u9879\u76EE\u89C4\u5219\u53CA\u539F\u59CB\u59D4\u6258\u5224\u65AD\u5408\u5E76\u6761\u4EF6\uFF1B\u666E\u901A\u6536\u5230\u6216\u542B\u7CCA\u7684 OK \u4E0D\u81EA\u52A8\u7B49\u4E8E\u5408\u5E76\u6388\u6743\u3002number \u4E3A\u9875\u9762\u7F16\u53F7\uFF0Chead \u4E3A\u5B8C\u6574\u63D0\u4EA4 SHA\uFF0CtargetBranch \u4E3A\u5DF2\u6838\u5BF9\u7684\u76EE\u6807\u5206\u652F\uFF0Cmethod \u9ED8\u8BA4 merge\u3002\u7248\u672C\u53D8\u5316\u9700\u91CD\u65B0\u6838\u5BF9\uFF0C\u4E0D\u80FD\u628A\u65E7\u59D4\u6258\u65E0\u6761\u4EF6\u7528\u4E8E\u65B0\u4EE3\u7801\u3002\u5BBF\u4E3B\u68C0\u67E5\u76EE\u6807\u5E76\u8C03\u7528\u5E73\u53F0\uFF0C\u4E0D\u66FF\u4EBA\u6279\u51C6\u3001\u4E0D\u7ED5\u8FC7\u5E73\u53F0\u4FDD\u62A4\u3002merged \u6216 already_merged \u624D\u8868\u793A\u5DF2\u5408\u5E76\uFF1B\u5931\u8D25\u5982\u5B9E\u53CD\u9988\uFF0C\u4E0D\u5BA3\u79F0\u5B8C\u6210\u3002\u6210\u529F\u540E\u7B80\u77ED\u786E\u8BA4\u64CD\u4F5C\u7ED3\u679C\uFF1B\u82E5\u5DF2\u6709\u8BC4\u5BA1\u5E16\uFF0C\u5BBF\u4E3B\u53E6\u6392\u6536\u5C3E\u8F6E\u79C1\u804A\u4F5C\u8005\uFF0C\u672C\u8F6E\u65E0\u9700\u91CD\u590D\u603B\u7ED3\u6216\u53E6\u53D1\u901A\u77E5\u3002"
@@ -24945,6 +25354,10 @@ import fastifyStatic from "@fastify/static";
24945
25354
  import { readFile as readFile6 } from "node:fs/promises";
24946
25355
  function registerWeb(server, root) {
24947
25356
  const html = () => readFile6(join28(root, "index.html"), "utf8");
25357
+ server.get(
25358
+ "/notification-worker.js",
25359
+ async (_request, reply) => reply.type("application/javascript; charset=utf-8").header("cache-control", "no-cache").send(await readFile6(join28(root, "notification-worker.js")))
25360
+ );
24948
25361
  for (const name of ["teammy-skill.zip", "teammy-inbox-skill.zip"])
24949
25362
  server.get(
24950
25363
  `/downloads/${name}`,
@@ -26544,7 +26957,7 @@ function registerClientRelease(server, version2, dataDir) {
26544
26957
  }
26545
26958
  server.get("/api/v1/client/latest", latest);
26546
26959
  return async (running) => {
26547
- let target2 = true ? "0.2.21" : version2;
26960
+ let target2 = true ? "0.2.23" : version2;
26548
26961
  if (dataDir) {
26549
26962
  try {
26550
26963
  target2 = (await readFile8(join30(dataDir, "client-update-version"), "utf8")).trim();
@@ -27746,6 +28159,119 @@ function registerHookInbox(server, hub) {
27746
28159
  });
27747
28160
  }
27748
28161
 
28162
+ // apps/server/browser-notifications.ts
28163
+ var ownedSessions = `FROM member_agent_sessions s
28164
+ JOIN projects p ON p.id=s.project_id
28165
+ JOIN members u ON u.workspace_id=s.project_id AND u.member_id=s.member_id AND u.enabled=1
28166
+ JOIN users account ON account.id=s.member_id AND account.enabled=1`;
28167
+ var fields2 = `s.project_id project, json_extract(p.config_json,'$.projectName') projectName,
28168
+ s.id session, s.directory_id directory, s.title, m.seq, m.id`;
28169
+ function browserReminders(hub, identity) {
28170
+ const completions = hub.db.prepare(
28171
+ `SELECT ${fields2}, m.body, m.activity_json,
28172
+ a.body answer, a.seq answerSeq, COALESCE(policy.notify,0) enabled
28173
+ ${ownedSessions}
28174
+ JOIN member_session_messages m ON m.seq=(SELECT m.seq FROM member_session_messages m
28175
+ WHERE m.project_id=s.project_id AND m.session_id=s.id AND m.seq>s.read_seq
28176
+ AND ${completedMessage} ORDER BY m.seq DESC LIMIT 1)
28177
+ LEFT JOIN member_session_messages a ON a.seq=(SELECT a.seq FROM member_session_messages a
28178
+ WHERE a.project_id=s.project_id AND a.session_id=s.id AND a.superseded_by IS NULL
28179
+ AND json_extract(a.activity_json,'$.kind')='answer'
28180
+ AND json_extract(a.activity_json,'$.turnId')=json_extract(m.activity_json,'$.turnId')
28181
+ ORDER BY a.seq DESC LIMIT 1)
28182
+ LEFT JOIN routing_policies policy ON policy.project_id=s.project_id
28183
+ AND policy.member_id=s.member_id AND policy.category='computer.completed'
28184
+ WHERE s.member_id=? AND s.hidden=0 ORDER BY m.seq`
28185
+ ).all(identity.memberId);
28186
+ const questions = hub.db.prepare(
28187
+ `SELECT ${fields2}, q.id question, q.content_json,
28188
+ COALESCE(policy.notify,0) enabled
28189
+ ${ownedSessions}
28190
+ JOIN member_session_messages m ON m.project_id=s.project_id AND m.session_id=s.id
28191
+ JOIN member_agent_questions q ON q.id=m.id AND q.project_id=s.project_id AND q.member_id=s.member_id
28192
+ LEFT JOIN routing_policies policy ON policy.project_id=s.project_id
28193
+ AND policy.member_id=s.member_id AND policy.category='computer.question'
28194
+ WHERE s.member_id=? AND s.hidden=0 AND ${unansweredQuestion} ORDER BY m.seq`
28195
+ ).all(identity.memberId);
28196
+ const items = [...completions, ...questions].map((row) => {
28197
+ const activity = JSON.parse(String(row.activity_json ?? "null"));
28198
+ const question = JSON.parse(String(row.content_json ?? "null"));
28199
+ return {
28200
+ id: JSON.stringify([
28201
+ row.project,
28202
+ row.session,
28203
+ question ? "question" : "completion",
28204
+ question?.id ?? activity?.turnId ?? row.id
28205
+ ]),
28206
+ project: String(row.project),
28207
+ projectName: String(row.projectName),
28208
+ session: String(row.session),
28209
+ directory: String(row.directory),
28210
+ title: String(row.title),
28211
+ kind: question ? question.kind === "plan" ? "plan" : question.kind === "approval" || question.approval ? "approval" : "question" : "completion",
28212
+ preview: turnAnswerPreview(
28213
+ String(
28214
+ question?.questions?.[0]?.text ?? activity?.completedWork?.answer ?? row.answer ?? activity?.completedWork?.preview ?? row.body ?? ""
28215
+ )
28216
+ ),
28217
+ sequence: Number(row.answerSeq ?? row.seq),
28218
+ ...question ? { question: String(row.question) } : {},
28219
+ enabled: !!row.enabled
28220
+ };
28221
+ });
28222
+ return { member: identity.memberId, at: Date.now(), items };
28223
+ }
28224
+ function registerBrowserNotifications(server, hub) {
28225
+ const site = new SiteRepository(hub);
28226
+ const streams = /* @__PURE__ */ new Set();
28227
+ server.addHook("preClose", async () => {
28228
+ for (const stream of streams) stream.end();
28229
+ });
28230
+ server.get("/api/v1/web/notifications/events", async (request, reply) => {
28231
+ const identity = site.identity(cookieToken(request));
28232
+ const initial = browserReminders(hub, identity);
28233
+ reply.hijack();
28234
+ const response = reply.raw;
28235
+ response.writeHead(200, {
28236
+ "content-type": "text/event-stream; charset=utf-8",
28237
+ "cache-control": "no-store",
28238
+ connection: "keep-alive",
28239
+ "x-accel-buffering": "no"
28240
+ });
28241
+ let previous = JSON.stringify(initial.items), ping = Date.now();
28242
+ response.write(`event: reminders
28243
+ data: ${JSON.stringify(initial)}
28244
+
28245
+ `);
28246
+ streams.add(response);
28247
+ const timer = setInterval(() => {
28248
+ try {
28249
+ const current2 = site.identity(cookieToken(request));
28250
+ if (current2.memberId !== identity.memberId)
28251
+ throw new HubError(401, "LOGIN_REQUIRED", "Identity changed");
28252
+ const snapshot = browserReminders(hub, current2);
28253
+ const next = JSON.stringify(snapshot.items);
28254
+ if (next !== previous || Date.now() - ping >= 15e3) {
28255
+ response.write(`event: reminders
28256
+ data: ${JSON.stringify(snapshot)}
28257
+
28258
+ `);
28259
+ previous = next;
28260
+ ping = Date.now();
28261
+ }
28262
+ } catch (error) {
28263
+ if (error instanceof HubError && error.statusCode === 401)
28264
+ response.write("event: expired\ndata: {}\n\n");
28265
+ response.end();
28266
+ }
28267
+ }, 2e3);
28268
+ response.once("close", () => {
28269
+ clearInterval(timer);
28270
+ streams.delete(response);
28271
+ });
28272
+ });
28273
+ }
28274
+
27749
28275
  // apps/server/member-execution/routes.ts
27750
28276
  import { z as z92 } from "zod";
27751
28277
 
@@ -27791,6 +28317,7 @@ var TeamConsultations = class {
27791
28317
  return {
27792
28318
  conversationId,
27793
28319
  run,
28320
+ requests: consultationRequests(this.hub, identity.workspaceId, runId),
27794
28321
  url: `${base}/projects/${encodeURIComponent(identity.workspaceId)}/assistant?chat=${encodeURIComponent(conversationId)}`
27795
28322
  };
27796
28323
  }
@@ -27817,6 +28344,7 @@ var TeamConsultations = class {
27817
28344
  return {
27818
28345
  conversationId: chat,
27819
28346
  run,
28347
+ requests: [],
27820
28348
  url: `${base}/projects/${encodeURIComponent(identity.workspaceId)}/assistant?chat=${encodeURIComponent(chat)}`
27821
28349
  };
27822
28350
  });
@@ -27849,7 +28377,7 @@ function consultTeam(hub, identity, body) {
27849
28377
  \u539F\u7528\u6237/\u6765\u6E90\u5185\u5BB9\uFF1A${original.content.originalText}
27850
28378
  \u7EA6\u675F\uFF1A${original.content.constraints.join("\uFF1B")}
27851
28379
  \u672C\u5730 Agent \u7684\u8BF7\u6C42\uFF1A${value.text}
27852
- \u6309\u5DF2\u6709\u8D44\u6599\u4E0E\u53CD\u9988\u56DE\u7B54\u5F53\u524D\u54A8\u8BE2\uFF0C\u4E0D\u91CD\u65B0\u6D3E\u53D1\u672C\u5730\u5DE5\u4F5C\u3002\u63A5\u624B\u72B6\u6001\u6216\u7F3A\u5C11\u53CD\u9988\u4E0D\u80FD\u8BC1\u660E\u5DE5\u4F5C\u4ECD\u5728\u6267\u884C\uFF1B\u5386\u53F2\u53CD\u9988\u4E0E\u53C2\u8003\u4ED3\u5E93\u9700\u8BF4\u660E\u6765\u6E90\u548C\u65F6\u95F4\uFF0C\u4E0D\u80FD\u66FF\u4EE3\u5F53\u524D\u5DE5\u4F5C\u533A\u3002\u6B63\u5E38\u7ED3\u8BBA\u76F4\u63A5\u56DE\u5230\u53D1\u8D77\u54A8\u8BE2\u7684\u672C\u5730 Agent\u3002`;
28380
+ \u6309\u5DF2\u6709\u8D44\u6599\u4E0E\u53CD\u9988\u56DE\u7B54\u5F53\u524D\u54A8\u8BE2\uFF0C\u4E0D\u91CD\u65B0\u6D3E\u53D1\u672C\u5730\u5DE5\u4F5C\u3002\u9700\u8981\u5411\u5177\u4F53\u6210\u5458\u63D0\u95EE\u65F6\uFF0C\u4F7F\u7528 send_private_message\uFF08meaning=request\uFF09\uFF1B\u660E\u786E\u8981\u6C42\u672C\u4EBA\u56DE\u7B54\u6216\u9700\u8981\u672C\u4EBA\u51B3\u7B56\u65F6\u8BBE\u7F6E requiresHuman=true\u3002\u5BBF\u4E3B\u4F1A\u628A\u6210\u5458\u7684\u5355\u6B21\u7B54\u590D\u81EA\u52A8\u56DE\u9001\u539F\u672C\u5730 Session\uFF0C\u53D1\u51FA\u95EE\u9898\u540E\u8BF4\u660E\u7B49\u5F85\u7B54\u590D\u5373\u53EF\uFF0C\u4E0D\u8F6E\u8BE2\u6216\u91CD\u53D1\u3002\u63A5\u624B\u72B6\u6001\u6216\u7F3A\u5C11\u53CD\u9988\u4E0D\u80FD\u8BC1\u660E\u5DE5\u4F5C\u4ECD\u5728\u6267\u884C\uFF1B\u5386\u53F2\u53CD\u9988\u4E0E\u53C2\u8003\u4ED3\u5E93\u9700\u8BF4\u660E\u6765\u6E90\u548C\u65F6\u95F4\uFF0C\u4E0D\u80FD\u66FF\u4EE3\u5F53\u524D\u5DE5\u4F5C\u533A\u3002\u666E\u901A\u67E5\u8BE2\u7ED3\u8BBA\u7559\u5728\u672C\u6B21\u54A8\u8BE2\u7ED3\u679C\u4E2D\uFF0C\u4F9B\u53D1\u8D77 Agent \u8BFB\u53D6\u3002`;
27853
28381
  const result = new TeamConsultations(hub).ask(identity, {
27854
28382
  text: text2,
27855
28383
  requestId: `local:${value.requestId}`,
@@ -27859,7 +28387,11 @@ function consultTeam(hub, identity, body) {
27859
28387
  result.run.id,
27860
28388
  JSON.stringify({
27861
28389
  origin: { kind: "report", actor: identity.memberId },
27862
- localExecution: { inputId: original.id, work: original.work }
28390
+ localExecution: {
28391
+ inputId: original.id,
28392
+ work: original.work,
28393
+ consultationRunId: result.run.id
28394
+ }
27863
28395
  })
27864
28396
  );
27865
28397
  hub.db.prepare(
@@ -27883,7 +28415,11 @@ function registerMemberExecution(server, hub, previews) {
27883
28415
  });
27884
28416
  server.get("/web/local-agent-sessions/:id/events", async (request, reply) => {
27885
28417
  const identity = authorizeWeb(hub, request), session = id2(request.params);
27886
- const updatesOnly = z92.object({ updates: z92.literal("1").optional() }).parse(request.query).updates === "1";
28418
+ const options = z92.object({
28419
+ updates: z92.literal("1").optional(),
28420
+ attention: z92.literal("1").optional()
28421
+ }).parse(request.query);
28422
+ const updatesOnly = options.updates === "1";
27887
28423
  let cursor = sessions2.eventCursor(identity, session);
27888
28424
  reply.hijack();
27889
28425
  const response = reply.raw;
@@ -27893,6 +28429,7 @@ function registerMemberExecution(server, hub, previews) {
27893
28429
  connection: "keep-alive",
27894
28430
  "x-accel-buffering": "no"
27895
28431
  });
28432
+ let previousAttention = "";
27896
28433
  const send2 = () => {
27897
28434
  if (updatesOnly) response.write(`id: ${cursor}
27898
28435
  event: change
@@ -27907,6 +28444,17 @@ data: ${JSON.stringify(sessions2.chat(identity, session, { from: 1 }))}
27907
28444
 
27908
28445
  `
27909
28446
  );
28447
+ if (options.attention === "1") {
28448
+ const attention = JSON.stringify(sessions2.attention(identity, session));
28449
+ if (attention !== previousAttention) {
28450
+ response.write(`id: ${cursor}
28451
+ event: attention
28452
+ data: ${attention}
28453
+
28454
+ `);
28455
+ previousAttention = attention;
28456
+ }
28457
+ }
27910
28458
  };
27911
28459
  streams.add(response);
27912
28460
  send2();
@@ -28015,7 +28563,8 @@ data: ${JSON.stringify(sessions2.chat(identity, session, { from: 1 }))}
28015
28563
  const window = z92.object({
28016
28564
  before: seq.optional(),
28017
28565
  from: seq.optional(),
28018
- question: z92.string().max(500).optional()
28566
+ question: z92.string().max(500).optional(),
28567
+ message: seq.optional()
28019
28568
  }).parse(request.query);
28020
28569
  return sessions2.chat(authorizeWeb(hub, request), id2(request.params), window);
28021
28570
  });
@@ -28047,7 +28596,8 @@ data: ${JSON.stringify(sessions2.chat(identity, session, { from: 1 }))}
28047
28596
  });
28048
28597
  server.post("/web/local-agent-sessions/:id/read", async (request) => {
28049
28598
  webMutation(request);
28050
- return sessions2.read(authorizeWeb(hub, request), id2(request.params));
28599
+ const { through } = z92.object({ through: z92.number().int().nonnegative().optional() }).parse(request.body ?? {});
28600
+ return sessions2.read(authorizeWeb(hub, request), id2(request.params), through);
28051
28601
  });
28052
28602
  server.get("/web/local-agent-sessions/:id/diff/:command", async (request) => {
28053
28603
  const params2 = z92.object({ id: z92.string(), command: z92.uuid() }).parse(request.params);
@@ -28502,6 +29052,7 @@ function buildServer(options) {
28502
29052
  registerScheduleRuntime(server, store);
28503
29053
  registerTaiAuth(server, store, options.authEnv ?? {});
28504
29054
  registerSiteRoutes(server, store);
29055
+ registerBrowserNotifications(server, store);
28505
29056
  registerClientAccess(server, store);
28506
29057
  registerWecom(server, store, options.wecomEnv ?? {}, options.wecomFactory);
28507
29058
  registerWebSearch(server, store, options.searchEnv ?? {});