Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/skills/__tests__/policy-inquiry-ask-which.test.ts
Original file line number Diff line number Diff line change
@@ -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('请问您在哪家公司?告诉我后按贵公司的规定答复');
});
});
13 changes: 7 additions & 6 deletions src/skills/__tests__/policy-inquiry-length.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
12 changes: 10 additions & 2 deletions src/skills/policy-inquiry.skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -96,7 +104,7 @@ export const PolicyInquirySkill = defineSkill({
- 其他平级公司的制度不作为答案;最多在末尾提一句「某公司另有类似规定,仅供参考」。
- 员工明确问的是另一家单位的规定,按问的那家单位作答。
- 还不知道提问人属于哪家公司,而相关规定只有集团一份,或各单位规定一致:直接作答,不用问。
- 还不知道提问人属于哪家公司,而集团和下属公司(或几家下属公司)对同一事项规定不同:不要猜。结论里先写集团规定,再按单位列出另有规定的公司和不同之处(依据、出处照常写),最后问一句「请问您在哪家公司?告诉我后按贵公司的规定答复」。同一段对话只问一次。
- 还不知道提问人属于哪家公司,而集团和下属公司(或几家下属公司)对同一事项规定不同:不要猜,先不作答,调用 ask_which 问「您在哪家公司?」,readings 是另有规定的各公司名称,再加一项「其他单位(按集团规定)」,共 2–3 项,不写数字;员工选定后按该单位规定作答。另有规定的公司超过 2 家,或没有 ask_which 时:结论里先写集团规定,再按单位列出另有规定的公司和不同之处(依据、出处照常写),最后问一句「请问您在哪家公司?告诉我后按贵公司的规定答复」。同一段对话只问一次。
- 职级、岗位同理:规定按职级或岗位分档,而员工没说自己的职级或岗位时,把各档标准都列出来,并请员工说明以便确认。

## 作答规则
Expand Down Expand Up @@ -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,
});