From 3a2ad568eab3599d6da623f737f5dd956e5b9661 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 3 Dec 2026 02:13:00 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=B6=E5=BA=A6=E9=97=AE=E8=AF=A2=EF=BC=9A?= =?UTF-8?q?=E5=8D=95=E4=BD=8D=E4=B8=8D=E6=98=8E=E4=B8=94=E5=90=84=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E8=A7=84=E5=AE=9A=E4=B8=8D=E5=90=8C=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E7=94=A8=20ask=5Fwhich=20=E6=8C=89=E9=92=AE=E9=97=AE=E6=8F=90?= =?UTF-8?q?=E9=97=AE=E4=BA=BA=E5=9C=A8=E5=93=AA=E5=AE=B6=E5=85=AC=E5=8F=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 技能 tools 加上平台的 ask_which(cloud#4773,ask 智能体每轮都带)。它带着问题和 2–3 个选项结束这一轮,控制台画成可点的问题卡片(plugin-chatbot QuestionCard, 19.0.0-next.2 起),员工点一下即作答,不用打字 - 「按提问人的所属单位作答」里原来的文字提问改为:先不作答,调用 ask_which 问 「您在哪家公司?」,选项是另有规定的公司,再加「其他单位(按集团规定)」; 另有规定的公司超过 2 家(卡片放不下)或没有 ask_which(MCP 提示词)时,沿用原来 的文字提问 - 长度测试的上限按 cloud#5361 改为 8000(平台已提高上限且超限只告警);技能现 5802 字符,仍低于旧服务端的 6000 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012dn2AcW8C4n6XNmbS4jPPh --- .../policy-inquiry-ask-which.test.ts | 24 +++++++++++++++++++ .../__tests__/policy-inquiry-length.test.ts | 13 +++++----- src/skills/policy-inquiry.skill.ts | 12 ++++++++-- 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 src/skills/__tests__/policy-inquiry-ask-which.test.ts diff --git a/src/skills/__tests__/policy-inquiry-ask-which.test.ts b/src/skills/__tests__/policy-inquiry-ask-which.test.ts new file mode 100644 index 0000000..9c1ece4 --- /dev/null +++ b/src/skills/__tests__/policy-inquiry-ask-which.test.ts @@ -0,0 +1,24 @@ +import { describe, expect, it } from 'vitest'; +import { PolicyInquirySkill } from '../policy-inquiry.skill.js'; + +const skill = PolicyInquirySkill as { instructions?: string; tools?: string[] }; +const instructions = skill.instructions ?? ''; + +// When the asker's company is unknown and units rule differently, the skill +// asks through the platform's `ask_which`, which the console draws as a +// clickable question card, instead of a question the employee has to type. +describe('the policy-inquiry skill, on asking which company', () => { + it('declares ask_which', () => { + expect(skill.tools).toContain('ask_which'); + }); + + it('asks through ask_which with the units as readings, within the tool’s 2–3', () => { + expect(instructions).toContain('调用 ask_which 问「您在哪家公司?」'); + expect(instructions).toContain('「其他单位(按集团规定)」,共 2–3 项'); + }); + + it('keeps the typed question where the card cannot carry it', () => { + expect(instructions).toContain('另有规定的公司超过 2 家,或没有 ask_which 时'); + expect(instructions).toContain('请问您在哪家公司?告诉我后按贵公司的规定答复'); + }); +}); diff --git a/src/skills/__tests__/policy-inquiry-length.test.ts b/src/skills/__tests__/policy-inquiry-length.test.ts index 892eefb..a2ca1fd 100644 --- a/src/skills/__tests__/policy-inquiry-length.test.ts +++ b/src/skills/__tests__/policy-inquiry-length.test.ts @@ -1,12 +1,13 @@ import { describe, it, expect } from 'vitest'; import { PolicyInquirySkill } from '../policy-inquiry.skill.js'; -// The platform loads an app's skills only while their composed text stays -// under 6,000 characters (cloud `packages/service-ai/src/package-skills.ts`, -// PACKAGE_SKILL_TEXT_CAP, ADR-0118 D5). A skill over it is left out of the -// turn whole, with only a log line. Keep a margin for the section header the -// platform adds around label, description and instructions. -const PLATFORM_CAP = 6_000; +// The platform measures an app's skills against a composed-text cap (cloud +// `packages/service-ai/src/package-skills.ts`, PACKAGE_SKILL_TEXT_CAP, +// ADR-0118 D5). cloud#5361 raised it from 6,000 to 8,000 and stopped dropping +// a skill over it (a warning only); a server before that leaves a skill over +// 6,000 out of the turn whole. Keep a margin for the section header and +// `Tools:` line the platform adds around label, description and instructions. +const PLATFORM_CAP = 8_000; const MARGIN = 400; describe('the policy-inquiry skill text', () => { diff --git a/src/skills/policy-inquiry.skill.ts b/src/skills/policy-inquiry.skill.ts index cf81855..39518de 100644 --- a/src/skills/policy-inquiry.skill.ts +++ b/src/skills/policy-inquiry.skill.ts @@ -39,6 +39,14 @@ import { defineSkill } from '@objectstack/spec'; * policy whose text the asker's unit also carries is cited from the unit's * copy, so the source does not depend on which copy the search ranked. * + * Asking which company: when the asker's unit is unknown and units rule the + * same matter differently, the skill asks back through the platform's + * `ask_which` (cloud#4773), which ends the turn on the question and its 2–3 + * readings; the console draws them as a card the employee answers with one + * click (objectstack plugin-chatbot QuestionCard, 19.0.0-next.2). More units + * than the card holds, or a client without the tool (the MCP prompt), keeps the + * text question. + * * Phase one has no hand-off to a person (maintainer, 2026-11-24): with no * basis the answer says so; the escalation action stays for the form path. */ @@ -96,7 +104,7 @@ export const PolicyInquirySkill = defineSkill({ - 其他平级公司的制度不作为答案;最多在末尾提一句「某公司另有类似规定,仅供参考」。 - 员工明确问的是另一家单位的规定,按问的那家单位作答。 - 还不知道提问人属于哪家公司,而相关规定只有集团一份,或各单位规定一致:直接作答,不用问。 -- 还不知道提问人属于哪家公司,而集团和下属公司(或几家下属公司)对同一事项规定不同:不要猜。结论里先写集团规定,再按单位列出另有规定的公司和不同之处(依据、出处照常写),最后问一句「请问您在哪家公司?告诉我后按贵公司的规定答复」。同一段对话只问一次。 +- 还不知道提问人属于哪家公司,而集团和下属公司(或几家下属公司)对同一事项规定不同:不要猜,先不作答,调用 ask_which 问「您在哪家公司?」,readings 是另有规定的各公司名称,再加一项「其他单位(按集团规定)」,共 2–3 项,不写数字;员工选定后按该单位规定作答。另有规定的公司超过 2 家,或没有 ask_which 时:结论里先写集团规定,再按单位列出另有规定的公司和不同之处(依据、出处照常写),最后问一句「请问您在哪家公司?告诉我后按贵公司的规定答复」。同一段对话只问一次。 - 职级、岗位同理:规定按职级或岗位分档,而员工没说自己的职级或岗位时,把各档标准都列出来,并请员工说明以便确认。 ## 作答规则 @@ -128,6 +136,6 @@ export const PolicyInquirySkill = defineSkill({ - 无依据时不用三段式,只写三句:现行制度中未找到关于××的规定(已指定制度时说「本制度中未找到」);查过哪些制度(只写名称,不摘条文、数字、部门);请向本单位制度管理部门咨询。除这三句外不作推断,不给替代办法,不借用别家公司的做法。 - 不要新建或修改任何记录。 `, - tools: ['search_knowledge', 'query_records', 'get_record'], + tools: ['search_knowledge', 'query_records', 'get_record', 'ask_which'], active: true, });