@roll-agent/smart-reply-agent 1.3.6 → 1.3.8

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.
package/SKILL.md CHANGED
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: smart-reply-agent
3
- description: 招聘智能回复 Agent。根据候选人消息和上下文,向 Reply Authority Service 请求已签名回复。
3
+ description: 根据显式提供的候选人消息和上下文向 Reply Authority Service 请求并透传已签名回复协议;不负责 BOSS 页面、发送、双稿 Judge 或 feedback。需要浏览器发送闭环时使用 browser-use-agent。
4
4
  metadata:
5
5
  roll-env-file: references/env.yaml
6
6
  ---
7
7
 
8
8
  # Smart Reply Agent
9
9
 
10
- 招聘场景智能回复 Agent,负责把候选人消息转发到 Reply Authority Service,返回建议回复和带 Ed25519 签名的发送信封。
10
+ 招聘场景智能回复 Agent,负责把候选人消息转发到 Reply Authority Service,返回建议回复、带 Ed25519 签名的发送信封,以及服务端可选的双稿协议数据。
11
11
 
12
12
  npm 包名:`@roll-agent/smart-reply-agent`
13
13
 
@@ -22,18 +22,18 @@ npm 包名:`@roll-agent/smart-reply-agent`
22
22
 
23
23
  ## 能力边界
24
24
 
25
- 本 Agent 只负责**向 Reply Authority Service 请求已签名回复**。
25
+ 本 Agent 只负责**向 Reply Authority Service 请求并透传已签名回复协议**。
26
26
 
27
- 不会:打开聊天页面、读取候选人资料页面、抓取当前聊天记录、直接发送消息、交换微信、执行浏览器自动化。
27
+ 不会:打开聊天页面、读取候选人资料页面、抓取当前聊天记录、执行双稿 Judge、调用 `/reply-feedback`、维护 feedback outbox、直接发送消息、交换微信、执行浏览器自动化。
28
28
 
29
- 如果任务需要页面操作或消息发送,应选择 `browser-use-agent`;如果只是基于已给定的 `candidateMessage`、`conversationHistory`、`candidateInfo` 和 `target` 获取已签名回复,应选择本 Agent。
29
+ 如果任务需要 BOSS 页面操作、消息发送或双稿闭环,应从生成阶段开始选择 `browser-use-agent`;如果只是基于已给定的 `candidateMessage`、`conversationHistory`、`candidateInfo` 和 `target` 获取协议响应,且调用方自行负责后续发送与 feedback 终态,才选择本 Agent。
30
30
 
31
31
  ## Tools
32
32
 
33
33
  完整 inputSchema 可通过 `roll agent tools smart-reply-agent`(或 `--json`)查询。
34
34
 
35
35
  - `generate_reply(candidateMessage, conversationHistory?, candidateInfo?, preferredBrand?, preferredBrandId?, channelType?, defaultWechatId?, industryVoiceId?, turnIndex?, modelConfig?, target)`
36
- 调用 Reply Authority Service 的 `POST /generate-signed-reply`,返回 `suggestedReply`、`signedEnvelope`、`envelopeExp`、`confidence`、`stage` 和可选 `diagnostics`。`target` 为必填,至少包含 `platform=zhipin`、`conversationId`、`candidateId`,以及以下两种 recruiter 绑定方式之一:
36
+ 调用 Reply Authority Service 的 `POST /generate-signed-reply`,返回 `suggestedReply`、`signedEnvelope`、`envelopeExp`、`confidence`、`stage`、可选 `diagnostics`,以及服务端启用双稿时的 `replyVariants`。RFC V3 的 `replyVariants` 包含 `groupId`、`recommended`、`findings`、`items`、`rubricVersion` / `rubricHash`、服务端权威 `feedbackExpiresAt` 和两份已签名候选稿;`feedbackExpiresAt` 是 Unix 秒终态截止时间,本 Agent 不会据此建立 outbox 或自动回调。`target` 为必填,至少包含 `platform=zhipin`、`conversationId`、`candidateId`,以及以下两种 recruiter 绑定方式之一:
37
37
  1. 直接传完整绑定:`tenantId + recruiterBinding`
38
38
  2. 便利代理模式:`recruiterUsername`(smart-reply 会先调用 `POST /resolve-recruiter-binding` 解析出 `tenantId + recruiterBinding`)
39
39
 
@@ -116,7 +116,8 @@ npm 包名:`@roll-agent/smart-reply-agent`
116
116
  - 实际回复生成、reply-policy、FactGate、ReplyGate、年龄校验都在云端执行
117
117
  - `modelConfig.reasoning` 会透传给 Reply Authority Service;raw reasoning/thinking 文本不会作为业务输出返回
118
118
  - 返回的 `signedEnvelope` 为 v2 信封,已绑定 `tenantId + recruiterBinding + conversationId + candidateId`;浏览器发送主链路应优先使用 `browser-use-agent.zhipin_generate_reply_preview(...) -> zhipin_send_prepared_reply(preparedReplyId)`
119
- - 若服务端返回 `replyVariants`,`generate_reply` 只做协议透传;它不会隐藏 `signedEnvelope`,也不会执行 judge / `/reply-feedback`。需要双稿闭环时,主链路必须改用 `browser-use-agent.zhipin_generate_reply_preview(...) -> zhipin_judge_prepared_reply(...) -> zhipin_send_prepared_reply(...)`
119
+ - 若服务端返回 `replyVariants`,`generate_reply` 只做协议透传;它不会隐藏 `signedEnvelope`,也不会执行 Judge、提交 `selected/not_learned`、调用 `/reply-feedback` 或维护 outbox。直接调用方必须自行发送且在 Unix 秒 `feedbackExpiresAt` 前关闭终态,不能只取顶层推荐稿后忽略 group
120
+ - 在 Roll 的 BOSS 发送链路中,应在生成前就选择 `browser-use-agent.zhipin_generate_reply_preview(...) -> zhipin_send_prepared_reply(preparedReplyId, variantDecision?)`。send 缺少显式 `variantDecision` 时会内部执行并缓存默认 Judge;`zhipin_judge_prepared_reply(...)` 仅用于可选预览,不是默认必经步骤
120
121
  - 调用失败时抛 `ReplyAuthorityRequestError`,携带 `meta: {url, timeoutMs, requestId}` 与 `Error.cause` 链。通过 `roll run` 运行时 stderr 会展开 `cause: ...` 行用于定位;透传的 `x-request-id` 可跨服务端追踪
121
122
  - `diagnostics.brandResolutionSource="none"`、`diagnostics.resolvedBrand=""`、`diagnostics.ageGate.status="unknown"` 都是合法服务端结果,不代表 tool 调用失败。是否补问用户或转人工,是 orch 层策略,不是本 Agent 的重试条件
122
123
 
@@ -125,11 +126,13 @@ npm 包名:`@roll-agent/smart-reply-agent`
125
126
  机器可读的 env 契约见 `references/env.yaml`。如果你是上层编排 Agent,请优先读取它来生成/校验 `agents.env.smart-reply-agent` 配置。
126
127
 
127
128
  - `REPLY_AUTHORITY_URL` — Reply Authority Service 基础地址(必填)
128
- - `REPLY_AUTHORITY_BEARER_TOKEN` — 调用 `POST /generate-signed-reply` 的 Bearer token(必填)
129
- - `REPLY_AUTHORITY_TIMEOUT_MS` — Reply Authority Service HTTP 请求超时毫秒数(可选,默认 `30000`)。非正整数或非法值会被静默忽略并回落到默认值
129
+ - `REPLY_AUTHORITY_BEARER_TOKEN` — 调用 `POST /generate-signed-reply`,以及代理模式下 `POST /resolve-recruiter-binding` 的 Bearer token(必填);必须能访问目标 tenant。本 Agent 不使用它调用 rubric 或 `/reply-feedback`,因此自身不要求 `reply-feedback:write`;外部调用方若自行完成双稿 rubric/feedback,则须另行保证对应客户端/token 具备该 scope
130
+ - `REPLY_AUTHORITY_TIMEOUT_MS` — Reply Authority Service HTTP 请求超时毫秒数(可选,客户端默认 `60000`)。非正整数或非法值会被静默忽略并回落到默认值;该默认值高于 RFC 当前 `50000ms` 的完整请求截止时间,让服务端能先返回带 phase 证据的 `504`。生产仍建议显式声明以便 `roll doctor` 核验
130
131
 
131
132
  ## 典型跨 Agent 工作流
132
133
 
134
+ 以下流程只适用于“获取协议响应但不由 Roll 直接发送”,或调用方已经自行实现双稿发送与 `/reply-feedback` 终态的场景。若最终要通过 BOSS 浏览器发送,应直接使用后面的 browser-use prepared-reply 主链路,不要先调用 `smart-reply-agent.generate_reply` 再丢弃其 `replyVariants` group。
135
+
133
136
  1. `browser-use-agent.zhipin_get_username()` → 获取当前 BOSS 账号 `username`
134
137
  2. `browser-use-agent` 读取候选人资料、聊天记录或当前页面上下文,并从 `zhipin_read_messages` / `zhipin_get_candidate_info` 获取 `conversationId + candidateId`
135
138
  - 一旦拿到这两个 ID,后续整个链路都应原样复用,不要再退回 `index`
@@ -143,7 +146,20 @@ npm 包名:`@roll-agent/smart-reply-agent`
143
146
  - 直接模式:传 `target.tenantId + target.recruiterBinding`
144
147
  - 代理模式:只传 `target.recruiterUsername=username`,由 smart-reply 代调用 `POST /resolve-recruiter-binding`
145
148
  5. `smart-reply-agent.generate_reply(..., target)` 获取 `suggestedReply + signedEnvelope`,并在服务端开启双稿时透传 `replyVariants`
146
- 6. 若需要在 BOSS 浏览器中展示生成过程、隐藏 `signedEnvelope`、执行默认 judge 或回传 `/reply-feedback`,优先改用 `browser-use-agent.zhipin_generate_reply_preview(...) -> zhipin_judge_prepared_reply(...) -> zhipin_send_prepared_reply(preparedReplyId, variantDecision?)`,不要把 `signedEnvelope` 作为跨 Agent 编排参数传递
149
+ 6. 若返回 `replyVariants`,调用方必须自行发送并按 RFC V3 关闭终态;本 Agent 不提供该回传 tool:
150
+ - Judge 或 orchestrator 确定 A/B 选择:提交 `feedbackOutcome:"selected"`,`decisionSource:"judge"|"orchestrator"`,并按实际核实结果提供 `confirmedFindingCodes`
151
+ - rubric/Judge fallback 或显式 no-Judge:只发送服务推荐稿,提交 `feedbackOutcome:"not_learned"`,使用 `decisionSource:"service_recommended_fallback"|"explicit_no_judge"`,且不得携带 `confirmedFindingCodes`
152
+
153
+ Roll 的 BOSS prepared-reply 主链路:
154
+
155
+ ```text
156
+ browser-use-agent.zhipin_generate_reply_preview(...)
157
+ -> [可选预览] browser-use-agent.zhipin_judge_prepared_reply(preparedReplyId)
158
+ -> browser-use-agent.zhipin_send_prepared_reply(preparedReplyId, variantDecision?)
159
+ # 缺省时 send 内部 Judge;发送成功后自动持久化并回传 selected/not_learned
160
+ ```
161
+
162
+ 不要把 `signedEnvelope` 作为跨 Agent 编排参数传递,也不要为了修复 `feedbackStatus:"queued"|"failed"` 而重复发送候选人消息。
147
163
 
148
164
  ## Recommended roll.config.yaml
149
165
 
@@ -155,6 +171,6 @@ agents:
155
171
  smart-reply-agent:
156
172
  REPLY_AUTHORITY_URL: https://reply-authority.duliday.com
157
173
  REPLY_AUTHORITY_BEARER_TOKEN: ${REPLY_AUTHORITY_BEARER_TOKEN}
158
- # 可选:自定义 HTTP 超时(毫秒,默认 30000)
159
- # REPLY_AUTHORITY_TIMEOUT_MS: "45000"
174
+ # RFC 完整请求截止时间为 50000ms 时,调用方需保留响应缓冲
175
+ REPLY_AUTHORITY_TIMEOUT_MS: "60000"
160
176
  ```
@@ -86,5 +86,6 @@ export declare const generateReply: import("@roll-agent/sdk").ToolDefinition<{
86
86
  }[];
87
87
  rubricVersion: string;
88
88
  rubricHash: string;
89
+ feedbackExpiresAt?: number | undefined;
89
90
  } | undefined;
90
91
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roll-agent/smart-reply-agent",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "zod": "^3.25.76",
44
- "@roll-agent/reply-authority-client": "0.5.0",
44
+ "@roll-agent/reply-authority-client": "0.7.0",
45
45
  "@roll-agent/sdk": "0.3.0"
46
46
  },
47
47
  "devDependencies": {
@@ -6,12 +6,12 @@ required:
6
6
  example: https://reply-authority.duliday.com
7
7
  - name: REPLY_AUTHORITY_BEARER_TOKEN
8
8
  secret: true
9
- purpose: Reply Authority Service Bearer token;服务端据此反查 clientId 并校验可访问的 tenantId
9
+ purpose: Reply Authority Service Bearer token;用于 generate-signed-reply,以及代理模式下 resolve-recruiter-binding;必须能访问目标 tenant。本 Agent 不调用 feedback rubric 或 /reply-feedback,因此自身不要求 reply-feedback:write
10
10
  example: ${REPLY_AUTHORITY_BEARER_TOKEN}
11
11
  optional:
12
12
  - name: REPLY_AUTHORITY_TIMEOUT_MS
13
13
  secret: false
14
14
  type: number
15
- purpose: Reply Authority Service HTTP 请求超时(毫秒)。未设置或值无效时回落默认 30000
16
- example: "30000"
17
- default: "30000"
15
+ purpose: Reply Authority Service 调用方硬墙钟超时(毫秒)。未设置或值无效时回落客户端默认 60000,保持高于 RFC 当前 50000ms 的完整请求截止时间;生产仍建议显式声明以便 doctor 核验
16
+ example: "60000"
17
+ default: "60000"