@peer-agent/protocol 0.0.8 → 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 +36 -3
- package/dist/goal.js +84 -19
- package/dist/skill-marketplace.d.ts +93 -6
- package/dist/system-context.d.ts +7 -0
- package/dist/task-overview.d.ts +40 -6
- package/dist/task-overview.js +34 -6
- package/package.json +1 -1
package/dist/goal.d.ts
CHANGED
|
@@ -56,10 +56,11 @@ export declare function formatGoalDeliveryRoute(input: {
|
|
|
56
56
|
readonly locale?: 'zh' | 'en';
|
|
57
57
|
}): string | undefined;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* 用户可见的合回状态。没交付线时不展示;停住/进行中不必先验收。
|
|
60
60
|
*/
|
|
61
61
|
export declare function formatGoalDeliveryHandoff(input: {
|
|
62
62
|
readonly deliveryHandoff?: GoalDeliveryHandoff | null;
|
|
63
|
+
/** 保留给调用方透传;合回展示不再看验收戳。 */
|
|
63
64
|
readonly resultAcceptance?: {
|
|
64
65
|
readonly acceptedAt?: string | null;
|
|
65
66
|
} | null;
|
|
@@ -67,6 +68,14 @@ export declare function formatGoalDeliveryHandoff(input: {
|
|
|
67
68
|
}, options?: {
|
|
68
69
|
readonly locale?: 'zh' | 'en';
|
|
69
70
|
}): string | undefined;
|
|
71
|
+
/** 灯条用的短合回状态:合不进 / 还没归档 / 已归档到源头。 */
|
|
72
|
+
export declare function formatGoalDeliveryHandoffLamp(input: {
|
|
73
|
+
readonly deliveryHandoff?: GoalDeliveryHandoff | null;
|
|
74
|
+
readonly deliveryBinding?: GoalDeliveryBinding | null;
|
|
75
|
+
readonly status?: GoalPlanStatus | null;
|
|
76
|
+
}, options?: {
|
|
77
|
+
readonly locale?: 'zh' | 'en';
|
|
78
|
+
}): string | undefined;
|
|
70
79
|
/**
|
|
71
80
|
* Goal/Plan 的执行准入事实。
|
|
72
81
|
*
|
|
@@ -222,17 +231,41 @@ export type GoalRunnerStatus = 'idle' | 'running' | 'compacting_context' | 'resu
|
|
|
222
231
|
export type GoalRunnerIntent = 'execute' | 'verify' | 'explore' | 'synthesize' | 'block';
|
|
223
232
|
export type GoalRunnerPhase = 'orient' | 'inspect' | 'plan_scaffold' | 'act' | 'verify' | 'repair' | 'quality_review' | 'synthesize' | 'blocked';
|
|
224
233
|
export type GoalQualityReviewStatus = 'reviewing' | 'passed' | 'failed';
|
|
225
|
-
/**
|
|
234
|
+
/** 把隔离改动合并进目标分支的结果;不做排队 UI。展示不要求先验收。 */
|
|
226
235
|
export type GoalDeliveryHandoffStatus = 'idle' | 'delivering' | 'delivered' | 'stopped';
|
|
236
|
+
/**
|
|
237
|
+
* 交付模式(ADR 68):merge=隔离任务线合回目标分支;direct=改动直接落在当前工作区。
|
|
238
|
+
* 缺省视为 'merge'(存量记录无此字段,向后兼容)。
|
|
239
|
+
*/
|
|
240
|
+
export type GoalDeliveryMode = 'merge' | 'direct';
|
|
227
241
|
export interface GoalDeliveryHandoff {
|
|
228
242
|
readonly status: GoalDeliveryHandoffStatus;
|
|
243
|
+
/** 交付模式;缺省 'merge'。 */
|
|
244
|
+
readonly deliveryMode?: GoalDeliveryMode;
|
|
229
245
|
readonly repoId?: string;
|
|
230
246
|
readonly targetBranch?: string;
|
|
231
247
|
readonly taskBranch?: string;
|
|
232
248
|
readonly commitSha?: string;
|
|
233
249
|
readonly stoppedReason?: string;
|
|
250
|
+
/**
|
|
251
|
+
* ADR 69:合回分流 verdict。CONFLICT 时 status 为 'stopped' 且 conflicts 非空,
|
|
252
|
+
* 供收口视图批量呈现;AUTO_CLEAN/AUTO_MERGE/STALE 由系统消化,不进「需要你」。
|
|
253
|
+
*/
|
|
254
|
+
readonly verdict?: GoalDeliveryHandoffVerdict;
|
|
255
|
+
/** CONFLICT 时的真冲突文件清单(同名文件内容不同,合并会覆盖工作区)。 */
|
|
256
|
+
readonly conflicts?: readonly GoalDeliveryConflict[];
|
|
234
257
|
readonly updatedAt: string;
|
|
235
258
|
}
|
|
259
|
+
/** ADR 69:合回分流五类判定。 */
|
|
260
|
+
export type GoalDeliveryHandoffVerdict = 'AUTO_CLEAN' | 'AUTO_MERGE' | 'STALE' | 'CONFLICT' | 'BLOCKED_ENV';
|
|
261
|
+
/** 一条真冲突:任务线与目标工作区在同一未跟踪路径上内容不同。 */
|
|
262
|
+
export interface GoalDeliveryConflict {
|
|
263
|
+
readonly path: string;
|
|
264
|
+
/** 工作区版本的 blob 摘要(用于展示/区分)。 */
|
|
265
|
+
readonly worktreeBlob?: string;
|
|
266
|
+
/** 任务线版本的 blob 摘要。 */
|
|
267
|
+
readonly taskBlob?: string;
|
|
268
|
+
}
|
|
236
269
|
export type GoalQualityCheckStatus = 'passed' | 'failed' | 'skipped';
|
|
237
270
|
/** 用户可见的通俗检查记录;内部四层检查名不进界面。 */
|
|
238
271
|
export interface GoalQualityCheck {
|
|
@@ -652,7 +685,7 @@ export interface GoalPlan {
|
|
|
652
685
|
*/
|
|
653
686
|
readonly userOverride?: boolean;
|
|
654
687
|
};
|
|
655
|
-
/**
|
|
688
|
+
/** 合并进目标分支的结果;缺字段表示尚未合回。展示不要求先验收。 */
|
|
656
689
|
readonly deliveryHandoff?: GoalDeliveryHandoff;
|
|
657
690
|
/** 对齐 system-context.ts 的 epoch */
|
|
658
691
|
readonly promptContextEpochId?: string;
|
package/dist/goal.js
CHANGED
|
@@ -57,52 +57,117 @@ function handoffTargetLabel(handoff) {
|
|
|
57
57
|
return repo;
|
|
58
58
|
return undefined;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function compactBranchName(value) {
|
|
61
|
+
const branch = typeof value === 'string' ? value.trim() : '';
|
|
62
|
+
if (!branch)
|
|
63
|
+
return undefined;
|
|
64
|
+
return branch.replace(/^PeerAgent\//, '') || branch;
|
|
65
|
+
}
|
|
66
|
+
function compactHandoffBranch(handoff) {
|
|
67
|
+
return compactBranchName(handoff.targetBranch);
|
|
68
|
+
}
|
|
69
|
+
function handoffStoppedReasonLabel(reason, locale, branch) {
|
|
70
|
+
const dest = branch || (locale === 'zh' ? '源头' : 'the source line');
|
|
61
71
|
switch (reason) {
|
|
62
72
|
case 'target_branch_moved':
|
|
63
|
-
return locale === 'zh' ?
|
|
73
|
+
return locale === 'zh' ? `${dest} 已更新` : 'target branch moved';
|
|
64
74
|
case 'same_target_busy':
|
|
65
|
-
return locale === 'zh' ?
|
|
75
|
+
return locale === 'zh' ? `同一目标正在合进 ${dest}` : 'same target is merging';
|
|
66
76
|
case 'merge_conflict':
|
|
67
|
-
return locale === 'zh' ?
|
|
77
|
+
return locale === 'zh' ? `合并进 ${dest} 时发生冲突` : 'merge into source conflicted';
|
|
68
78
|
case 'target_checkout_dirty':
|
|
69
79
|
return locale === 'zh'
|
|
70
|
-
?
|
|
71
|
-
:
|
|
80
|
+
? `你正在 ${dest} 上改别的东西,还没提交。没法把这条任务合进去。`
|
|
81
|
+
: `You still have uncommitted work on ${dest}, so this task cannot merge in.`;
|
|
72
82
|
case 'git_timeout':
|
|
73
|
-
return locale === 'zh' ?
|
|
83
|
+
return locale === 'zh' ? `合并进 ${dest} 超时,可重试` : 'merge timed out; retry available';
|
|
74
84
|
case 'git_lock':
|
|
75
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';
|
|
76
98
|
default:
|
|
77
|
-
return locale === 'zh' ?
|
|
99
|
+
return locale === 'zh' ? `合不进 ${dest}` : `cannot merge into ${dest}`;
|
|
78
100
|
}
|
|
79
101
|
}
|
|
102
|
+
function hasDeliveryLine(input) {
|
|
103
|
+
return Boolean(input.deliveryBinding?.taskBranch?.trim())
|
|
104
|
+
|| input.deliveryBinding?.executionIsolation === 'worktree';
|
|
105
|
+
}
|
|
80
106
|
/**
|
|
81
|
-
*
|
|
107
|
+
* 用户可见的合回状态。没交付线时不展示;停住/进行中不必先验收。
|
|
82
108
|
*/
|
|
83
109
|
export function formatGoalDeliveryHandoff(input, options) {
|
|
84
110
|
const locale = options?.locale === 'en' ? 'en' : 'zh';
|
|
85
|
-
|
|
86
|
-
if (typeof acceptedAt !== 'string' || !acceptedAt.trim())
|
|
87
|
-
return undefined;
|
|
88
|
-
const hasTaskLine = Boolean(input.deliveryBinding?.taskBranch?.trim());
|
|
89
|
-
const isolated = input.deliveryBinding?.executionIsolation === 'worktree';
|
|
90
|
-
if (!hasTaskLine && !isolated)
|
|
111
|
+
if (!hasDeliveryLine(input))
|
|
91
112
|
return undefined;
|
|
92
113
|
const handoff = input.deliveryHandoff;
|
|
93
114
|
if (!handoff?.status || handoff.status === 'idle')
|
|
94
115
|
return undefined;
|
|
95
116
|
const target = handoffTargetLabel(handoff);
|
|
117
|
+
const branch = compactHandoffBranch(handoff)
|
|
118
|
+
?? compactBranchName(input.deliveryBinding?.targetBranch);
|
|
96
119
|
if (handoff.status === 'delivering') {
|
|
97
|
-
return locale === 'zh'
|
|
120
|
+
return locale === 'zh'
|
|
121
|
+
? (branch ? `正在合进 ${branch}` : '正在合进源头')
|
|
122
|
+
: (branch ? `merging into ${branch}` : 'merging into source');
|
|
98
123
|
}
|
|
99
124
|
if (handoff.status === 'delivered') {
|
|
125
|
+
// ADR 68:direct 交付没有「合」的动作,用词区分,避免暗示存在合并。
|
|
126
|
+
if (handoff.deliveryMode === 'direct') {
|
|
127
|
+
return target
|
|
128
|
+
? (locale === 'zh' ? `已随 ${target} 交付` : `delivered with ${target}`)
|
|
129
|
+
: (locale === 'zh' ? '已随源头交付' : 'delivered with source');
|
|
130
|
+
}
|
|
100
131
|
return target
|
|
101
|
-
? (locale === 'zh' ?
|
|
102
|
-
: (locale === 'zh' ? '
|
|
132
|
+
? (locale === 'zh' ? `已合进 ${target}` : `merged into ${target}`)
|
|
133
|
+
: (locale === 'zh' ? '已合进源头' : 'merged into source');
|
|
134
|
+
}
|
|
135
|
+
if (handoff.status === 'stopped') {
|
|
136
|
+
return handoffStoppedReasonLabel(handoff.stoppedReason, locale, branch);
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
/** 灯条用的短合回状态:合不进 / 还没归档 / 已归档到源头。 */
|
|
141
|
+
export function formatGoalDeliveryHandoffLamp(input, options) {
|
|
142
|
+
const locale = options?.locale === 'en' ? 'en' : 'zh';
|
|
143
|
+
if (!hasDeliveryLine(input))
|
|
144
|
+
return undefined;
|
|
145
|
+
const dest = compactBranchName(input.deliveryHandoff?.targetBranch)
|
|
146
|
+
?? compactBranchName(input.deliveryBinding?.targetBranch)
|
|
147
|
+
?? (locale === 'zh' ? '源头' : 'source');
|
|
148
|
+
const handoff = input.deliveryHandoff;
|
|
149
|
+
if (!handoff?.status || handoff.status === 'idle') {
|
|
150
|
+
// ADR 68:非隔离计划(无交付线语义)不显示「还没进」——它的完成即交付,没有待合回的工作。
|
|
151
|
+
const isolated = input.deliveryBinding?.executionIsolation === 'worktree';
|
|
152
|
+
const directCandidate = !isolated && input.status === 'completed';
|
|
153
|
+
if (directCandidate)
|
|
154
|
+
return undefined;
|
|
155
|
+
if (input.status === 'completed') {
|
|
156
|
+
return locale === 'zh' ? `还没进 ${dest}` : `not on ${dest}`;
|
|
157
|
+
}
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
if (handoff.status === 'delivering') {
|
|
161
|
+
return locale === 'zh' ? `正在合进 ${dest}` : `merging into ${dest}`;
|
|
162
|
+
}
|
|
163
|
+
if (handoff.status === 'delivered') {
|
|
164
|
+
if (handoff.deliveryMode === 'direct') {
|
|
165
|
+
return locale === 'zh' ? `已随 ${dest} 交付` : `delivered with ${dest}`;
|
|
166
|
+
}
|
|
167
|
+
return locale === 'zh' ? `已归档到 ${dest}` : `archived to ${dest}`;
|
|
103
168
|
}
|
|
104
169
|
if (handoff.status === 'stopped') {
|
|
105
|
-
return
|
|
170
|
+
return locale === 'zh' ? `合不进 ${dest}` : `blocked from ${dest}`;
|
|
106
171
|
}
|
|
107
172
|
return undefined;
|
|
108
173
|
}
|
|
@@ -41,16 +41,14 @@ export interface SkillMarketplaceInstallResult {
|
|
|
41
41
|
readonly error?: string;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* SkillHub 官方列表排序(GET /api/skills?sortBy=):
|
|
45
45
|
* - score: 全部 / 综合评分
|
|
46
|
-
* - featured: 推荐精选(认证优先,再按评分)
|
|
47
|
-
* - rising: 近期飙升(近期更新 + 下载量,本地近似)
|
|
48
46
|
* - downloads: 下载量
|
|
49
47
|
* - stars: 收藏量
|
|
50
|
-
* -
|
|
51
|
-
* - updated:
|
|
48
|
+
* - installs: 安装量
|
|
49
|
+
* - updated: 最近更新(映射为官方 updated_at)
|
|
52
50
|
*/
|
|
53
|
-
export type SkillHubMarketplaceSort = 'score' | '
|
|
51
|
+
export type SkillHubMarketplaceSort = 'score' | 'downloads' | 'stars' | 'installs' | 'updated';
|
|
54
52
|
export interface SkillHubMarketplaceEntry {
|
|
55
53
|
readonly catalogId: string;
|
|
56
54
|
readonly namespace: string;
|
|
@@ -126,3 +124,92 @@ export interface SkillHubCategoriesResult {
|
|
|
126
124
|
readonly count: number;
|
|
127
125
|
readonly items: readonly SkillHubCategory[];
|
|
128
126
|
}
|
|
127
|
+
export type QoderMarketplaceSort = 'hot' | 'latest';
|
|
128
|
+
/** 筛选维度:category(20 个分类)/ output(9 种产物)/ client(5 个客户端)/ app_ecosystem(8 个生态)。 */
|
|
129
|
+
export type QoderTaxonomyDimension = 'category' | 'output' | 'client' | 'app_ecosystem';
|
|
130
|
+
export interface QoderTaxonomyItem {
|
|
131
|
+
readonly dimension: QoderTaxonomyDimension;
|
|
132
|
+
/** 传回列表接口的 code(如 "Coding"、"document"、"github")。 */
|
|
133
|
+
readonly code: string;
|
|
134
|
+
/** 本地化标签:taxonomies 接口支持 Accept-Language: zh,直接返回中文(如「办公效率」)。 */
|
|
135
|
+
readonly label: string;
|
|
136
|
+
readonly description: string;
|
|
137
|
+
readonly sortOrder: number;
|
|
138
|
+
}
|
|
139
|
+
export interface QoderTaxonomiesResult {
|
|
140
|
+
readonly count: number;
|
|
141
|
+
readonly items: readonly QoderTaxonomyItem[];
|
|
142
|
+
}
|
|
143
|
+
export interface QoderMarketplaceEntry {
|
|
144
|
+
readonly skillId: string;
|
|
145
|
+
readonly name: string;
|
|
146
|
+
readonly nameCn: string;
|
|
147
|
+
readonly description: string;
|
|
148
|
+
readonly descriptionCn: string;
|
|
149
|
+
readonly iconUrl: string | null;
|
|
150
|
+
readonly author: string;
|
|
151
|
+
readonly authorName: string;
|
|
152
|
+
readonly installCount: number;
|
|
153
|
+
readonly category: string;
|
|
154
|
+
/** epoch 毫秒(接口返回字符串) */
|
|
155
|
+
readonly contentUpdatedAt: number;
|
|
156
|
+
}
|
|
157
|
+
export interface QoderMarketplaceQuery {
|
|
158
|
+
readonly keyword?: string;
|
|
159
|
+
readonly page?: number;
|
|
160
|
+
readonly pageSize?: number;
|
|
161
|
+
readonly sortBy?: QoderMarketplaceSort;
|
|
162
|
+
/** 分类筛选(如 ['Coding'];多值为 AND 关系,服务端语义)。 */
|
|
163
|
+
readonly categories?: readonly string[];
|
|
164
|
+
/** 产物类型筛选(如 ['document','code'])。 */
|
|
165
|
+
readonly outputs?: readonly string[];
|
|
166
|
+
/** 客户端筛选(如 ['qoder'])。 */
|
|
167
|
+
readonly clients?: readonly string[];
|
|
168
|
+
/** App 生态筛选(如 ['github','feishu'])。 */
|
|
169
|
+
readonly appEcosystems?: readonly string[];
|
|
170
|
+
}
|
|
171
|
+
export interface QoderMarketplacePage {
|
|
172
|
+
readonly currentPage: number;
|
|
173
|
+
readonly nextPage: number | null;
|
|
174
|
+
readonly lastPage: number;
|
|
175
|
+
readonly pageSize: number;
|
|
176
|
+
readonly totalSize: number;
|
|
177
|
+
readonly items: readonly QoderMarketplaceEntry[];
|
|
178
|
+
}
|
|
179
|
+
export interface QoderMarketplaceFileNode {
|
|
180
|
+
readonly name: string;
|
|
181
|
+
readonly path: string;
|
|
182
|
+
readonly type: 'directory' | 'file';
|
|
183
|
+
readonly size: number;
|
|
184
|
+
readonly files: readonly QoderMarketplaceFileNode[];
|
|
185
|
+
}
|
|
186
|
+
export interface QoderMarketplaceSkillDetail {
|
|
187
|
+
readonly skillId: string;
|
|
188
|
+
readonly name: string;
|
|
189
|
+
readonly nameCn: string;
|
|
190
|
+
readonly description: string;
|
|
191
|
+
readonly descriptionCn: string;
|
|
192
|
+
readonly iconUrl: string | null;
|
|
193
|
+
readonly author: string;
|
|
194
|
+
readonly authorName: string;
|
|
195
|
+
readonly installCount: number;
|
|
196
|
+
readonly category: string;
|
|
197
|
+
readonly version: string;
|
|
198
|
+
readonly downloadUrl: string;
|
|
199
|
+
readonly githubPath: string | null;
|
|
200
|
+
readonly skillMd: string | null;
|
|
201
|
+
readonly fileTree: QoderMarketplaceFileNode | null;
|
|
202
|
+
}
|
|
203
|
+
export type QoderInstallScope = 'global' | 'workspace';
|
|
204
|
+
export interface QoderInstallIdentity {
|
|
205
|
+
readonly skillId: string;
|
|
206
|
+
readonly scope?: QoderInstallScope;
|
|
207
|
+
readonly iconUrl?: string | null;
|
|
208
|
+
}
|
|
209
|
+
export interface QoderInstallResult {
|
|
210
|
+
readonly ok: boolean;
|
|
211
|
+
readonly skillId: string;
|
|
212
|
+
readonly installedSkillId: string;
|
|
213
|
+
readonly version: string;
|
|
214
|
+
readonly scope: QoderInstallScope;
|
|
215
|
+
}
|
package/dist/system-context.d.ts
CHANGED
|
@@ -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;
|
package/dist/task-overview.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ import type { AutomationLifecycleStatus, AutomationRunStatus } from './automatio
|
|
|
25
25
|
*
|
|
26
26
|
* - needs_you:阻塞点在用户(待批准 / 待授权 / 待回答 / 待决策)。
|
|
27
27
|
* - peer_advancing:Peer 正在推进,用户无需介入。
|
|
28
|
-
* - result_ready:遗留行动权(Goal
|
|
28
|
+
* - result_ready:遗留行动权(Goal 完成不再进入;合回中改挂 peer_advancing / needs_you)。
|
|
29
29
|
* - paused:用户或系统主动暂停,等待恢复。
|
|
30
30
|
* - terminal:终态,进历史页。
|
|
31
31
|
*/
|
|
@@ -119,11 +119,30 @@ export interface TaskOverviewItem {
|
|
|
119
119
|
*/
|
|
120
120
|
readonly deliveryRoute?: string;
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
122
|
+
* 用户可见的合回状态:已合进 / 正在合进 / 停止原因。
|
|
123
|
+
* 没交付线时不出现;停住/进行中不必先验收。
|
|
124
124
|
*/
|
|
125
125
|
readonly deliveryHandoffLabel?: string;
|
|
126
126
|
readonly deliveryHandoffStatus?: GoalDeliveryHandoffStatus;
|
|
127
|
+
/** 合回目标分支;聚合层用它把同一源头的环境挡收成一张卡。 */
|
|
128
|
+
readonly deliveryTargetBranch?: string;
|
|
129
|
+
/** 合回停住原因;与目标分支一起作为环境挡去重键。 */
|
|
130
|
+
readonly deliveryHandoffStoppedReason?: string;
|
|
131
|
+
/**
|
|
132
|
+
* 源头环境挡卡:被同一源头挡住的任务线。有值时这张卡代表源头,不是某条 Goal 会话。
|
|
133
|
+
* 主按钮应打开被挡任务对应的对话,而不是原地结束。
|
|
134
|
+
*/
|
|
135
|
+
readonly blockedPlanIds?: readonly string[];
|
|
136
|
+
/** 被挡任务线标题,供源头卡展开「都有哪些」。 */
|
|
137
|
+
readonly blockedPlanTitles?: readonly string[];
|
|
138
|
+
/** 源头工作区绝对路径;源头动作(列脏文件 / 提交 / stash / 批量再合)用它,不跟会话走。 */
|
|
139
|
+
readonly deliveryWorkspacePath?: string;
|
|
140
|
+
/** ADR 69:分流 verdict;CONFLICT 时配合 deliveryHandoffConflicts 渲染收口面板。 */
|
|
141
|
+
readonly deliveryHandoffVerdict?: string;
|
|
142
|
+
/** ADR 69:CONFLICT 时的真冲突文件清单(同名文件内容不同)。 */
|
|
143
|
+
readonly deliveryHandoffConflicts?: readonly {
|
|
144
|
+
readonly path: string;
|
|
145
|
+
}[];
|
|
127
146
|
/** 状态描述(原型卡片中部,如「Peer 正在验证」「等待权限」)。 */
|
|
128
147
|
readonly statusLabel: string;
|
|
129
148
|
/** 执行异常的可展示原因;仅异常/暂停投影存在,不承载控制状态。 */
|
|
@@ -227,6 +246,11 @@ export interface GoalPlanProjectionSnapshot {
|
|
|
227
246
|
readonly runnerStatus?: GoalRunnerStatus;
|
|
228
247
|
/** Runner 阻塞是否由系统基础设施持有,而不是用户行动权。 */
|
|
229
248
|
readonly systemBlocked?: boolean;
|
|
249
|
+
/**
|
|
250
|
+
* 同一会话此刻是否有前台活流(正在输出 / 调工具 / compact)。
|
|
251
|
+
* 由聚合层从 listActiveStreams 写入;协议层只认这个布尔事实。
|
|
252
|
+
*/
|
|
253
|
+
readonly conversationLive?: boolean;
|
|
230
254
|
/** Runner 上存在尚未被 resume 消费的网络/流式中断事实。 */
|
|
231
255
|
readonly interrupted?: boolean;
|
|
232
256
|
/** 持久化中断事实中的用户可展示原因。 */
|
|
@@ -235,9 +259,19 @@ export interface GoalPlanProjectionSnapshot {
|
|
|
235
259
|
readonly workspaceLabel?: string;
|
|
236
260
|
/** 用户可见的交付路由;缺目标分支时写「未确认」。 */
|
|
237
261
|
readonly deliveryRoute?: string;
|
|
238
|
-
/**
|
|
262
|
+
/** 用户可见的合回状态;没交付线时省略。 */
|
|
239
263
|
readonly deliveryHandoffLabel?: string;
|
|
240
264
|
readonly deliveryHandoffStatus?: GoalDeliveryHandoffStatus;
|
|
265
|
+
readonly deliveryTargetBranch?: string;
|
|
266
|
+
readonly deliveryHandoffStoppedReason?: string;
|
|
267
|
+
readonly blockedPlanIds?: readonly string[];
|
|
268
|
+
readonly blockedPlanTitles?: readonly string[];
|
|
269
|
+
readonly deliveryWorkspacePath?: string;
|
|
270
|
+
/** ADR 69:分流 verdict / CONFLICT 冲突清单(快照透传,供 projectGoalPlan 组装)。 */
|
|
271
|
+
readonly deliveryHandoffVerdict?: string;
|
|
272
|
+
readonly deliveryHandoffConflicts?: readonly {
|
|
273
|
+
readonly path: string;
|
|
274
|
+
}[];
|
|
241
275
|
readonly progress?: {
|
|
242
276
|
readonly completed: number;
|
|
243
277
|
readonly total: number;
|
|
@@ -263,7 +297,7 @@ export interface GoalPlanProjectionSnapshot {
|
|
|
263
297
|
readonly providerLabel?: string;
|
|
264
298
|
/**
|
|
265
299
|
* 遗留字段:用户验收戳。Goal 完成不再据此进入 result_ready;
|
|
266
|
-
*
|
|
300
|
+
* 完成即终态,合回/自检未结束仍走 peer_advancing 或 needs_you。
|
|
267
301
|
*/
|
|
268
302
|
readonly accepted?: boolean;
|
|
269
303
|
/** 有代码副作用时,完成门之后还要质量自检过线才能进终态。 */
|
|
@@ -341,7 +375,7 @@ export declare function projectConversation(snapshot: ConversationProjectionSnap
|
|
|
341
375
|
* 4. runner waiting_user → needs_you/user_input
|
|
342
376
|
* 5. runner blocked | budget_exhausted → needs_you/decision
|
|
343
377
|
* 6. plan completed:
|
|
344
|
-
* -
|
|
378
|
+
* - 合回进行中 → peer_advancing;合回失败 → needs_you/decision
|
|
345
379
|
* - 否则直接 terminal(不再因未验收 / 自检缺口进入 result_ready)
|
|
346
380
|
* 8. plan executing → peer_advancing
|
|
347
381
|
* 9. runner running/compacting/resuming/exploring → peer_advancing
|
package/dist/task-overview.js
CHANGED
|
@@ -79,7 +79,7 @@ export function projectConversation(snapshot) {
|
|
|
79
79
|
* 4. runner waiting_user → needs_you/user_input
|
|
80
80
|
* 5. runner blocked | budget_exhausted → needs_you/decision
|
|
81
81
|
* 6. plan completed:
|
|
82
|
-
* -
|
|
82
|
+
* - 合回进行中 → peer_advancing;合回失败 → needs_you/decision
|
|
83
83
|
* - 否则直接 terminal(不再因未验收 / 自检缺口进入 result_ready)
|
|
84
84
|
* 8. plan executing → peer_advancing
|
|
85
85
|
* 9. runner running/compacting/resuming/exploring → peer_advancing
|
|
@@ -139,6 +139,17 @@ export function projectGoalPlan(snapshot, options) {
|
|
|
139
139
|
...(snapshot.deliveryRoute ? { deliveryRoute: snapshot.deliveryRoute } : {}),
|
|
140
140
|
...(snapshot.deliveryHandoffLabel ? { deliveryHandoffLabel: snapshot.deliveryHandoffLabel } : {}),
|
|
141
141
|
...(snapshot.deliveryHandoffStatus ? { deliveryHandoffStatus: snapshot.deliveryHandoffStatus } : {}),
|
|
142
|
+
...(snapshot.deliveryTargetBranch ? { deliveryTargetBranch: snapshot.deliveryTargetBranch } : {}),
|
|
143
|
+
...(snapshot.deliveryHandoffStoppedReason
|
|
144
|
+
? { deliveryHandoffStoppedReason: snapshot.deliveryHandoffStoppedReason }
|
|
145
|
+
: {}),
|
|
146
|
+
...(snapshot.blockedPlanIds?.length ? { blockedPlanIds: snapshot.blockedPlanIds } : {}),
|
|
147
|
+
...(snapshot.blockedPlanTitles?.length ? { blockedPlanTitles: snapshot.blockedPlanTitles } : {}),
|
|
148
|
+
...(snapshot.deliveryWorkspacePath ? { deliveryWorkspacePath: snapshot.deliveryWorkspacePath } : {}),
|
|
149
|
+
...(snapshot.deliveryHandoffVerdict ? { deliveryHandoffVerdict: snapshot.deliveryHandoffVerdict } : {}),
|
|
150
|
+
...(snapshot.deliveryHandoffConflicts?.length
|
|
151
|
+
? { deliveryHandoffConflicts: snapshot.deliveryHandoffConflicts }
|
|
152
|
+
: {}),
|
|
142
153
|
...(snapshot.requiresQualityReview ? { requiresQualityReview: true } : {}),
|
|
143
154
|
...(snapshot.qualityReviewStatus ? { qualityReviewStatus: snapshot.qualityReviewStatus } : {}),
|
|
144
155
|
...(snapshot.qualityChecks?.length ? { qualityChecks: snapshot.qualityChecks } : {}),
|
|
@@ -163,8 +174,11 @@ export function projectGoalPlan(snapshot, options) {
|
|
|
163
174
|
...(snapshot.conversationId ? { conversationId: snapshot.conversationId } : {}),
|
|
164
175
|
};
|
|
165
176
|
}
|
|
177
|
+
function isDigestibleHandoffVerdict(verdict) {
|
|
178
|
+
return verdict === 'AUTO_CLEAN' || verdict === 'STALE';
|
|
179
|
+
}
|
|
166
180
|
function decideGoalPlan(snapshot) {
|
|
167
|
-
const { status, runnerStatus, interrupted, deliveryHandoffStatus } = snapshot;
|
|
181
|
+
const { status, runnerStatus, interrupted, deliveryHandoffStatus, deliveryHandoffVerdict } = snapshot;
|
|
168
182
|
// 未消费的网络/流式中断是当前行动权事实,优先于 completed/result_ready。
|
|
169
183
|
// 用户显式 resume 后 store 会原子清除此事实,再按正常计划状态投影。
|
|
170
184
|
if (interrupted === true) {
|
|
@@ -193,20 +207,29 @@ function decideGoalPlan(snapshot) {
|
|
|
193
207
|
if (status === 'completed') {
|
|
194
208
|
if (deliveryHandoffStatus && deliveryHandoffStatus !== 'delivered') {
|
|
195
209
|
if (deliveryHandoffStatus === 'stopped') {
|
|
210
|
+
// ADR 69:空壳/过时由系统消化,不再占「需要你」。
|
|
211
|
+
if (isDigestibleHandoffVerdict(deliveryHandoffVerdict)) {
|
|
212
|
+
return {
|
|
213
|
+
actionRight: 'terminal',
|
|
214
|
+
nextAction: 'none',
|
|
215
|
+
statusLabel: '已完成',
|
|
216
|
+
actionLabel: '查看 →',
|
|
217
|
+
};
|
|
218
|
+
}
|
|
196
219
|
return {
|
|
197
220
|
actionRight: 'needs_you',
|
|
198
221
|
needsYouReason: 'decision',
|
|
199
222
|
nextAction: 'decide_blocked',
|
|
200
|
-
statusLabel: '
|
|
223
|
+
statusLabel: '合不进源头',
|
|
201
224
|
actionLabel: '查看进度',
|
|
202
225
|
};
|
|
203
226
|
}
|
|
204
|
-
//
|
|
227
|
+
// 只有真实合回进行中才占工作台。仅有 deliveryRoute 不算正在合进。
|
|
205
228
|
if (deliveryHandoffStatus === 'delivering' || deliveryHandoffStatus === 'idle') {
|
|
206
229
|
return {
|
|
207
230
|
actionRight: 'peer_advancing',
|
|
208
231
|
nextAction: 'none',
|
|
209
|
-
statusLabel: '
|
|
232
|
+
statusLabel: '正在合进源头',
|
|
210
233
|
actionLabel: '查看 →',
|
|
211
234
|
};
|
|
212
235
|
}
|
|
@@ -247,11 +270,13 @@ function decideGoalPlan(snapshot) {
|
|
|
247
270
|
};
|
|
248
271
|
}
|
|
249
272
|
const planStillActive = status === 'executing' || status === 'accepted' || status === 'approved';
|
|
273
|
+
const conversationLive = snapshot.conversationLive === true;
|
|
250
274
|
const recoverableSystemBlocked = runnerStatus === 'blocked'
|
|
251
275
|
&& snapshot.systemBlocked === true;
|
|
252
276
|
// System infrastructure failures are not user decisions. A foreground turn may
|
|
253
277
|
// take over this blocker; until then expose an inspectable interruption.
|
|
254
|
-
|
|
278
|
+
// A live foreground stream already holds execution — do not keep asking the user.
|
|
279
|
+
if (planStillActive && recoverableSystemBlocked && !conversationLive) {
|
|
255
280
|
return {
|
|
256
281
|
actionRight: 'paused',
|
|
257
282
|
nextAction: 'inspect',
|
|
@@ -260,6 +285,7 @@ function decideGoalPlan(snapshot) {
|
|
|
260
285
|
};
|
|
261
286
|
}
|
|
262
287
|
// rule 4: Runner 已明确把行动权交给用户,不再展示为“Peer 正在推进”。
|
|
288
|
+
// waiting_user is a precise question; a live stream must not swallow it.
|
|
263
289
|
if (planStillActive && runnerStatus === 'waiting_user') {
|
|
264
290
|
return {
|
|
265
291
|
actionRight: 'needs_you',
|
|
@@ -271,7 +297,9 @@ function decideGoalPlan(snapshot) {
|
|
|
271
297
|
}
|
|
272
298
|
// rule 5: 仅活跃计划上的 Runner 实时求助才进 needs_you
|
|
273
299
|
// (plan 必须仍在推进:executing/accepted/approved;历史僵尸 blocked 不进)
|
|
300
|
+
// 同一会话已有前台活流时,执行权在会话里,不要把过期 blocked 投成决策卡。
|
|
274
301
|
if (planStillActive &&
|
|
302
|
+
!conversationLive &&
|
|
275
303
|
(runnerStatus === 'blocked' || runnerStatus === 'budget_exhausted')) {
|
|
276
304
|
return {
|
|
277
305
|
actionRight: 'needs_you',
|