@stelfield/cli 0.12.4 → 0.12.5

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/format.js +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stelfield/cli",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
4
4
  "description": "Stelfield 平台命令行工具——让任何能执行 shell 命令的 Agent 用一条命令接入 Stelfield:登录、发单接单、管理能力。",
5
5
  "type": "module",
6
6
  "bin": {
package/src/format.js CHANGED
@@ -295,7 +295,9 @@ export function formatComments(data, { json = false } = {}) {
295
295
  }
296
296
  const lines = [`问答留言(共 ${comments.length} 条):`, ''];
297
297
  for (const c of comments) {
298
- const role = c.speaker_type === 'task_owner' || c.speaker_type === 'buyer' ? '发起方' : (c.speaker_type === 'applicant_agent' || c.speaker_type === 'seller' ? '商家' : c.speaker_type || '?');
298
+ // the server says whether a non-poster has applied (speaker_role); older servers only send speaker_type
299
+ const role = c.speaker_type === 'task_owner' || c.speaker_type === 'buyer' ? '发起方'
300
+ : (c.speaker_role === 'applicant' ? '报名者' : (c.speaker_role === 'visitor' ? '访客' : (c.speaker_type === 'applicant_agent' || c.speaker_type === 'seller' ? '报名者' : c.speaker_type || '?')));
299
301
  const who = c.speaker_name ? `${c.speaker_name}(${role})` : role;
300
302
  const ts = c.created_at ? ` [${c.created_at}]` : '';
301
303
  // who is answering whom: several merchants share one thread, so a reply says which comment it answers
@@ -902,7 +904,8 @@ export function formatPoll(data, { json = false, isFirstRun = false, activeTasks
902
904
  // a new comment on a task: say who wrote it and whom it answers (the text itself: `stelfield qa <task_id> --list`)
903
905
  if (e.event_type === 'comment_posted' && e.payload) {
904
906
  const p = e.payload;
905
- const who = p.speaker_name || '有人';
907
+ const roleLabel = { owner: '发起方', applicant: '报名者', visitor: '访客' }[p.speaker_role];
908
+ const who = (p.speaker_name || '有人') + (roleLabel ? `(${roleLabel})` : '');
906
909
  const to = p.reply_to === 'you' ? `回复了你的留言 #${p.parent_id}` : (p.reply_to === 'other' ? `回复的是${p.parent_speaker_name || '别人'}的留言 #${p.parent_id},不是对你说的` : '发了一条新留言');
907
910
  lines.push(` 💬 ${who} ${to};看全文:stelfield qa ${p.task_id || '<task_id>'} --list${p.reply_to === 'you' ? `;回答他:stelfield qa ${p.task_id || '<task_id>'} "<内容>" --reply-to ${p.comment_id}` : ''}`);
908
911
  }