weaver-work-cli 0.1.48 → 0.1.49

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 (96) hide show
  1. package/dist/chunks/{archive-oa-EDJDU3V4.js → archive-oa-57R2FYHV.js} +111 -12
  2. package/dist/chunks/{attachment-content-4KSNBPRO.js → attachment-content-MU2LPI5P.js} +3 -3
  3. package/dist/chunks/{chunk-WMSAWAWZ.js → chunk-3NV2ETZR.js} +6 -6
  4. package/dist/chunks/{chunk-PSPOFLSU.js → chunk-3X7VOSBA.js} +1 -1
  5. package/dist/chunks/chunk-5QYE52LG.js +223 -0
  6. package/dist/chunks/{chunk-FEP6ELMR.js → chunk-6GWU63YF.js} +1 -1
  7. package/dist/chunks/{chunk-3YV7PKRL.js → chunk-6QYNE6HE.js} +12 -212
  8. package/dist/chunks/{chunk-EFOUMXIX.js → chunk-BRRW7CWA.js} +25 -25
  9. package/dist/chunks/{chunk-5B5JXTY2.js → chunk-D2QRZUW4.js} +209 -25
  10. package/dist/chunks/{chunk-OCYRVZGN.js → chunk-EJVA5ZVB.js} +2 -2
  11. package/dist/chunks/{chunk-BCACE6VV.js → chunk-GEOMANP7.js} +3 -3
  12. package/dist/chunks/{chunk-O6CMPO65.js → chunk-IW7A2IQY.js} +16 -146
  13. package/dist/chunks/chunk-JEQHNNSS.js +158 -0
  14. package/dist/chunks/{chunk-NK74RE5F.js → chunk-K3BT54CU.js} +3 -3
  15. package/dist/chunks/{chunk-R2HHLJNN.js → chunk-KV5SOWMS.js} +4 -4
  16. package/dist/chunks/{chunk-SVFG6EMV.js → chunk-ZKEUGS2U.js} +5 -5
  17. package/dist/chunks/{conflict-APGSD5E7.js → conflict-6347A7YK.js} +2 -2
  18. package/dist/chunks/{create-flow-5TXFOC7X.js → create-flow-7WG7LVX5.js} +6 -6
  19. package/dist/chunks/data-QO7QWOIV.js +2525 -0
  20. package/dist/chunks/{employee-NOHNXC46.js → employee-DR5Y64TI.js} +2 -1
  21. package/dist/chunks/{env-B6GKA2J3.js → env-LHRKSLG6.js} +2 -2
  22. package/dist/chunks/{factory-MFCKLUT6.js → factory-2H7Z4RWJ.js} +1 -1
  23. package/dist/chunks/{group-chat-YE7WIBFO.js → group-chat-EW6PNDDT.js} +3 -3
  24. package/dist/chunks/{hrm-UNKCCCGP.js → hrm-YGIR3HGF.js} +4 -2
  25. package/dist/chunks/{meeting-RYZV2JTQ.js → meeting-N2FQBHXI.js} +10 -10
  26. package/dist/chunks/org-NFE7X7FK.js +12 -0
  27. package/dist/chunks/{reception-VL6TKVAW.js → reception-MYOKJULO.js} +429 -94
  28. package/dist/chunks/{recruit-stage-ERZD3ZNB.js → recruit-stage-FKWS5UQF.js} +66 -13
  29. package/dist/chunks/{registry-VWXWPVAG.js → registry-3UGIWH53.js} +4 -2
  30. package/dist/chunks/{registry-22O6UG4I.js → registry-CKUVBS53.js} +10 -10
  31. package/dist/chunks/{room-recommend-IMZPJMYB.js → room-recommend-MBCYENQ2.js} +4 -4
  32. package/dist/chunks/{schedule-SPPAHER2.js → schedule-5IFMCXME.js} +4 -4
  33. package/dist/index.js +12 -7
  34. package/dist/shortcuts/archive-oa/operations/contract-modules.js +57 -0
  35. package/dist/shortcuts/archive-oa/operations/contract.js +23 -8
  36. package/dist/shortcuts/archive-oa/operations/registry.js +4 -1
  37. package/dist/shortcuts/archive-oa/operations/shared.js +41 -5
  38. package/dist/shortcuts/data/errors.js +64 -0
  39. package/dist/shortcuts/data/host.js +140 -0
  40. package/dist/shortcuts/data/index.js +429 -0
  41. package/dist/shortcuts/data/manifest.js +133 -0
  42. package/dist/shortcuts/data/operations/attend.js +62 -0
  43. package/dist/shortcuts/data/operations/conf.js +384 -0
  44. package/dist/shortcuts/data/operations/ds.js +686 -0
  45. package/dist/shortcuts/data/operations/field.js +68 -0
  46. package/dist/shortcuts/data/operations/index.js +65 -0
  47. package/dist/shortcuts/data/operations/module.js +383 -0
  48. package/dist/shortcuts/data/operations/noun.js +102 -0
  49. package/dist/shortcuts/data/operations/query.js +85 -0
  50. package/dist/shortcuts/data/operations/scene.js +235 -0
  51. package/dist/shortcuts/data/operations/shared.js +279 -0
  52. package/dist/shortcuts/ehr/recruit-stage/operations/interview-arrange.js +12 -5
  53. package/dist/shortcuts/ehr/recruit-stage/operations/resume-import.js +21 -13
  54. package/dist/shortcuts/ehr/recruit-stage/shared.js +57 -0
  55. package/dist/shortcuts/index.js +5 -0
  56. package/dist/shortcuts/meeting/operations/eb/member-expand.js +200 -0
  57. package/dist/shortcuts/meeting/operations/registry.js +2 -0
  58. package/dist/shortcuts/reception/constants.js +11 -0
  59. package/dist/shortcuts/reception/index.js +3 -1
  60. package/dist/shortcuts/reception/manifest.js +3 -2
  61. package/dist/shortcuts/reception/operations/ask.js +20 -2
  62. package/dist/shortcuts/reception/operations/compose.js +11 -0
  63. package/dist/shortcuts/reception/operations/doc.js +59 -0
  64. package/dist/shortcuts/reception/operations/docrender.js +25 -1
  65. package/dist/shortcuts/reception/operations/leads.js +1 -1
  66. package/dist/shortcuts/reception/operations/panels.js +84 -21
  67. package/dist/shortcuts/reception/operations/render.js +40 -0
  68. package/dist/shortcuts/reception/operations/restaurant.js +17 -4
  69. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +12 -5
  70. package/dist/shortcuts/recruit-stage/operations/resume-import.js +21 -13
  71. package/dist/shortcuts/recruit-stage/shared.js +57 -0
  72. package/docs/SKILL.md +1 -0
  73. package/docs/_catalog.md +3 -0
  74. package/docs/data.md +149 -0
  75. package/docs/reception.md +59 -5
  76. package/package.json +1 -1
  77. package/scripts/check-skill-sync.mjs +188 -0
  78. package/scripts/package-skill.mjs +17 -3
  79. package/skill-template/business-info.json +23 -0
  80. package/skill-template/domains/data.md +15 -0
  81. package/skills/weaver-e10-archive-oa/SKILL.md +7 -6
  82. package/skills/weaver-e10-archive-oa/references/contract-search.md +83 -14
  83. package/skills/weaver-e10-archive-oa/references/disabled-capabilities.md +1 -1
  84. package/skills/weaver-e10-archive-oa/references/qys-contract-search.md +35 -11
  85. package/skills/weaver-e10-data/SKILL.md +118 -0
  86. package/skills/weaver-e10-data/references/config-center.md +90 -0
  87. package/skills/weaver-e10-data/references/datasource.md +136 -0
  88. package/skills/weaver-e10-data/references/scene-and-misc.md +82 -0
  89. package/skills/weaver-e10-meeting/SKILL.md +39 -7
  90. package/skills/weaver-e10-reception-flow/SKILL.md +30 -16
  91. package/skills/weaver-e10-reception-flow/references/guide.md +4 -3
  92. package/skills/weaver-e10-reception-flow/scripts/render.py +5 -3
  93. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +26 -6
  94. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +53 -11
  95. package/dist/chunks/{ebuilder-form-I5ZIX4WO.js → ebuilder-form-CBYI6CQ6.js} +4 -4
  96. package/dist/chunks/{workflow-WVEFJ6KC.js → workflow-2TRU2ZSP.js} +3 -3
@@ -50,6 +50,11 @@ var CUSTOMER_NEED_OPTIONS = [
50
50
  "\u4EA4\u6D41\u5177\u4F53\u9879\u76EE\u5408\u4F5C\u4E0E\u5B9E\u65BD\u7EC6\u8282",
51
51
  "\u6682\u672A\u786E\u5B9A\uFF0C\u5148\u8FDB\u5F85\u529E"
52
52
  ];
53
+ var MEETING_TITLE = "\u662F\u5426\u5B89\u6392\u4F1A\u8BAE\uFF08\u9700\u9884\u7559\u573A\u5730\uFF09";
54
+ var MEETING_OPTIONS = [
55
+ { label: "\u662F\uFF0C\u5B89\u6392\u4F1A\u8BAE\u5BA4", value: "\u662F" },
56
+ { label: "\u5426\uFF0C\u4E0D\u9700\u8981", value: "\u5426" }
57
+ ];
53
58
  var SNAPSHOT_KIND = "reception-fields-snapshot";
54
59
  var PYTHON_CACHE_TTL_MS = 7 * 24 * 3600 * 1e3;
55
60
 
@@ -589,7 +594,12 @@ function parseLogistics(text) {
589
594
  if (mobile) out.mobile = mobile[0];
590
595
  const segs = raw.replace(/[①②③④⑤⑥⑦⑧⑨]/g, "\n").replace(/[((]\s*\d\s*[))]/g, "\n").replace(/(^|[\s||;;,,。])\d\s*[.))、]/g, "\n").replace(/总部\s*(\d{3})/g, "\u603B\u90E8$1").replace(/(\d)\s*[人名位]/g, "$1\u4EBA").replace(/(\d)\s*间/g, "$1\u95F4").split(/[\n||;;,,。、]+/).map((item) => item.trim()).filter(Boolean);
591
596
  for (const part of segs) {
592
- if (!out.meetingRoom) {
597
+ const noMeeting = /(不需要|不用|无需|不安排|不订|不要|取消|没有)\s*(订|定|预)?\s*(会议|会议室|开会|座谈|汇报)/.test(part);
598
+ if (noMeeting) {
599
+ if (!out.meeting) out.meeting = "\u5426";
600
+ if (!out.meetingRoom) out.meetingRoom = "\u4E0D\u9700\u4F1A\u8BAE\u5BA4";
601
+ }
602
+ if (!out.meetingRoom && !noMeeting) {
593
603
  const room = part.match(/(?:总部\s*)?(?<!\d)(129|130|131)(?!\d)\s*会议室/) || part.match(/总部\s*(?<!\d)(129|130|131)(?!\d)/);
594
604
  if (room) out.meetingRoom = `\u603B\u90E8${room[1]}\u4F1A\u8BAE\u5BA4`;
595
605
  else if (/(不需要|不用|无需|没有)会议室/.test(part)) out.meetingRoom = "\u4E0D\u9700\u4F1A\u8BAE\u5BA4";
@@ -630,6 +640,11 @@ function parseLogistics(text) {
630
640
  out.gift = part;
631
641
  }
632
642
  }
643
+ if (!out.meeting && !noMeeting) {
644
+ if (/(要|需要|安排|预定|预订|订|开|有)\s*(会议|开会|座谈|汇报)|会议|开会|座谈/.test(part)) {
645
+ out.meeting = "\u662F";
646
+ }
647
+ }
633
648
  }
634
649
  return out;
635
650
  }
@@ -646,10 +661,22 @@ function setCompanionMobile(data, mobile) {
646
661
  data.mobile = value;
647
662
  }
648
663
  }
664
+ function normalizeDemand(data) {
665
+ const need = String(data.customerNeed ?? "").trim();
666
+ if (need) data.demand = need;
667
+ delete data.customerNeed;
668
+ }
649
669
  function mergeAnswers(run, answers = {}) {
650
670
  const data = { ...run.data || {} };
671
+ normalizeDemand(data);
651
672
  if (answers && typeof answers === "object") {
652
- if (answers.fields && typeof answers.fields === "object") Object.assign(data, answers.fields);
673
+ if (answers.fields && typeof answers.fields === "object") {
674
+ const { restaurant: rawRestaurant, ...rest } = answers.fields;
675
+ Object.assign(data, rest);
676
+ if (rawRestaurant && typeof rawRestaurant === "object" && !Array.isArray(rawRestaurant)) {
677
+ data.restaurant = { ...data.restaurant || {}, ...rawRestaurant };
678
+ }
679
+ }
653
680
  if (answers.customer_need) data.demand = String(answers.customer_need);
654
681
  if (answers.logistics) {
655
682
  const raw = String(answers.logistics).trim();
@@ -668,7 +695,8 @@ function mergeAnswers(run, answers = {}) {
668
695
  }
669
696
  function buildPanels(data) {
670
697
  const panels = [];
671
- if (!data.demand) {
698
+ const hasDemand = Boolean(String(data.demand || data.customerNeed || "").trim());
699
+ if (!hasDemand) {
672
700
  panels.push({
673
701
  id: "customer_need",
674
702
  // 同样受「标题单行」约束:不写 ①②③ 追问清单,只留一句
@@ -679,22 +707,31 @@ function buildPanels(data) {
679
707
  options: CUSTOMER_NEED_OPTIONS.map((item) => ({ label: item, value: item }))
680
708
  });
681
709
  }
682
- const missing = LOGISTICS_FIELDS.filter((key) => !data[key]);
683
710
  const mobile = ((data.companions || []).find((item) => item && item.mobile) || {}).mobile || "";
684
- if (missing.length || !mobile) {
685
- const known = LOGISTICS_FIELDS.filter((key) => data[key]).map((key) => `${LOGISTICS_LABEL[key]}\uFF1A${data[key]}`);
686
- if (mobile) known.push(`${LOGISTICS_LABEL.mobile}\uFF1A${mobile}`);
687
- panels.push({
688
- id: "logistics",
689
- // 标题严格单行:不拼字段清单、不拼已识别项、不讲规则——拼了必被截断成「…」
690
- title: LOGISTICS_TITLE,
691
- inputType: "text",
692
- required: false,
693
- allowCustomInput: true,
694
- hint: known.length ? `\u5DF2\u8BC6\u522B\uFF1A${known.join("\uFF1B")}
711
+ const known = LOGISTICS_FIELDS.filter((key) => data[key]).map((key) => `${LOGISTICS_LABEL[key]}\uFF1A${data[key]}`);
712
+ if (mobile) known.push(`${LOGISTICS_LABEL.mobile}\uFF1A${mobile}`);
713
+ panels.push({
714
+ id: "logistics",
715
+ // 标题严格单行:不拼字段清单、不拼已识别项、不讲规则——拼了必被截断成「…」
716
+ title: LOGISTICS_TITLE,
717
+ inputType: "text",
718
+ required: false,
719
+ allowCustomInput: true,
720
+ hint: known.length ? `\u5DF2\u8BC6\u522B\uFF1A${known.join("\uFF1B")}
695
721
  \u8865\u6CA1\u5199\u7684\u5C31\u884C\u3002
696
722
  ${LOGISTICS_HINT}` : LOGISTICS_HINT,
697
- placeholder: LOGISTICS_PLACEHOLDER
723
+ placeholder: LOGISTICS_PLACEHOLDER,
724
+ prefilled: known
725
+ });
726
+ const meetingAnswered = data.meeting === "\u662F" || data.meeting === "\u5426";
727
+ if (!meetingAnswered) {
728
+ panels.push({
729
+ id: "meeting",
730
+ title: MEETING_TITLE,
731
+ inputType: "single",
732
+ required: true,
733
+ allowCustomInput: false,
734
+ options: MEETING_OPTIONS.map((item) => ({ label: item.label, value: item.value }))
698
735
  });
699
736
  }
700
737
  return panels;
@@ -947,8 +984,18 @@ async function ask(input, ctx) {
947
984
  delete data.customerId;
948
985
  delete data.meetingRoom;
949
986
  delete data.meetingRoomMeta;
987
+ if (typeof data.logistics === "string" && data.logistics.trim()) {
988
+ const parsed = parseLogistics(data.logistics);
989
+ const mobile = parsed.mobile;
990
+ delete parsed.mobile;
991
+ for (const [key, value] of Object.entries(parsed)) {
992
+ if (!data[key]) data[key] = value;
993
+ }
994
+ if (mobile) setCompanionMobile(data, mobile);
995
+ }
950
996
  delete data.logistics;
951
997
  delete data.customer_need;
998
+ normalizeDemand(data);
952
999
  if (data.meetingExplicit === true) {
953
1000
  const meeting = normalizeMeeting(data.meeting);
954
1001
  if (meeting) data.meeting = meeting;
@@ -985,6 +1032,8 @@ async function ask(input, ctx) {
985
1032
  customer: data.customer || "",
986
1033
  visitDate: data.visitDate || "",
987
1034
  visitType: data.visitType || "",
1035
+ demand: data.demand || "",
1036
+ meeting: data.meeting || "",
988
1037
  companions: data.companions || [],
989
1038
  // 兜底由 render 阶段补:ask 不读会话,这里恒为空
990
1039
  contactFallback: ""
@@ -1007,6 +1056,262 @@ var askOperation = {
1007
1056
  import { readFileSync as readFileSync2 } from "node:fs";
1008
1057
  import { basename as basename2, join as join4 } from "node:path";
1009
1058
 
1059
+ // src/shortcuts/reception/operations/schedule.ts
1060
+ var STANDARD_AGENDA = [
1061
+ { offset: 0, item: "\u516C\u53F8\u53C2\u89C2", activity: "\u53C2\u89C2\u6CDB\u5FAE\u4E0A\u6D77\u603B\u90E8\u5C55\u5385\u4E0E\u529E\u516C\u533A\uFF0C\u4E86\u89E3\u516C\u53F8\u53D1\u5C55\u5386\u7A0B\u4E0E\u4EA7\u54C1\u80FD\u529B" },
1062
+ { offset: 45, item: "\u65B9\u6848\u4ECB\u7ECD", activity: "" },
1063
+ { offset: 120, item: "\u8BA8\u8BBA\u4EA4\u6D41", activity: "\u53CC\u65B9\u56F4\u7ED5\u5173\u6CE8\u70B9\u4EA4\u6D41\u7B54\u7591\uFF0C\u660E\u786E\u540E\u7EED\u63A8\u8FDB\u8282\u594F" }
1064
+ ];
1065
+ var SEVEN = ["date", "time", "item", "place", "person", "activity", "remark"];
1066
+ function hhmmPlus(start, mins) {
1067
+ const base = /^\d{1,2}:\d{2}$/.test(String(start || "")) ? String(start) : "09:30";
1068
+ const [hour, minute] = base.split(":").map(Number);
1069
+ const total = ((hour * 60 + minute + mins) % 1440 + 1440) % 1440;
1070
+ return `${String(Math.floor(total / 60)).padStart(2, "0")}:${String(total % 60).padStart(2, "0")}`;
1071
+ }
1072
+ function pick7(row) {
1073
+ if (!row || typeof row !== "object" || Array.isArray(row)) return null;
1074
+ const source = row;
1075
+ const out = {};
1076
+ for (const key of SEVEN) {
1077
+ const value = source[key];
1078
+ if (value !== null && value !== void 0 && String(value).trim()) out[key] = String(value).trim();
1079
+ }
1080
+ return Object.keys(out).length ? out : null;
1081
+ }
1082
+ function normalizeScheduleRows(data = {}) {
1083
+ const rows = [];
1084
+ const push = (row) => {
1085
+ if (row) rows.push(row);
1086
+ };
1087
+ const companions = Array.isArray(data.companions) ? data.companions : [];
1088
+ const escortNames = nameList(data.escorts);
1089
+ const mainPerson = escortNames[0] || companions.map((item) => typeof item === "string" ? item : item && item.name || "").filter(Boolean)[0] || data.contact || "";
1090
+ if (Array.isArray(data.scheduleRows)) data.scheduleRows.forEach((row) => push(pick7(row)));
1091
+ if (!rows.length && Array.isArray(data.schedule)) {
1092
+ data.schedule.forEach((row) => {
1093
+ if (Array.isArray(row)) {
1094
+ const [time, item, place] = row;
1095
+ push(pick7({ date: data.visitDate || data.arrivalDate || "", time, item, place, person: mainPerson }));
1096
+ } else {
1097
+ push(pick7(row));
1098
+ }
1099
+ });
1100
+ }
1101
+ if (!rows.length && Array.isArray(data.agenda)) {
1102
+ data.agenda.forEach((row) => push(pick7({
1103
+ date: data.visitDate || data.arrivalDate || "",
1104
+ time: row && (row.start || row.time) || "",
1105
+ item: row && row.item,
1106
+ place: row && row.place,
1107
+ person: row && row.person || mainPerson,
1108
+ activity: row && row.activity,
1109
+ remark: row && row.remark
1110
+ })));
1111
+ }
1112
+ if (!rows.length) {
1113
+ const date = data.visitDate || data.arrivalDate || "";
1114
+ const start = /^\d{1,2}:\d{2}$/.test(String(data.agendaStart || "")) ? String(data.agendaStart) : "09:30";
1115
+ const venue = String(data.venue || "\u6CDB\u5FAE\u4E0A\u6D77\u603B\u90E8");
1116
+ const room = normalizeMeeting(data.meeting) === "\u662F" ? normalizeMeetingRoom(data.meetingRoom) || venue : venue;
1117
+ for (const item of STANDARD_AGENDA) {
1118
+ push(pick7({
1119
+ date,
1120
+ time: hhmmPlus(start, item.offset),
1121
+ item: item.item,
1122
+ place: item.item === "\u516C\u53F8\u53C2\u89C2" ? "\u6CDB\u5FAE\u4E0A\u6D77\u603B\u90E8" : room,
1123
+ person: mainPerson,
1124
+ activity: item.item === "\u65B9\u6848\u4ECB\u7ECD" ? data.demand || "\u4EA7\u54C1\u4E0E\u65B9\u6848\u4ECB\u7ECD" : item.activity
1125
+ }));
1126
+ }
1127
+ }
1128
+ for (const row of rows) if (!row.person && mainPerson) row.person = mainPerson;
1129
+ return rows;
1130
+ }
1131
+
1132
+ // src/shortcuts/reception/operations/restaurant.ts
1133
+ var RESTAURANT_DETAIL = {
1134
+ name: "\u5C0F\u9910\u5385\u9884\u5B9A\u660E\u7EC6",
1135
+ subFormId: "1328260727015997527",
1136
+ dataKey: "formtable__xctydmx",
1137
+ fields: {
1138
+ roomNo: "1329411121197875201",
1139
+ headcount: "1328336675122282515",
1140
+ startDate: "1328336675122282518",
1141
+ startTime: "1328337576855699719",
1142
+ endDate: "1328336675122282519",
1143
+ endTime: "1328337576855699720"
1144
+ },
1145
+ defaultDurationMinutes: 90
1146
+ };
1147
+ var TRIGGER = /小餐厅|包厢|包间|小食堂|内部餐厅/;
1148
+ var ROOM_FIELDS = {
1149
+ roomNo: "field_840360795890851870",
1150
+ title: "field_840360795890851873",
1151
+ region: "field_841962208930570241",
1152
+ desc: "field_840360795890851871"
1153
+ };
1154
+ var pickStr2 = (value) => (value === null || value === void 0 ? "" : String(value)).trim();
1155
+ function capacityFromText2(text) {
1156
+ const s = pickStr2(text);
1157
+ const matched = /可容纳\s*(\d{1,3})\s*人/.exec(s) || /[((]\s*(\d{1,3})\s*人/.exec(s) || /(\d{1,3})\s*人/.exec(s);
1158
+ const n = matched ? Number(matched[1]) : 0;
1159
+ return Number.isFinite(n) && n > 0 && n < 500 ? n : 0;
1160
+ }
1161
+ function regionText2(value) {
1162
+ if (Array.isArray(value)) {
1163
+ return value.map((item) => pickStr2(item && typeof item === "object" ? item.name || item.label : item)).filter(Boolean).join("/");
1164
+ }
1165
+ if (value && typeof value === "object") {
1166
+ const node = value;
1167
+ return pickStr2(node.name || node.label || node.text);
1168
+ }
1169
+ return pickStr2(value);
1170
+ }
1171
+ function unwrapRoomRows(input) {
1172
+ if (Array.isArray(input)) return input;
1173
+ if (!input || typeof input !== "object") return [];
1174
+ const node = input;
1175
+ const candidate = node.rooms || node.items || node.list || node.records || node.rows || node.data && (node.data.list || node.data.records || node.data.rows || node.data.items) || (Array.isArray(node.data) ? node.data : null);
1176
+ return Array.isArray(candidate) ? candidate : [];
1177
+ }
1178
+ function normalizeRoomCandidates(input) {
1179
+ const list = unwrapRoomRows(input);
1180
+ const out = [];
1181
+ for (const row of list) {
1182
+ if (!row) continue;
1183
+ const item = typeof row === "string" ? { name: row } : row;
1184
+ const name = pickStr2(
1185
+ item.name || item.roomNo || item.title || item.label || item[ROOM_FIELDS.roomNo] || item[ROOM_FIELDS.title]
1186
+ );
1187
+ if (!name) continue;
1188
+ const desc = pickStr2(item.desc || item.description || item.remark || item[ROOM_FIELDS.desc]);
1189
+ const region = regionText2(item.region || item.area || item.location || item[ROOM_FIELDS.region]);
1190
+ if (region && !/上海/.test(region)) continue;
1191
+ out.push({
1192
+ name,
1193
+ capacity: Number(item.capacity || item.seats || item.maxPeople || item.size || 0) || capacityFromText2(`${desc} ${name}`),
1194
+ where: region,
1195
+ type: pickStr2(item.type || item.kind)
1196
+ });
1197
+ }
1198
+ return out;
1199
+ }
1200
+ function timesIn(text) {
1201
+ const out = [];
1202
+ const re = /(\d{1,2})\s*[::]\s*(\d{2})/g;
1203
+ let matched;
1204
+ const source = String(text || "");
1205
+ while ((matched = re.exec(source)) !== null) {
1206
+ const hour = Number(matched[1]);
1207
+ const minute = Number(matched[2]);
1208
+ if (hour <= 23 && minute <= 59) {
1209
+ out.push(`${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}`);
1210
+ }
1211
+ }
1212
+ return out;
1213
+ }
1214
+ function nextDay(date) {
1215
+ const matched = /^(\d{4})-(\d{2})-(\d{2})$/.exec(String(date || ""));
1216
+ if (!matched) return date || "";
1217
+ const d = new Date(Date.UTC(Number(matched[1]), Number(matched[2]) - 1, Number(matched[3]) + 1));
1218
+ return d.toISOString().slice(0, 10);
1219
+ }
1220
+ var RANK = { private: 0, combo: 1, tea: 2, entertainment: 3 };
1221
+ var KIND_LABEL = {
1222
+ private: "\u5305\u53A2",
1223
+ combo: "\u901A\u5305",
1224
+ tea: "\u8336\u5BA4",
1225
+ entertainment: "\u5A31\u4E50\u573A\u5730"
1226
+ };
1227
+ function kindOf(room) {
1228
+ const explicit = pickStr2(room.type);
1229
+ if (explicit && RANK[explicit] !== void 0) return explicit;
1230
+ const name = pickStr2(room.name);
1231
+ if (/卡拉|KTV|ktv|烧烤|娱乐|棋牌/.test(name)) return "entertainment";
1232
+ if (/茶室|茶座/.test(name)) return "tea";
1233
+ if (/通包|联通/.test(name)) return "combo";
1234
+ return "private";
1235
+ }
1236
+ function pickRestaurantRoom(rooms = [], headcount = 0) {
1237
+ const list = normalizeRoomCandidates(rooms);
1238
+ if (!list.length) return null;
1239
+ const count = Number(headcount) || 0;
1240
+ const rank = (room) => RANK[kindOf(room)] ?? RANK.private;
1241
+ const fitSort = (a, b) => a.capacity - b.capacity || rank(a) - rank(b);
1242
+ const overSort = (a, b) => b.capacity - a.capacity || rank(a) - rank(b);
1243
+ const playable = list.filter((room) => kindOf(room) !== "entertainment");
1244
+ const label = (room) => KIND_LABEL[kindOf(room)] || "\u5305\u53A2";
1245
+ if (count) {
1246
+ for (const group of [playable, list]) {
1247
+ const fit = group.filter((room) => room.capacity && room.capacity >= count).sort(fitSort);
1248
+ if (fit.length) {
1249
+ return { ...fit[0], reason: `${count} \u4EBA\uFF0C${fit[0].capacity} \u4EBA${label(fit[0])}\u53EF\u5BB9\u7EB3` };
1250
+ }
1251
+ }
1252
+ }
1253
+ const pool = playable.filter((room) => room.capacity).length ? playable.filter((room) => room.capacity) : list.filter((room) => room.capacity);
1254
+ if (pool.length) {
1255
+ const top = pool.sort(overSort)[0];
1256
+ return {
1257
+ ...top,
1258
+ reason: count ? `${count} \u4EBA\u8D85\u51FA\u53EF\u7528${label(top)}\u4E0A\u9650\uFF08${top.capacity} \u4EBA\uFF09\uFF0C\u6309\u6700\u5927\u95F4\u9884\u7559` : `\u672A\u7ED9\u4EBA\u6570\uFF0C\u6309\u6700\u5927 ${top.capacity} \u4EBA\u9884\u7559`
1259
+ };
1260
+ }
1261
+ return { ...list[0], reason: "\u68C0\u7D22\u7ED3\u679C\u672A\u6807\u5BB9\u91CF\uFF0C\u53D6\u7B2C\u4E00\u6761" };
1262
+ }
1263
+ function rawCandidateCount(input) {
1264
+ return unwrapRoomRows(input).length;
1265
+ }
1266
+ function normalizeRestaurant(options = {}) {
1267
+ const data = options.data || {};
1268
+ const rawRestaurant = data.restaurant && typeof data.restaurant === "object" && !Array.isArray(data.restaurant) && data.restaurant.booked !== true ? data.restaurant : {};
1269
+ const explicit = {
1270
+ ...rawRestaurant,
1271
+ ...options.explicit && typeof options.explicit === "object" ? options.explicit : {}
1272
+ };
1273
+ const rooms = options.rooms ?? null;
1274
+ const hay = [data.restaurantRaw, data.logisticsRaw, data.meal, explicit.raw, explicit.note].filter(Boolean).join(" ");
1275
+ const mentioned = Boolean(data.restaurant) || data.restaurantIntent === true || Object.keys(explicit).length > 0 || TRIGGER.test(hay);
1276
+ if (!mentioned) return null;
1277
+ const visit = Number(data.headcountMax || data.headcount || 0) || 0;
1278
+ const headcount = Number(explicit.headcount || data.restaurantHeadcount || visit || 10) || 10;
1279
+ const baseDate = pickStr2(explicit.startDate || data.visitDate || "");
1280
+ const noon = /中午|午餐|午宴|午饭/.test(hay);
1281
+ const evening = /晚上|晚宴|晚餐|夜里|今晚/.test(hay);
1282
+ const inText = timesIn(hay);
1283
+ const textTime = pickStr2(inText[0]);
1284
+ const explicitStart = pickStr2(explicit.startTime);
1285
+ const duration = Number(explicit.durationMinutes || RESTAURANT_DETAIL.defaultDurationMinutes) || 90;
1286
+ const startTime = explicitStart || textTime || (noon ? "11:30" : "18:00");
1287
+ const endTime = pickStr2(explicit.endTime) || (explicitStart || textTime ? hhmmPlus(startTime, duration) : noon ? "13:30" : "21:00");
1288
+ const mealPeriod = noon ? "\u4E2D\u5348" : evening ? "\u665A\u4E0A" : "\u665A\u4E0A";
1289
+ let endDate = pickStr2(explicit.endDate) || baseDate;
1290
+ if (!pickStr2(explicit.endDate) && endTime <= startTime && endDate) endDate = nextDay(endDate);
1291
+ const explicitRoom = pickStr2(explicit.roomNo || explicit.room || explicit.roomName);
1292
+ const candidates = normalizeRoomCandidates(rooms || []);
1293
+ const prev = data.restaurant && typeof data.restaurant === "object" ? data.restaurant : null;
1294
+ const picked = explicitRoom ? { name: explicitRoom, capacity: 0, reason: "\u6309\u6307\u5B9A\u5305\u53A2" } : pickRestaurantRoom(candidates, headcount) || (prev && prev.roomNo ? { name: prev.roomNo, capacity: prev.roomCapacity || 0, reason: prev.roomReason || "\u6CBF\u7528\u4E0A\u4E00\u8F6E\u7ED3\u679C" } : null);
1295
+ const rawCount = rawCandidateCount(rooms);
1296
+ const roomState = picked ? picked.capacity && headcount > picked.capacity ? "overflow" : "ok" : rawCount ? "candidates-unparsed" : "no-candidates";
1297
+ return {
1298
+ booked: true,
1299
+ roomNo: picked ? picked.name : "",
1300
+ roomState,
1301
+ roomCapacity: picked && picked.capacity ? picked.capacity : 0,
1302
+ roomReason: picked ? picked.reason : rawCount ? `\u7ED9\u4E86 ${rawCount} \u6761\u5019\u9009\u4F46\u8BA4\u4E0D\u51FA\u5305\u53A2\u540D/\u5BB9\u91CF\uFF08\u68C0\u67E5\u5B57\u6BB5\u6620\u5C04\uFF09` : "\u7F3A\u5305\u53A2\u53F7\uFF1A\u6CA1\u62FF\u5230\u53EF\u7528\u5305\u53A2\u6E05\u5355",
1303
+ headcount,
1304
+ startDate: baseDate,
1305
+ startTime,
1306
+ endDate,
1307
+ endTime,
1308
+ mealPeriod,
1309
+ // 候选清单只留名字与容量,用于「订不上时把可选项告诉用户」
1310
+ candidates: (candidates.length ? candidates : prev && Array.isArray(prev.candidates) ? prev.candidates : []).slice(0, 20).map((room) => ({ name: room.name, capacity: room.capacity })),
1311
+ raw: pickStr2(hay).slice(0, 200)
1312
+ };
1313
+ }
1314
+
1010
1315
  // src/shortcuts/reception/operations/render-assets.ts
1011
1316
  import { spawnSync, execFile } from "node:child_process";
1012
1317
  import { existsSync } from "node:fs";
@@ -1221,6 +1526,28 @@ function applyCases(data, casesFile) {
1221
1526
  if (expertsQuery) data.expertsQuery = String(expertsQuery);
1222
1527
  }
1223
1528
  }
1529
+ function readRoomsFile(path) {
1530
+ let raw;
1531
+ try {
1532
+ raw = readFileSync2(path, "utf8");
1533
+ } catch (error) {
1534
+ throw receptionValidationError("RESTAURANT_ROOMS_UNREADABLE", `\u8BFB\u4E0D\u5230 --restaurant-rooms-file\uFF1A${path}`, {
1535
+ path,
1536
+ detail: error.message,
1537
+ hint: "\u4F20\u300C\u5C0F\u98DF\u5802\u5305\u53A2\u300Dds list \u7684\u539F\u59CB\u8F93\u51FA\uFF0C\u6216 [{name,capacity}] \u6570\u7EC4"
1538
+ });
1539
+ }
1540
+ const parsed = parseJsonText(raw);
1541
+ if (!parsed.ok) {
1542
+ throw receptionValidationError("RESTAURANT_ROOMS_INVALID", `--restaurant-rooms-file \u4E0D\u662F\u5408\u6CD5 JSON\uFF1A${parsed.error}`, {
1543
+ path,
1544
+ preview: parsed.preview,
1545
+ hasBom: parsed.hasBom,
1546
+ hint: "\u5E38\u89C1\u539F\u56E0\uFF1AUTF-8 BOM\u3001\u4E2D\u6587\u5F15\u53F7\u3001\u5C3E\u968F\u9017\u53F7\uFF1B\u4FEE JSON \u672C\u8EAB\uFF0C\u4E0D\u8981\u6362\u4F20\u53C2\u65B9\u5F0F"
1547
+ });
1548
+ }
1549
+ return parsed.value;
1550
+ }
1224
1551
  async function doc(input, ctx) {
1225
1552
  const startedAt = Date.now();
1226
1553
  const runIdArg = String(input.runId || "").trim();
@@ -1260,6 +1587,23 @@ async function doc(input, ctx) {
1260
1587
  const answers = input.answers ?? run.answers ?? {};
1261
1588
  const data = mergeAnswers(run, answers);
1262
1589
  if (input.casesFile) applyCases(data, input.casesFile);
1590
+ applyMeetingPolicy(data);
1591
+ const booking = normalizeRestaurant({
1592
+ data,
1593
+ rooms: input.restaurantRoomsFile ? readRoomsFile(input.restaurantRoomsFile) : null
1594
+ });
1595
+ if (booking) data.restaurant = booking;
1596
+ const todo = Array.isArray(data.todo) ? [...data.todo] : [];
1597
+ const addTodo = (item) => {
1598
+ if (item && !todo.includes(item)) todo.push(item);
1599
+ };
1600
+ if (!normalizeMeeting(data.meeting)) {
1601
+ addTodo("\u662F\u5426\u9700\u8981\u4F1A\u8BAE\u672A\u8868\u6001\uFF1A\u4F1A\u8BAE\u5BA4\u672A\u9884\u7559\uFF0C\u8BF7\u884C\u653F\u786E\u8BA4\u540E\u56DE\u586B");
1602
+ }
1603
+ if (booking && booking.booked && !String(booking.roomNo || "").trim()) {
1604
+ addTodo(`\u5C0F\u9910\u5385\u5305\u53A2\u5F85\u786E\u8BA4\uFF1A${booking.roomReason || "\u672A\u53D6\u5230\u53EF\u7528\u5305\u53A2"}`);
1605
+ }
1606
+ if (todo.length) data.todo = todo;
1263
1607
  const outDir = input.outDir || run.outDir || ctx.outDir;
1264
1608
  ensureDir(outDir);
1265
1609
  const warnings = [];
@@ -1497,79 +1841,6 @@ function buildCustomParams(items = []) {
1497
1841
  return { values, keys: ordered };
1498
1842
  }
1499
1843
 
1500
- // src/shortcuts/reception/operations/schedule.ts
1501
- var STANDARD_AGENDA = [
1502
- { offset: 0, item: "\u516C\u53F8\u53C2\u89C2", activity: "\u53C2\u89C2\u6CDB\u5FAE\u4E0A\u6D77\u603B\u90E8\u5C55\u5385\u4E0E\u529E\u516C\u533A\uFF0C\u4E86\u89E3\u516C\u53F8\u53D1\u5C55\u5386\u7A0B\u4E0E\u4EA7\u54C1\u80FD\u529B" },
1503
- { offset: 45, item: "\u65B9\u6848\u4ECB\u7ECD", activity: "" },
1504
- { offset: 120, item: "\u8BA8\u8BBA\u4EA4\u6D41", activity: "\u53CC\u65B9\u56F4\u7ED5\u5173\u6CE8\u70B9\u4EA4\u6D41\u7B54\u7591\uFF0C\u660E\u786E\u540E\u7EED\u63A8\u8FDB\u8282\u594F" }
1505
- ];
1506
- var SEVEN = ["date", "time", "item", "place", "person", "activity", "remark"];
1507
- function hhmmPlus(start, mins) {
1508
- const base = /^\d{1,2}:\d{2}$/.test(String(start || "")) ? String(start) : "09:30";
1509
- const [hour, minute] = base.split(":").map(Number);
1510
- const total = ((hour * 60 + minute + mins) % 1440 + 1440) % 1440;
1511
- return `${String(Math.floor(total / 60)).padStart(2, "0")}:${String(total % 60).padStart(2, "0")}`;
1512
- }
1513
- function pick7(row) {
1514
- if (!row || typeof row !== "object" || Array.isArray(row)) return null;
1515
- const source = row;
1516
- const out = {};
1517
- for (const key of SEVEN) {
1518
- const value = source[key];
1519
- if (value !== null && value !== void 0 && String(value).trim()) out[key] = String(value).trim();
1520
- }
1521
- return Object.keys(out).length ? out : null;
1522
- }
1523
- function normalizeScheduleRows(data = {}) {
1524
- const rows = [];
1525
- const push = (row) => {
1526
- if (row) rows.push(row);
1527
- };
1528
- const companions = Array.isArray(data.companions) ? data.companions : [];
1529
- const escortNames = nameList(data.escorts);
1530
- const mainPerson = escortNames[0] || companions.map((item) => typeof item === "string" ? item : item && item.name || "").filter(Boolean)[0] || data.contact || "";
1531
- if (Array.isArray(data.scheduleRows)) data.scheduleRows.forEach((row) => push(pick7(row)));
1532
- if (!rows.length && Array.isArray(data.schedule)) {
1533
- data.schedule.forEach((row) => {
1534
- if (Array.isArray(row)) {
1535
- const [time, item, place] = row;
1536
- push(pick7({ date: data.visitDate || data.arrivalDate || "", time, item, place, person: mainPerson }));
1537
- } else {
1538
- push(pick7(row));
1539
- }
1540
- });
1541
- }
1542
- if (!rows.length && Array.isArray(data.agenda)) {
1543
- data.agenda.forEach((row) => push(pick7({
1544
- date: data.visitDate || data.arrivalDate || "",
1545
- time: row && (row.start || row.time) || "",
1546
- item: row && row.item,
1547
- place: row && row.place,
1548
- person: row && row.person || mainPerson,
1549
- activity: row && row.activity,
1550
- remark: row && row.remark
1551
- })));
1552
- }
1553
- if (!rows.length) {
1554
- const date = data.visitDate || data.arrivalDate || "";
1555
- const start = /^\d{1,2}:\d{2}$/.test(String(data.agendaStart || "")) ? String(data.agendaStart) : "09:30";
1556
- const venue = String(data.venue || "\u6CDB\u5FAE\u4E0A\u6D77\u603B\u90E8");
1557
- const room = normalizeMeeting(data.meeting) === "\u662F" ? normalizeMeetingRoom(data.meetingRoom) || venue : venue;
1558
- for (const item of STANDARD_AGENDA) {
1559
- push(pick7({
1560
- date,
1561
- time: hhmmPlus(start, item.offset),
1562
- item: item.item,
1563
- place: item.item === "\u516C\u53F8\u53C2\u89C2" ? "\u6CDB\u5FAE\u4E0A\u6D77\u603B\u90E8" : room,
1564
- person: mainPerson,
1565
- activity: item.item === "\u65B9\u6848\u4ECB\u7ECD" ? data.demand || "\u4EA7\u54C1\u4E0E\u65B9\u6848\u4ECB\u7ECD" : item.activity
1566
- }));
1567
- }
1568
- }
1569
- for (const row of rows) if (!row.person && mainPerson) row.person = mainPerson;
1570
- return rows;
1571
- }
1572
-
1573
1844
  // src/shortcuts/reception/operations/compose.ts
1574
1845
  var pick = (map, key) => key && map && map[String(key)] !== void 0 ? String(map[String(key)]) : "";
1575
1846
  function normAttachmentIds(list, single = "") {
@@ -1735,6 +2006,9 @@ function composeInitialValues(options) {
1735
2006
  putRest(restaurant.fields.endDate, data.restaurant.endDate || "");
1736
2007
  putRest(restaurant.fields.endTime, data.restaurant.endTime || "");
1737
2008
  }
2009
+ } else if (data.restaurant) {
2010
+ warnings.push("\u5C0F\u9910\u5385\u660E\u7EC6\u672A\u5199\u5165\uFF1A\u5165\u53C2\u672A\u5F52\u4E00\uFF08\u7F3A\u5C11 booked\uFF09\uFF0C\u8BF7\u786E\u8BA4\u5305\u53A2\u4E0E\u7528\u9910\u65F6\u95F4\u540E\u624B\u5DE5\u8865\u586B");
2011
+ todos.push("\u5C0F\u9910\u5385\u9884\u5B9A\u660E\u7EC6\u5F85\u8865\u586B\uFF08\u5305\u53A2\u3001\u4EBA\u6570\u3001\u65F6\u95F4\uFF09");
1738
2012
  }
1739
2013
  const built = buildCustomParams(items);
1740
2014
  params.values = built.values;
@@ -1742,6 +2016,9 @@ function composeInitialValues(options) {
1742
2016
  if (attachmentPending) todos.push("\u884C\u7A0B\u5355\u9644\u4EF6\u672A\u4E0A\u4F20\uFF08\u53EF\u5728\u9875\u9762\u624B\u52A8\u6DFB\u52A0\uFF09");
1743
2017
  if (!data.companions || !data.companions.length) todos.push("\u966A\u540C\u4EBA\u5458\u672A\u586B");
1744
2018
  if (!data.demand) todos.push("\u5BA2\u6237\u9700\u6C42\u672A\u586B");
2019
+ if (!normalizeMeeting(data.meeting)) {
2020
+ todos.push("\u662F\u5426\u9700\u8981\u4F1A\u8BAE\u672A\u8868\u6001\uFF1A\u4F1A\u8BAE\u5BA4\u672A\u9884\u7559\uFF0C\u63D0\u4EA4\u524D\u8BF7\u884C\u653F\u786E\u8BA4");
2021
+ }
1745
2022
  return {
1746
2023
  values: params.values,
1747
2024
  keys: params.keys,
@@ -1787,6 +2064,16 @@ async function render(input, ctx) {
1787
2064
  );
1788
2065
  }
1789
2066
  applyMeetingPolicy(data);
2067
+ if (!normalizeMeeting(data.meeting)) {
2068
+ throw receptionBusinessError(
2069
+ "MEETING_UNCONFIRMED",
2070
+ "\u662F\u5426\u9700\u8981\u4F1A\u8BAE\u672A\u786E\u8BA4\uFF0C\u8BF7\u5148\u8865\u95EE\u518D\u51FA\u586B\u5355\u9875",
2071
+ {
2072
+ headcount: data.headcount || "",
2073
+ hint: '\u5148\u5411\u7528\u6237\u786E\u8BA4\u300C\u662F\u5426\u9700\u8981\u4F1A\u8BAE\u5BA4\u5EA7\u8C08\u300D\uFF0C\u62FF\u5230\u7B54\u6848\u540E\u653E\u8FDB answers.fields.meeting\uFF08"\u662F"/"\u5426"\uFF09\u91CD\u8DD1\u672C\u6761\uFF1B\u63D0\u4E86\u5C0F\u9910\u5385\u4E0D\u4EE3\u8868\u8981\u5F00\u4F1A\uFF0C\u4E0D\u5F97\u636E\u6B64\u63A8\u65AD'
2074
+ }
2075
+ );
2076
+ }
1790
2077
  if (normalizeMeeting(data.meeting) === "\u662F") {
1791
2078
  if (!Number(data.headcount)) {
1792
2079
  data.todos = [...Array.isArray(data.todos) ? data.todos : [], "\u4EBA\u6570\u672A\u586B\uFF0C\u4F1A\u8BAE\u5BA4\u6309\u9ED8\u8BA4\u9884\u7559"];
@@ -1804,6 +2091,31 @@ async function render(input, ctx) {
1804
2091
  data.empId = session.userId || "";
1805
2092
  if (!data.empId) composedWarnings.push("\u4E3B\u8054\u7EDC\u4EBA\u672A\u53D6\u5230\u767B\u5F55\u4EBA\uFF0C\u8BF7\u5728\u9875\u9762\u4E0A\u624B\u52A8\u9009\u62E9");
1806
2093
  }
2094
+ const defaultsApplied = [];
2095
+ const headcountKnown = Number(data.headcount) > 0;
2096
+ if (normalizeMeeting(data.meeting) === "\u662F" && !headcountKnown) {
2097
+ defaultsApplied.push({
2098
+ field: "meetingRoom",
2099
+ value: String(data.meetingRoom || ""),
2100
+ reason: String(data.meetingRoomMeta && data.meetingRoomMeta.reason || "\u4EBA\u6570\u672A\u586B\uFF0C\u4F1A\u8BAE\u5BA4\u6309\u9ED8\u8BA4\u9884\u7559")
2101
+ });
2102
+ }
2103
+ if (data.restaurant && data.restaurant.booked) {
2104
+ if (!headcountKnown) {
2105
+ defaultsApplied.push({
2106
+ field: "customerCount",
2107
+ value: String(data.restaurant.headcount || ""),
2108
+ reason: "\u4EBA\u6570\u672A\u586B\uFF0C\u5C0F\u9910\u5385\u6309 10 \u4EBA\u9884\u7559"
2109
+ });
2110
+ }
2111
+ if (data.restaurant.roomNo && !/按指定包厢/.test(String(data.restaurant.roomReason || ""))) {
2112
+ defaultsApplied.push({
2113
+ field: "restaurantRoom",
2114
+ value: String(data.restaurant.roomNo),
2115
+ reason: String(data.restaurant.roomReason || "\u6309\u5BB9\u91CF\u5339\u914D")
2116
+ });
2117
+ }
2118
+ }
1807
2119
  const composed = composeInitialValues({
1808
2120
  snapshot: resolved.snapshot,
1809
2121
  data,
@@ -1863,6 +2175,7 @@ async function render(input, ctx) {
1863
2175
  attachmentPending: composed.attachmentPending,
1864
2176
  sdkRenderType: resolveRenderType(input.sdkRender),
1865
2177
  todos: composed.todos,
2178
+ defaultsApplied,
1866
2179
  browsertool,
1867
2180
  browsertoolFile,
1868
2181
  browsertoolRef: browsertoolFile ? `<browsertool-file path="${browsertoolFile}" />` : "",
@@ -1884,7 +2197,27 @@ async function docRender(input, ctx) {
1884
2197
  const docResult = await doc(input, ctx);
1885
2198
  if (!docResult.ok) return docResult;
1886
2199
  const runId = String((docResult.data || {}).runId || input.runId || "");
1887
- const renderResult = await render({ runId, sdkRender: input.sdkRender }, ctx);
2200
+ let renderResult;
2201
+ try {
2202
+ renderResult = await render({
2203
+ runId,
2204
+ sdkRender: input.sdkRender,
2205
+ // answers 与 allowMissingRestaurant 必须透传:
2206
+ // render 虽然会回落到 run.answers,但「同一 run 二次调用带新 answers」只能靠这里;
2207
+ // 漏传 allowMissingRestaurant 会让 doc-render 上的放行开关整个失效。
2208
+ answers: input.answers,
2209
+ allowMissingRestaurant: input.allowMissingRestaurant === true
2210
+ }, ctx);
2211
+ } catch (error) {
2212
+ const err = error;
2213
+ const files = (docResult.data || {}).files;
2214
+ if (err && err.details && typeof err.details === "object" && Array.isArray(files) && files.length) {
2215
+ err.details.files = files;
2216
+ err.details.runId = runId;
2217
+ err.details.note = "\u884C\u7A0B\u5355\u4E0E\u53C2\u8003\u6587\u6863\u5DF2\u751F\u6210\uFF0C\u8865\u9F50\u540E\u91CD\u8DD1 doc-render --run-id \u5373\u53EF\uFF0C\u4E0D\u5FC5\u91CD\u51FA\u4EF6";
2218
+ }
2219
+ throw error;
2220
+ }
1888
2221
  return {
1889
2222
  state: renderResult.state,
1890
2223
  ok: renderResult.ok,
@@ -1962,7 +2295,7 @@ var receptionOperations = [
1962
2295
  {
1963
2296
  name: "reception.ask",
1964
2297
  risk: "read",
1965
- summary: "\u6309 7 \u9879\u62BD\u53D6\u7ED3\u679C\u51FA\u4EA4\u4E92\u9762\u677F\uFF1A\u7F3A\u9879\u624D\u51FA\u5C4F\uFF0C\u603B\u5C4F\u6570 \u22642\uFF08\u5BA2\u6237\u9700\u6C42 + \u63A5\u5F85\u7EC6\u8282\uFF09\u3002\u8FD4\u56DE runId \u4F9B doc \u4F7F\u7528\u3002",
2298
+ summary: "\u6309 7 \u9879\u62BD\u53D6\u7ED3\u679C\u51FA\u4EA4\u4E92\u9762\u677F\uFF1A\u5BA2\u6237\u9700\u6C42\uFF08\u5DF2\u660E\u786E\u5219\u8DF3\u8FC7\uFF09+ \u63A5\u5F85\u7EC6\u8282\uFF08\u5E38\u9A7B\uFF09+ \u662F\u5426\u4F1A\u8BAE\uFF08\u5FC5\u95EE\uFF0C\u539F\u8BDD\u660E\u786E\u63D0\u53CA\u4F1A\u8BAE\u5BA4\u624D\u8DF3\u8FC7\uFF09\u3002\u8FD4\u56DE runId \u4F9B doc \u4F7F\u7528\u3002",
1966
2299
  inputSchema: {
1967
2300
  type: "object",
1968
2301
  additionalProperties: false,
@@ -1985,7 +2318,7 @@ var receptionOperations = [
1985
2318
  demand: { type: "string", description: "\u5BA2\u6237\u9700\u6C42\uFF08\u65E7\u5B57\u6BB5\u540D\uFF0CcustomerNeed \u4F18\u5148\uFF09" },
1986
2319
  customerNeed: { type: "string", description: "\u5BA2\u6237\u9700\u6C42\u539F\u6587\uFF1B\u5DF2\u7ED9\u5219\u4E0D\u518D\u51FA\u300C\u5BA2\u6237\u9700\u6C42\u300D\u9762\u677F\uFF0C\u5E76\u5199\u5165\u8868\u5355\u5BA2\u6237\u9700\u6C42\u5B57\u6BB5" },
1987
2320
  meeting: { type: "string", enum: ["\u662F", "\u5426"], description: "\u662F\u5426\u9700\u8981\u4F1A\u8BAE\u5BA4\u5EA7\u8C08\uFF1B\u5FC5\u987B\u4E0E meetingExplicit \u4E00\u8D77\u4F20\u624D\u751F\u6548" },
1988
- meetingExplicit: { type: "boolean", description: "\u4F1A\u8BAE\u8868\u6001\u662F\u5426\u6765\u81EA\u539F\u8BDD\u660E\u786E\u8868\u8FF0\uFF1Bfalse/\u7F3A\u7701\u89C6\u4E3A\u672A\u8868\u6001\uFF0C\u7B2C\u4E09\u5C4F\u7167\u95EE" },
2321
+ meetingExplicit: { type: "boolean", description: "\u539F\u8BDD\u662F\u5426\u660E\u786E\u63D0\u53CA\u9884\u5B9A\u4F1A\u8BAE\u5BA4\uFF08\u4F1A\u8BAE\u5BA4/\u8BA2\u4F1A\u8BAE\u5BA4/\u5EA7\u8C08\u573A\u5730/\u6C47\u62A5\u573A\u5730\uFF0C\u6216\u6307\u5B9A 129/130/131\uFF09\u3002\u53EA\u6709 true \u624D\u8DF3\u8FC7\u4F1A\u8BAE\u5C4F\uFF1B\u300C\u665A\u4E0A\u8BA2\u5C0F\u9910\u5385\u300D\u4E0D\u7B97\uFF0C\u4E0D\u5F97\u636E\u6B64\u63A8\u65AD" },
1989
2322
  restaurantIntent: { type: "boolean", description: "\u539F\u8BDD\u662F\u5426\u63D0\u5230\u5C0F\u9910\u5385/\u5305\u53A2\uFF1Btrue \u5219\u5FC5\u987B\u5E26 --restaurant-rooms-file" },
1990
2323
  logistics: { type: "string", description: "\u63A5\u5F85\u7EC6\u8282\u539F\u6587\uFF1A\u4EBA\u6570/\u63A5\u9001/\u7528\u9910/\u4F4F\u5BBF/\u4F34\u624B\u793C/\u624B\u673A" }
1991
2324
  }
@@ -2103,6 +2436,7 @@ var receptionOperations = [
2103
2436
  outDir: { type: "string", description: "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55" },
2104
2437
  noUpload: { type: "boolean", description: "\u8DF3\u8FC7\u9644\u4EF6\u4E0A\u4F20\uFF0C\u53EA\u51FA\u672C\u5730\u6587\u4EF6" },
2105
2438
  snapshot: { type: "string", description: "\u5B57\u6BB5\u5FEB\u7167\u8DEF\u5F84\uFF1B\u540C\u65F6\u7528\u4E8E\u63A8\u5BFC\u6280\u80FD\u5305\u5185 render.py \u4F4D\u7F6E" },
2439
+ allowMissingRestaurant: { type: "boolean", description: "\u63D0\u4E86\u5C0F\u9910\u5385\u4F46\u786E\u5B9E\u62FF\u4E0D\u5230\u5305\u53A2\u53F7\u65F6\u653E\u884C\uFF08\u660E\u7EC6\u7559\u7A7A\u8FDB\u5F85\u529E\uFF09\uFF0C\u9ED8\u8BA4 false \u76F4\u63A5\u62A5 RESTAURANT_DETAIL_MISSING" },
2106
2440
  renderPy: { type: "string", description: "\u663E\u5F0F\u6307\u5B9A render.py \u8DEF\u5F84" },
2107
2441
  sdkRender: {
2108
2442
  type: "string",
@@ -2282,7 +2616,7 @@ var receptionShortcut = {
2282
2616
  }
2283
2617
  await runOperation(ctx, String(operation), input, opts);
2284
2618
  }));
2285
- reception.command("ask").description("\u51FA\u4EA4\u4E92\u9762\u677F\uFF08\u7F3A\u9879\u624D\u51FA\u5C4F\uFF0C\u603B\u5C4F\u6570 \u22642\uFF09").option("--known <json>", "7 \u9879\u62BD\u53D6\u7ED3\u679C\uFF08\u5185\u8054 JSON\uFF09").option("--known-file <path>", "7 \u9879\u62BD\u53D6\u7ED3\u679C\uFF08JSON \u6587\u4EF6\uFF0C\u63A8\u8350\uFF09").option("--user <names>", "\u966A\u540C\u4EBA\u5458\u59D3\u540D\uFF0C\u591A\u4EBA\u9017\u53F7\u5206\u9694\uFF1B\u4E0D\u4F20\u7528\u5F53\u524D\u767B\u5F55\u4EBA\u515C\u5E95").option("--customer <name>", "\u5BA2\u6237\u540D\u79F0\uFF0C\u8986\u76D6 known.customer").option("--workflow <name>", `\u76EE\u6807\u6D41\u7A0B\u540D\uFF0C\u9ED8\u8BA4\u300C${DEFAULT_WORKFLOW}\u300D`).option("--out-dir <dir>", "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55").action(action(async (ctx, options) => {
2619
+ reception.command("ask").description("\u51FA\u4EA4\u4E92\u9762\u677F\uFF08\u7F3A\u9879\u624D\u51FA\u5C4F\uFF0C\u6700\u591A 3 \u5C4F\uFF1A\u5BA2\u6237\u9700\u6C42 / \u63A5\u5F85\u7EC6\u8282 / \u662F\u5426\u4F1A\u8BAE\uFF09").option("--known <json>", "7 \u9879\u62BD\u53D6\u7ED3\u679C\uFF08\u5185\u8054 JSON\uFF09").option("--known-file <path>", "7 \u9879\u62BD\u53D6\u7ED3\u679C\uFF08JSON \u6587\u4EF6\uFF0C\u63A8\u8350\uFF09").option("--user <names>", "\u966A\u540C\u4EBA\u5458\u59D3\u540D\uFF0C\u591A\u4EBA\u9017\u53F7\u5206\u9694\uFF1B\u4E0D\u4F20\u7528\u5F53\u524D\u767B\u5F55\u4EBA\u515C\u5E95").option("--customer <name>", "\u5BA2\u6237\u540D\u79F0\uFF0C\u8986\u76D6 known.customer").option("--workflow <name>", `\u76EE\u6807\u6D41\u7A0B\u540D\uFF0C\u9ED8\u8BA4\u300C${DEFAULT_WORKFLOW}\u300D`).option("--out-dir <dir>", "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55").action(action(async (ctx, options) => {
2286
2620
  const opts = asOptions(options);
2287
2621
  const known = jsonArg(opts, "known", {
2288
2622
  code: "KNOWN",
@@ -2330,7 +2664,7 @@ var receptionShortcut = {
2330
2664
  timeoutMs: textOf(opts, "timeoutMs") ? Number(textOf(opts, "timeoutMs")) : void 0
2331
2665
  }, opts);
2332
2666
  }));
2333
- reception.command("doc-render").description("\u4E00\u6B21\u5B8C\u6210\u300C\u51FA\u4EF6 + \u4F20\u9644\u4EF6 + \u62FC\u586B\u5355\u53C2\u6570\u300D\uFF08doc \u4E0E render \u5408\u5E76\uFF0C\u7701\u4E00\u6B21\u5DE5\u5177\u5F80\u8FD4\uFF09").option("--run-id <id>", "ask \u8FD4\u56DE\u7684 runId").option("--known <json>", "run \u5931\u6548\u65F6\u7528\u4E8E\u73B0\u573A\u91CD\u5EFA\u7684 7 \u9879\u62BD\u53D6\u7ED3\u679C").option("--known-file <path>", "\u540C\u4E0A\uFF0CJSON \u6587\u4EF6").option("--answers <json>", "\u9762\u677F\u56DE\u586B\u503C\uFF08\u5185\u8054 JSON\uFF09").option("--answers-file <path>", "\u9762\u677F\u56DE\u586B\u503C\uFF08JSON \u6587\u4EF6\uFF0C\u63A8\u8350\uFF09").option("--cases-file <path>", "\u6848\u4F8B + \u4E13\u5BB6\u68C0\u7D22\u7ED3\u679C JSON").option("--restaurant-rooms-file <path>", "\u5C0F\u98DF\u5802\u5305\u53A2\u5019\u9009\uFF08e10-data ds list \u539F\u59CB\u8F93\u51FA\u6216 [{name,capacity}]\uFF09").option("--workflow <name>", "\u76EE\u6807\u6D41\u7A0B\u540D").option("--out-dir <dir>", "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55").option("--snapshot <path>", "\u5B57\u6BB5\u5FEB\u7167\u8DEF\u5F84\uFF08\u540C\u65F6\u7528\u4E8E\u63A8\u5BFC render.py\uFF09").option("--render-py <path>", "\u663E\u5F0F\u6307\u5B9A render.py").option("--no-upload", "\u8DF3\u8FC7\u9644\u4EF6\u4E0A\u4F20\uFF0C\u53EA\u51FA\u672C\u5730\u6587\u4EF6").option("--sdk-render <type>", "\u6253\u5F00\u5F62\u6001\uFF1Ainline / popup / drawer\uFF08\u9ED8\u8BA4 drawer\uFF09").action(action(async (ctx, options) => {
2667
+ reception.command("doc-render").description("\u4E00\u6B21\u5B8C\u6210\u300C\u51FA\u4EF6 + \u4F20\u9644\u4EF6 + \u62FC\u586B\u5355\u53C2\u6570\u300D\uFF08doc \u4E0E render \u5408\u5E76\uFF0C\u7701\u4E00\u6B21\u5DE5\u5177\u5F80\u8FD4\uFF09").option("--run-id <id>", "ask \u8FD4\u56DE\u7684 runId").option("--known <json>", "run \u5931\u6548\u65F6\u7528\u4E8E\u73B0\u573A\u91CD\u5EFA\u7684 7 \u9879\u62BD\u53D6\u7ED3\u679C").option("--known-file <path>", "\u540C\u4E0A\uFF0CJSON \u6587\u4EF6").option("--answers <json>", "\u9762\u677F\u56DE\u586B\u503C\uFF08\u5185\u8054 JSON\uFF09").option("--answers-file <path>", "\u9762\u677F\u56DE\u586B\u503C\uFF08JSON \u6587\u4EF6\uFF0C\u63A8\u8350\uFF09").option("--cases-file <path>", "\u6848\u4F8B + \u4E13\u5BB6\u68C0\u7D22\u7ED3\u679C JSON").option("--restaurant-rooms-file <path>", "\u5C0F\u98DF\u5802\u5305\u53A2\u5019\u9009\uFF08e10-data ds list \u539F\u59CB\u8F93\u51FA\u6216 [{name,capacity}]\uFF09").option("--workflow <name>", "\u76EE\u6807\u6D41\u7A0B\u540D").option("--out-dir <dir>", "\u4EA7\u7269\u8F93\u51FA\u76EE\u5F55").option("--snapshot <path>", "\u5B57\u6BB5\u5FEB\u7167\u8DEF\u5F84\uFF08\u540C\u65F6\u7528\u4E8E\u63A8\u5BFC render.py\uFF09").option("--render-py <path>", "\u663E\u5F0F\u6307\u5B9A render.py").option("--no-upload", "\u8DF3\u8FC7\u9644\u4EF6\u4E0A\u4F20\uFF0C\u53EA\u51FA\u672C\u5730\u6587\u4EF6").option("--allow-missing-restaurant", "\u63D0\u4E86\u5C0F\u9910\u5385\u4F46\u6CA1\u5305\u53A2\u53F7\u65F6\u4ECD\u653E\u884C\uFF08\u660E\u7EC6\u7559\u7A7A\u8FDB\u5F85\u529E\uFF09").option("--sdk-render <type>", "\u6253\u5F00\u5F62\u6001\uFF1Ainline / popup / drawer\uFF08\u9ED8\u8BA4 drawer\uFF09").action(action(async (ctx, options) => {
2334
2668
  const opts = asOptions(options);
2335
2669
  await runOperation(ctx, "reception.docRender", {
2336
2670
  runId: textOf(opts, "runId") || void 0,
@@ -2343,6 +2677,7 @@ var receptionShortcut = {
2343
2677
  snapshot: textOf(opts, "snapshot") || void 0,
2344
2678
  renderPy: textOf(opts, "renderPy") || void 0,
2345
2679
  noUpload: opts.upload === false,
2680
+ allowMissingRestaurant: opts.allowMissingRestaurant === true,
2346
2681
  sdkRender: textOf(opts, "sdkRender") || void 0
2347
2682
  }, opts);
2348
2683
  }));