pi-claude-supervisor 0.8.0 → 0.9.0

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.
@@ -99,7 +99,7 @@ function toGeneric(notice: HumanInterventionNotice | CandidateNotice): Record<st
99
99
  question: sanitize(notice.question),
100
100
  permission: notice.permission ? sanitize(notice.permission) : undefined,
101
101
  ...(notice.attach ? { attach: sanitize(notice.attach) } : {}),
102
- ...(candidate ? { status: notice.status, deliverable: notice.deliverable, ...(notice.usage ? { usage: usageSummary(notice.usage) } : {}) } : { actions: ["approve_or_deny_permission", "send_instruction", "stop_worker", "takeover"] }),
102
+ ...(candidate ? { status: notice.status, deliverable: notice.deliverable, ...(notice.prUrl ? { prUrl: sanitize(notice.prUrl) } : {}), ...(notice.usage ? { usage: usageSummary(notice.usage) } : {}) } : { actions: ["approve_or_deny_permission", "send_instruction", "stop_worker", "takeover"] }),
103
103
  note: candidate
104
104
  ? "This is an optional candidate notification. It does not grant remote push or main/integration merge permission."
105
105
  : "This is an outbound notification. Use the Pi session or a separately authenticated callback service to approve actions.",
@@ -111,6 +111,9 @@ function toWeCom(notice: HumanInterventionNotice | CandidateNotice): Record<stri
111
111
  const permission = notice.permission ? `\n工具: ${safeText(notice.permission.toolName)}\n请求 ID: ${safeText(notice.permission.requestId)}` : "";
112
112
  const question = notice.question ? `\n问题: ${safeText(notice.question)}` : "";
113
113
  const attach = notice.attach ? `\n接入: ${safeText(notice.attach)}` : "";
114
+ // Not Markdown-escaped: `escapeMarkdown` would turn an `_` in the org or
115
+ // repository name into `\_` and break the link. The URL is already sanitized.
116
+ const pullRequest = "status" in notice && notice.prUrl ? `\nPR: ${safeText(notice.prUrl)}` : "";
114
117
  const title = candidate ? "Claude Supervisor 候选状态" : "Claude Supervisor 需要人工介入";
115
118
  const usage = candidate && notice.usage ? `\n> Worker 费用: $${notice.usage.workerCostUsd.toFixed(2)} (${notice.usage.workerTurns} turns)\n> Pi tokens: ${usageSummary(notice.usage).piTokens}` : "";
116
119
  const suffix = candidate
@@ -119,7 +122,7 @@ function toWeCom(notice: HumanInterventionNotice | CandidateNotice): Record<stri
119
122
  return {
120
123
  msgtype: "markdown",
121
124
  markdown: {
122
- content: `### ${title}\n> 任务: ${safeText(notice.task)}\n> Task ID: ${safeText(notice.taskId)}\n> 原因: ${safeText(notice.reason)}${escapeMarkdown(question)}${escapeMarkdown(permission)}${escapeMarkdown(attach)}${suffix}`,
125
+ content: `### ${title}\n> 任务: ${safeText(notice.task)}\n> Task ID: ${safeText(notice.taskId)}\n> 原因: ${safeText(notice.reason)}${escapeMarkdown(question)}${escapeMarkdown(permission)}${escapeMarkdown(attach)}${pullRequest}${suffix}`,
123
126
  },
124
127
  };
125
128
  }