@peer-agent/protocol 0.0.9 → 0.0.10

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/dist/goal.d.ts CHANGED
@@ -68,7 +68,7 @@ export declare function formatGoalDeliveryHandoff(input: {
68
68
  }, options?: {
69
69
  readonly locale?: 'zh' | 'en';
70
70
  }): string | undefined;
71
- /** 灯条用的短合回状态:合不进 / 还没进 / 已进源头。 */
71
+ /** 灯条用的短合回状态:合不进 / 还没归档 / 已归档到源头。 */
72
72
  export declare function formatGoalDeliveryHandoffLamp(input: {
73
73
  readonly deliveryHandoff?: GoalDeliveryHandoff | null;
74
74
  readonly deliveryBinding?: GoalDeliveryBinding | null;
package/dist/goal.js CHANGED
@@ -83,6 +83,18 @@ function handoffStoppedReasonLabel(reason, locale, branch) {
83
83
  return locale === 'zh' ? `合并进 ${dest} 超时,可重试` : 'merge timed out; retry available';
84
84
  case 'git_lock':
85
85
  return locale === 'zh' ? '仓库正被占用,可重试' : 'repository is locked; retry available';
86
+ case 'quality_review_pending':
87
+ return locale === 'zh'
88
+ ? '质量自检还没过线,没法合进发版线。点「继续修」,把缺的检查补上后再合。'
89
+ : 'Quality review has not passed, so this cannot merge yet. Tap Continue fixing to finish the missing checks, then merge.';
90
+ case 'missing_task_commits':
91
+ return locale === 'zh'
92
+ ? '任务线还没有可合入的提交。改动还在工作区里,先提交再合并。'
93
+ : 'the task line has no commits to merge; commit the work first';
94
+ case 'missing_worktree':
95
+ return locale === 'zh'
96
+ ? '找不到这条任务的隔离现场,没法合并。'
97
+ : 'the isolated worktree is missing, so this cannot merge';
86
98
  default:
87
99
  return locale === 'zh' ? `合不进 ${dest}` : `cannot merge into ${dest}`;
88
100
  }
@@ -125,7 +137,7 @@ export function formatGoalDeliveryHandoff(input, options) {
125
137
  }
126
138
  return undefined;
127
139
  }
128
- /** 灯条用的短合回状态:合不进 / 还没进 / 已进源头。 */
140
+ /** 灯条用的短合回状态:合不进 / 还没归档 / 已归档到源头。 */
129
141
  export function formatGoalDeliveryHandoffLamp(input, options) {
130
142
  const locale = options?.locale === 'en' ? 'en' : 'zh';
131
143
  if (!hasDeliveryLine(input))
@@ -152,7 +164,7 @@ export function formatGoalDeliveryHandoffLamp(input, options) {
152
164
  if (handoff.deliveryMode === 'direct') {
153
165
  return locale === 'zh' ? `已随 ${dest} 交付` : `delivered with ${dest}`;
154
166
  }
155
- return locale === 'zh' ? `已进 ${dest}` : `on ${dest}`;
167
+ return locale === 'zh' ? `已归档到 ${dest}` : `archived to ${dest}`;
156
168
  }
157
169
  if (handoff.status === 'stopped') {
158
170
  return locale === 'zh' ? `合不进 ${dest}` : `blocked from ${dest}`;
@@ -102,6 +102,13 @@ export interface ChatSendRequest {
102
102
  * 在终态事件时回写——这是「正文持久化真值下沉主进程」的链路锚点。
103
103
  */
104
104
  readonly assistantMessageId?: string;
105
+ /**
106
+ * 续写中断回复:true 表示本轮不是新的用户输入,而是把 assistantMessageId 指向的
107
+ * 既有(interrupted)assistant 消息作为累积种子——主进程以该消息已落盘的正文/
108
+ * segments 为初始状态继续追加,计时回拨到原消息时间戳,不重置;goal 路由也
109
+ * 不应把它当成新用户回合处理。
110
+ */
111
+ readonly resumeInterruptedReply?: boolean;
105
112
  readonly effort?: string;
106
113
  /** Request-scoped OpenAI Fast mode; defaults to false when omitted. */
107
114
  readonly fastMode?: boolean;
@@ -130,7 +130,7 @@ export interface TaskOverviewItem {
130
130
  readonly deliveryHandoffStoppedReason?: string;
131
131
  /**
132
132
  * 源头环境挡卡:被同一源头挡住的任务线。有值时这张卡代表源头,不是某条 Goal 会话。
133
- * 主按钮不得用 conversationId 打开聊天。
133
+ * 主按钮应打开被挡任务对应的对话,而不是原地结束。
134
134
  */
135
135
  readonly blockedPlanIds?: readonly string[];
136
136
  /** 被挡任务线标题,供源头卡展开「都有哪些」。 */
@@ -246,6 +246,11 @@ export interface GoalPlanProjectionSnapshot {
246
246
  readonly runnerStatus?: GoalRunnerStatus;
247
247
  /** Runner 阻塞是否由系统基础设施持有,而不是用户行动权。 */
248
248
  readonly systemBlocked?: boolean;
249
+ /**
250
+ * 同一会话此刻是否有前台活流(正在输出 / 调工具 / compact)。
251
+ * 由聚合层从 listActiveStreams 写入;协议层只认这个布尔事实。
252
+ */
253
+ readonly conversationLive?: boolean;
249
254
  /** Runner 上存在尚未被 resume 消费的网络/流式中断事实。 */
250
255
  readonly interrupted?: boolean;
251
256
  /** 持久化中断事实中的用户可展示原因。 */
@@ -270,11 +270,13 @@ function decideGoalPlan(snapshot) {
270
270
  };
271
271
  }
272
272
  const planStillActive = status === 'executing' || status === 'accepted' || status === 'approved';
273
+ const conversationLive = snapshot.conversationLive === true;
273
274
  const recoverableSystemBlocked = runnerStatus === 'blocked'
274
275
  && snapshot.systemBlocked === true;
275
276
  // System infrastructure failures are not user decisions. A foreground turn may
276
277
  // take over this blocker; until then expose an inspectable interruption.
277
- if (planStillActive && recoverableSystemBlocked) {
278
+ // A live foreground stream already holds execution — do not keep asking the user.
279
+ if (planStillActive && recoverableSystemBlocked && !conversationLive) {
278
280
  return {
279
281
  actionRight: 'paused',
280
282
  nextAction: 'inspect',
@@ -283,6 +285,7 @@ function decideGoalPlan(snapshot) {
283
285
  };
284
286
  }
285
287
  // rule 4: Runner 已明确把行动权交给用户,不再展示为“Peer 正在推进”。
288
+ // waiting_user is a precise question; a live stream must not swallow it.
286
289
  if (planStillActive && runnerStatus === 'waiting_user') {
287
290
  return {
288
291
  actionRight: 'needs_you',
@@ -294,7 +297,9 @@ function decideGoalPlan(snapshot) {
294
297
  }
295
298
  // rule 5: 仅活跃计划上的 Runner 实时求助才进 needs_you
296
299
  // (plan 必须仍在推进:executing/accepted/approved;历史僵尸 blocked 不进)
300
+ // 同一会话已有前台活流时,执行权在会话里,不要把过期 blocked 投成决策卡。
297
301
  if (planStillActive &&
302
+ !conversationLive &&
298
303
  (runnerStatus === 'blocked' || runnerStatus === 'budget_exhausted')) {
299
304
  return {
300
305
  actionRight: 'needs_you',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peer-agent/protocol",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Shared host-neutral protocol contracts for Peer Agent runtimes and clients.",
5
5
  "type": "module",
6
6
  "license": "MIT",