@yeaft/webchat-agent 0.1.47 → 0.1.51

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.
@@ -75,6 +75,25 @@ export async function handleCrewHumanInput(msg) {
75
75
  }
76
76
 
77
77
  if (target) {
78
+ // 检测纯 skill 命令(如 /context, /simplify),直接发送不加前缀
79
+ if (/^\/[a-zA-Z0-9_-]+(?:\s+.*)?$/s.test(message)) {
80
+ if (session.status === 'paused' || session.status === 'stopped' || session.status === 'initializing') {
81
+ console.log(`[Crew] Session ${session.status}, skipping skill dispatch to ${target}`);
82
+ return;
83
+ }
84
+ let roleState = session.roleStates.get(target);
85
+ if (!roleState || !roleState.query || !roleState.inputStream) {
86
+ const { createRoleQuery } = await import('./role-query.js');
87
+ roleState = await createRoleQuery(session, target);
88
+ }
89
+ roleState.inputStream.enqueue({
90
+ type: 'user',
91
+ message: { role: 'user', content: message }
92
+ });
93
+ sendStatusUpdate(session);
94
+ console.log(`[Crew] Skill command dispatched to ${target}: ${message}`);
95
+ return;
96
+ }
78
97
  await dispatchToRole(session, target, buildHumanContent('人工消息:', message), 'human');
79
98
  return;
80
99
  }
@@ -269,6 +269,26 @@ ${m.taskExample}
269
269
  ${m.taskListNotes}`;
270
270
  }
271
271
 
272
+ // 非 dev 团队的非决策者也需要知道协作模式
273
+ if (!role.isDecisionMaker && session.teamType !== 'dev') {
274
+ prompt += `\n\n${m.collabMode}
275
+ ${m.collabModeContent}`;
276
+ }
277
+
278
+ // 非 DM 角色的团队特定协作建议
279
+ if (!role.isDecisionMaker && m.teamCollabFlow) {
280
+ // roleType 在多个团队中出现时用 roleType_teamType 消歧
281
+ const flowFn = m.teamCollabFlow[role.roleType + '_' + session.teamType]
282
+ || m.teamCollabFlow[role.roleType];
283
+ if (flowFn) {
284
+ const flowText = flowFn(session.decisionMaker);
285
+ if (flowText) {
286
+ prompt += `\n\n${m.teamCollabFlowTitle}
287
+ ${flowText}`;
288
+ }
289
+ }
290
+ }
291
+
272
292
  // Feature 进度文件说明
273
293
  prompt += `\n\n${m.featureRecordTitle}
274
294
  ${m.featureRecordContent}
package/crew-i18n.js CHANGED
@@ -106,6 +106,39 @@ ${isDevTeam ? '3' : '2'}. **任务完成** - 所有任务已完成,给出完
106
106
  - <kanban> 标签:当前工作看板(所有任务的负责人、状态、最新进展)
107
107
  请根据这些上下文继续你的工作,不需要从头开始。`,
108
108
 
109
+ // Team-specific collaboration flow for non-DM roles
110
+ teamCollabFlowTitle: '# 协作建议',
111
+ teamCollabFlow: {
112
+ // writing team
113
+ writer: (dm) => `你的工作完成后,建议 ROUTE 给审稿师请求审核。如果审稿师打回了修改意见,修改后重新提交。
114
+ 爽点节奏或钩子位置不确定时,可以找设计师讨论。大纲或设定问题,找决策者 "${dm}" 确认。`,
115
+ designer_writing: (dm) => `节奏方案设计完成后,建议 ROUTE 给决策者 "${dm}" 审核。
116
+ 审核通过后,可以交给执笔师按节奏撰写。收到审稿师的反馈后调整设计。`,
117
+ editor_writing: (dm) => `审核完成后,如果通过,建议 ROUTE 给决策者 "${dm}" 确认验收。
118
+ 如果发现问题:文字质量问题打回给执笔师,节奏问题反馈给设计师,设定矛盾反馈给决策者 "${dm}"。`,
119
+ planner: () => '', // DM, handled separately
120
+
121
+ // trading team
122
+ analyst: (dm) => `技术分析完成后,建议 ROUTE 给决策者 "${dm}" 综合判断。
123
+ 当价格接近关键价位时,主动提醒决策者和交易员。`,
124
+ macro: (dm) => `宏观研究完成后,建议 ROUTE 给决策者 "${dm}" 综合判断。
125
+ 数据矛盾时明确标注置信度,列出所有情景及概率。`,
126
+ risk: (dm) => `风控审查完成后,建议 ROUTE 给决策者 "${dm}"。通过则附上风控意见,不通过则说明具体原因和违反的原则。
127
+ 持续监控已有持仓,异常时主动预警。`,
128
+ trader: (dm) => `交易执行完成后,建议 ROUTE 给决策者 "${dm}" 报告执行结果。
129
+ 止损触发时立即执行并通知决策者。遇到无法执行的情况立即反馈。`,
130
+ strategist: () => '', // DM
131
+
132
+ // video team
133
+ scriptwriter: (dm) => `脚本完成后,建议 ROUTE 给决策者 "${dm}" 审核。
134
+ 收到修改意见后调整脚本重新提交。叙事方向不确定时找决策者确认。`,
135
+ storyboard: (dm) => `分镜设计完成后,建议 ROUTE 给决策者 "${dm}" 审核视觉连贯性。
136
+ 审核通过后,可以交给剪辑师组装最终 prompt。`,
137
+ editor_video: (dm) => `最终 prompt 序列完成后,建议 ROUTE 给决策者 "${dm}" 做最终审核。
138
+ 技术实现不确定时找决策者讨论。`,
139
+ director: () => '', // DM
140
+ },
141
+
109
142
  devGroupBinding: '# 开发组绑定',
110
143
  devGroupBindingContent: (gi, revLabel, revName, testLabel, testName) =>
111
144
  `你属于开发组 ${gi}。你的搭档:
@@ -305,6 +338,39 @@ After restart you will receive:
305
338
  - <kanban> tag: Current work kanban (all tasks' assignees, statuses, latest progress)
306
339
  Please continue your work based on this context — no need to start from scratch.`,
307
340
 
341
+ // Team-specific collaboration flow for non-DM roles
342
+ teamCollabFlowTitle: '# Collaboration Suggestions',
343
+ teamCollabFlow: {
344
+ // writing team
345
+ writer: (dm) => `After completing your work, consider ROUTEing to the editor for review. If the editor sends back revision notes, revise and resubmit.
346
+ If unsure about pacing or hook placement, discuss with the designer. For outline or setting questions, check with the decision maker "${dm}".`,
347
+ designer_writing: (dm) => `After completing pacing design, consider ROUTEing to the decision maker "${dm}" for review.
348
+ Once approved, hand to the writer for paced writing. Adjust design based on editor feedback.`,
349
+ editor_writing: (dm) => `After completing review, if approved, consider ROUTEing to the decision maker "${dm}" for acceptance.
350
+ If issues found: send writing quality issues back to the writer, pacing issues to the designer, setting contradictions to the decision maker "${dm}".`,
351
+ planner: () => '',
352
+
353
+ // trading team
354
+ analyst: (dm) => `After completing technical analysis, consider ROUTEing to the decision maker "${dm}" for synthesis.
355
+ Proactively alert the decision maker and trader when price approaches key levels.`,
356
+ macro: (dm) => `After completing macro research, consider ROUTEing to the decision maker "${dm}" for synthesis.
357
+ When data conflicts, clearly mark confidence levels and list all scenarios with probabilities.`,
358
+ risk: (dm) => `After completing risk review, consider ROUTEing to the decision maker "${dm}". Approve with risk opinion attached, or reject with specific principles violated.
359
+ Continuously monitor existing positions and proactively alert on anomalies.`,
360
+ trader: (dm) => `After executing trades, consider ROUTEing to the decision maker "${dm}" with an execution report.
361
+ Execute stop-losses immediately when triggered and notify the decision maker. Report any execution difficulties immediately.`,
362
+ strategist: () => '',
363
+
364
+ // video team
365
+ scriptwriter: (dm) => `After completing the script, consider ROUTEing to the decision maker "${dm}" for review.
366
+ Adjust and resubmit after receiving revision notes. Check with the decision maker when narrative direction is uncertain.`,
367
+ storyboard: (dm) => `After completing storyboard design, consider ROUTEing to the decision maker "${dm}" for visual coherence review.
368
+ Once approved, hand to the editor for final prompt assembly.`,
369
+ editor_video: (dm) => `After completing the final prompt sequence, consider ROUTEing to the decision maker "${dm}" for final review.
370
+ Discuss with the decision maker when technical implementation is uncertain.`,
371
+ director: () => '',
372
+ },
373
+
308
374
  devGroupBinding: '# Dev Group Binding',
309
375
  devGroupBindingContent: (gi, revLabel, revName, testLabel, testName) =>
310
376
  `You belong to dev group ${gi}. Your partners:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.1.47",
3
+ "version": "0.1.51",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",