@peer-agent/protocol 0.0.7 → 0.0.9
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/acceptance-close-gate.d.ts +6 -0
- package/dist/acceptance-close-gate.js +5 -3
- package/dist/goal.d.ts +41 -3
- package/dist/goal.js +72 -19
- package/dist/skill-marketplace.d.ts +93 -6
- package/dist/task-overview.d.ts +46 -18
- package/dist/task-overview.js +58 -43
- package/package.json +1 -1
|
@@ -26,6 +26,11 @@ export interface AcceptanceClosePlanLike {
|
|
|
26
26
|
readonly evidenceRefs?: readonly string[] | null;
|
|
27
27
|
}[] | null;
|
|
28
28
|
} | null;
|
|
29
|
+
readonly resultAcceptance?: {
|
|
30
|
+
readonly acceptedAt?: string | null;
|
|
31
|
+
readonly acceptedBy?: string | null;
|
|
32
|
+
readonly userOverride?: boolean | null;
|
|
33
|
+
} | null;
|
|
29
34
|
}
|
|
30
35
|
export declare class AcceptanceCloseGateError extends Error {
|
|
31
36
|
readonly code = "acceptance_evidence_incomplete";
|
|
@@ -46,4 +51,5 @@ export declare function isAcceptanceClosePatch(previous: {
|
|
|
46
51
|
readonly acceptedAt?: string | null;
|
|
47
52
|
} | null | undefined, next: {
|
|
48
53
|
readonly acceptedAt?: string | null;
|
|
54
|
+
readonly userOverride?: boolean | null;
|
|
49
55
|
} | null | undefined): boolean;
|
|
@@ -55,13 +55,15 @@ function gapMessage(gaps, locale) {
|
|
|
55
55
|
if (gaps.length === 0)
|
|
56
56
|
return '';
|
|
57
57
|
if (locale === 'en') {
|
|
58
|
-
|
|
58
|
+
const head = gaps.length === 1
|
|
59
59
|
? `Cannot accept yet: ${gaps[0].description} still lacks resolvable evidence.`
|
|
60
60
|
: `Cannot accept yet: ${gaps.length} success criteria still lack resolvable evidence.`;
|
|
61
|
+
return `${head} Use Follow up to reopen the task and supply the missing evidence.`;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
const head = gaps.length === 1
|
|
63
64
|
? `还不能验收:${gaps[0].description} 还缺可解析的对照证据。`
|
|
64
65
|
: `还不能验收:还有 ${gaps.length} 条成功标准缺少可解析的对照证据。`;
|
|
66
|
+
return `${head} 点「继续追问」重开任务去补证据。`;
|
|
65
67
|
}
|
|
66
68
|
export function evaluateAcceptanceCloseGate(plan, options = {}) {
|
|
67
69
|
const locale = options.locale === 'en' ? 'en' : 'zh';
|
|
@@ -106,7 +108,7 @@ export function evaluateAcceptanceCloseGate(plan, options = {}) {
|
|
|
106
108
|
}
|
|
107
109
|
export function assertAcceptanceCloseGate(plan, options = {}) {
|
|
108
110
|
const verdict = evaluateAcceptanceCloseGate(plan, options);
|
|
109
|
-
if (!verdict.ok) {
|
|
111
|
+
if (!verdict.ok && plan?.resultAcceptance?.userOverride !== true) {
|
|
110
112
|
throw new AcceptanceCloseGateError(verdict.message, verdict.gaps);
|
|
111
113
|
}
|
|
112
114
|
}
|
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 {
|
|
@@ -646,8 +679,13 @@ export interface GoalPlan {
|
|
|
646
679
|
readonly resultAcceptance?: {
|
|
647
680
|
readonly acceptedAt: string;
|
|
648
681
|
readonly acceptedBy?: 'user' | string;
|
|
682
|
+
/**
|
|
683
|
+
* 用户在证据不全时二次确认后的强制归档覆盖。
|
|
684
|
+
* 为 true 时关闭门禁可放行,但仍应保留缺口提示供事后回看。
|
|
685
|
+
*/
|
|
686
|
+
readonly userOverride?: boolean;
|
|
649
687
|
};
|
|
650
|
-
/**
|
|
688
|
+
/** 合并进目标分支的结果;缺字段表示尚未合回。展示不要求先验收。 */
|
|
651
689
|
readonly deliveryHandoff?: GoalDeliveryHandoff;
|
|
652
690
|
/** 对齐 system-context.ts 的 epoch */
|
|
653
691
|
readonly promptContextEpochId?: string;
|
package/dist/goal.js
CHANGED
|
@@ -57,52 +57,105 @@ 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';
|
|
76
86
|
default:
|
|
77
|
-
return locale === 'zh' ?
|
|
87
|
+
return locale === 'zh' ? `合不进 ${dest}` : `cannot merge into ${dest}`;
|
|
78
88
|
}
|
|
79
89
|
}
|
|
90
|
+
function hasDeliveryLine(input) {
|
|
91
|
+
return Boolean(input.deliveryBinding?.taskBranch?.trim())
|
|
92
|
+
|| input.deliveryBinding?.executionIsolation === 'worktree';
|
|
93
|
+
}
|
|
80
94
|
/**
|
|
81
|
-
*
|
|
95
|
+
* 用户可见的合回状态。没交付线时不展示;停住/进行中不必先验收。
|
|
82
96
|
*/
|
|
83
97
|
export function formatGoalDeliveryHandoff(input, options) {
|
|
84
98
|
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)
|
|
99
|
+
if (!hasDeliveryLine(input))
|
|
91
100
|
return undefined;
|
|
92
101
|
const handoff = input.deliveryHandoff;
|
|
93
102
|
if (!handoff?.status || handoff.status === 'idle')
|
|
94
103
|
return undefined;
|
|
95
104
|
const target = handoffTargetLabel(handoff);
|
|
105
|
+
const branch = compactHandoffBranch(handoff)
|
|
106
|
+
?? compactBranchName(input.deliveryBinding?.targetBranch);
|
|
96
107
|
if (handoff.status === 'delivering') {
|
|
97
|
-
return locale === 'zh'
|
|
108
|
+
return locale === 'zh'
|
|
109
|
+
? (branch ? `正在合进 ${branch}` : '正在合进源头')
|
|
110
|
+
: (branch ? `merging into ${branch}` : 'merging into source');
|
|
98
111
|
}
|
|
99
112
|
if (handoff.status === 'delivered') {
|
|
113
|
+
// ADR 68:direct 交付没有「合」的动作,用词区分,避免暗示存在合并。
|
|
114
|
+
if (handoff.deliveryMode === 'direct') {
|
|
115
|
+
return target
|
|
116
|
+
? (locale === 'zh' ? `已随 ${target} 交付` : `delivered with ${target}`)
|
|
117
|
+
: (locale === 'zh' ? '已随源头交付' : 'delivered with source');
|
|
118
|
+
}
|
|
100
119
|
return target
|
|
101
|
-
? (locale === 'zh' ?
|
|
102
|
-
: (locale === 'zh' ? '
|
|
120
|
+
? (locale === 'zh' ? `已合进 ${target}` : `merged into ${target}`)
|
|
121
|
+
: (locale === 'zh' ? '已合进源头' : 'merged into source');
|
|
122
|
+
}
|
|
123
|
+
if (handoff.status === 'stopped') {
|
|
124
|
+
return handoffStoppedReasonLabel(handoff.stoppedReason, locale, branch);
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
/** 灯条用的短合回状态:合不进 / 还没进 / 已进源头。 */
|
|
129
|
+
export function formatGoalDeliveryHandoffLamp(input, options) {
|
|
130
|
+
const locale = options?.locale === 'en' ? 'en' : 'zh';
|
|
131
|
+
if (!hasDeliveryLine(input))
|
|
132
|
+
return undefined;
|
|
133
|
+
const dest = compactBranchName(input.deliveryHandoff?.targetBranch)
|
|
134
|
+
?? compactBranchName(input.deliveryBinding?.targetBranch)
|
|
135
|
+
?? (locale === 'zh' ? '源头' : 'source');
|
|
136
|
+
const handoff = input.deliveryHandoff;
|
|
137
|
+
if (!handoff?.status || handoff.status === 'idle') {
|
|
138
|
+
// ADR 68:非隔离计划(无交付线语义)不显示「还没进」——它的完成即交付,没有待合回的工作。
|
|
139
|
+
const isolated = input.deliveryBinding?.executionIsolation === 'worktree';
|
|
140
|
+
const directCandidate = !isolated && input.status === 'completed';
|
|
141
|
+
if (directCandidate)
|
|
142
|
+
return undefined;
|
|
143
|
+
if (input.status === 'completed') {
|
|
144
|
+
return locale === 'zh' ? `还没进 ${dest}` : `not on ${dest}`;
|
|
145
|
+
}
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
if (handoff.status === 'delivering') {
|
|
149
|
+
return locale === 'zh' ? `正在合进 ${dest}` : `merging into ${dest}`;
|
|
150
|
+
}
|
|
151
|
+
if (handoff.status === 'delivered') {
|
|
152
|
+
if (handoff.deliveryMode === 'direct') {
|
|
153
|
+
return locale === 'zh' ? `已随 ${dest} 交付` : `delivered with ${dest}`;
|
|
154
|
+
}
|
|
155
|
+
return locale === 'zh' ? `已进 ${dest}` : `on ${dest}`;
|
|
103
156
|
}
|
|
104
157
|
if (handoff.status === 'stopped') {
|
|
105
|
-
return
|
|
158
|
+
return locale === 'zh' ? `合不进 ${dest}` : `blocked from ${dest}`;
|
|
106
159
|
}
|
|
107
160
|
return undefined;
|
|
108
161
|
}
|
|
@@ -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/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
|
|
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
|
+
* 主按钮不得用 conversationId 打开聊天。
|
|
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
|
/** 执行异常的可展示原因;仅异常/暂停投影存在,不承载控制状态。 */
|
|
@@ -143,7 +162,7 @@ export interface TaskOverviewItem {
|
|
|
143
162
|
/**
|
|
144
163
|
* 任务完成时间(ISO 字符串)。
|
|
145
164
|
* GoalPlan:优先 GoalTiming.completedAt;终态缺省时回落 updatedAt。
|
|
146
|
-
*
|
|
165
|
+
* 历史完成卡片用它展示「何时完成」,与 lastActiveAt(最近活跃)语义分离。
|
|
147
166
|
*/
|
|
148
167
|
readonly completedAt?: string;
|
|
149
168
|
/**
|
|
@@ -176,8 +195,8 @@ export interface TaskOverviewItem {
|
|
|
176
195
|
readonly actionLabel: string;
|
|
177
196
|
/**
|
|
178
197
|
* 目标线(Goal Thread)关系 —— 仅 source === 'goal_plan' 且计划携带
|
|
179
|
-
* 关系字段时出现。UI 依据 rootPlanId
|
|
180
|
-
*
|
|
198
|
+
* 关系字段时出现。UI 依据 rootPlanId 把同线 Goal 归组;
|
|
199
|
+
* 缺字段的历史计划无这些键,仍按单卡平铺(向后兼容)。
|
|
181
200
|
*/
|
|
182
201
|
readonly rootPlanId?: string;
|
|
183
202
|
readonly parentPlanId?: string;
|
|
@@ -235,9 +254,19 @@ export interface GoalPlanProjectionSnapshot {
|
|
|
235
254
|
readonly workspaceLabel?: string;
|
|
236
255
|
/** 用户可见的交付路由;缺目标分支时写「未确认」。 */
|
|
237
256
|
readonly deliveryRoute?: string;
|
|
238
|
-
/**
|
|
257
|
+
/** 用户可见的合回状态;没交付线时省略。 */
|
|
239
258
|
readonly deliveryHandoffLabel?: string;
|
|
240
259
|
readonly deliveryHandoffStatus?: GoalDeliveryHandoffStatus;
|
|
260
|
+
readonly deliveryTargetBranch?: string;
|
|
261
|
+
readonly deliveryHandoffStoppedReason?: string;
|
|
262
|
+
readonly blockedPlanIds?: readonly string[];
|
|
263
|
+
readonly blockedPlanTitles?: readonly string[];
|
|
264
|
+
readonly deliveryWorkspacePath?: string;
|
|
265
|
+
/** ADR 69:分流 verdict / CONFLICT 冲突清单(快照透传,供 projectGoalPlan 组装)。 */
|
|
266
|
+
readonly deliveryHandoffVerdict?: string;
|
|
267
|
+
readonly deliveryHandoffConflicts?: readonly {
|
|
268
|
+
readonly path: string;
|
|
269
|
+
}[];
|
|
241
270
|
readonly progress?: {
|
|
242
271
|
readonly completed: number;
|
|
243
272
|
readonly total: number;
|
|
@@ -262,12 +291,11 @@ export interface GoalPlanProjectionSnapshot {
|
|
|
262
291
|
*/
|
|
263
292
|
readonly providerLabel?: string;
|
|
264
293
|
/**
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
* result_ready,由用户在 Result Review 页手动归档)。
|
|
294
|
+
* 遗留字段:用户验收戳。Goal 完成不再据此进入 result_ready;
|
|
295
|
+
* 完成即终态,合回/自检未结束仍走 peer_advancing 或 needs_you。
|
|
268
296
|
*/
|
|
269
297
|
readonly accepted?: boolean;
|
|
270
|
-
/**
|
|
298
|
+
/** 有代码副作用时,完成门之后还要质量自检过线才能进终态。 */
|
|
271
299
|
readonly requiresQualityReview?: boolean;
|
|
272
300
|
readonly qualityReviewStatus?: 'reviewing' | 'passed' | 'failed';
|
|
273
301
|
/**
|
|
@@ -341,16 +369,16 @@ export declare function projectConversation(snapshot: ConversationProjectionSnap
|
|
|
341
369
|
* 2. plan drafting → needs_you/plan_approval
|
|
342
370
|
* 4. runner waiting_user → needs_you/user_input
|
|
343
371
|
* 5. runner blocked | budget_exhausted → needs_you/decision
|
|
344
|
-
* 6. plan completed
|
|
372
|
+
* 6. plan completed:
|
|
373
|
+
* - 合回进行中 → peer_advancing;合回失败 → needs_you/decision
|
|
374
|
+
* - 否则直接 terminal(不再因未验收 / 自检缺口进入 result_ready)
|
|
345
375
|
* 8. plan executing → peer_advancing
|
|
346
376
|
* 9. runner running/compacting/resuming/exploring → peer_advancing
|
|
347
377
|
* 11. plan approved/accepted(Runner 未启动)→ peer_advancing
|
|
348
378
|
* 12. plan paused → paused
|
|
349
379
|
* 13. runner paused → paused
|
|
350
380
|
* 14. runner idle 且 plan executing → paused(异常态,提示诊断)
|
|
351
|
-
* 16. plan
|
|
352
|
-
* 已验收但交回仍在进行(delivering / idle)或失败(stopped)时
|
|
353
|
-
* 暂不进终态;仅有 deliveryRoute 不算正在交回。
|
|
381
|
+
* 16. plan cancelled/failed → terminal
|
|
354
382
|
*
|
|
355
383
|
* 注意 rule 14 在 rule 8 之前不会命中(executing 已被 rule 8 拦截),
|
|
356
384
|
* 因此实现时将 rule 14 放在 rule 8 之后、仅当 runner 显式 idle 时生效。
|
|
@@ -364,14 +392,14 @@ export declare function projectGoalPlan(snapshot: GoalPlanProjectionSnapshot, op
|
|
|
364
392
|
* 判定顺序(首个命中生效):
|
|
365
393
|
* 3. run waiting_permission → needs_you/user_input(授权权限)
|
|
366
394
|
* 4. run waiting_user → needs_you/user_input(回答问题)
|
|
367
|
-
* 7. 产品方案 A:run succeeded → terminal
|
|
395
|
+
* 7. 产品方案 A:run succeeded → terminal(定时/触发成功默认归档,不进工作台)
|
|
368
396
|
* 15. definition paused/disabled → paused
|
|
369
397
|
* 10. run scheduled/queued/preparing/running → peer_advancing
|
|
370
398
|
* 17. run 终态(succeeded/failed/cancelled/skipped/timed_out/blocked)→ terminal
|
|
371
399
|
* 18. definition completed/archived → terminal
|
|
372
400
|
*
|
|
373
|
-
* 说明:
|
|
374
|
-
* Automation 仅在 needs_you
|
|
401
|
+
* 说明:Goal 完成即终态,Automation 成功也直接终态。
|
|
402
|
+
* Automation 仅在 needs_you(权限/提问)时必须进工作台。
|
|
375
403
|
*/
|
|
376
404
|
export declare function projectAutomationRun(snapshot: AutomationProjectionSnapshot): TaskOverviewItem;
|
|
377
405
|
/**
|
package/dist/task-overview.js
CHANGED
|
@@ -78,16 +78,16 @@ export function projectConversation(snapshot) {
|
|
|
78
78
|
* 2. plan drafting → needs_you/plan_approval
|
|
79
79
|
* 4. runner waiting_user → needs_you/user_input
|
|
80
80
|
* 5. runner blocked | budget_exhausted → needs_you/decision
|
|
81
|
-
* 6. plan completed
|
|
81
|
+
* 6. plan completed:
|
|
82
|
+
* - 合回进行中 → peer_advancing;合回失败 → needs_you/decision
|
|
83
|
+
* - 否则直接 terminal(不再因未验收 / 自检缺口进入 result_ready)
|
|
82
84
|
* 8. plan executing → peer_advancing
|
|
83
85
|
* 9. runner running/compacting/resuming/exploring → peer_advancing
|
|
84
86
|
* 11. plan approved/accepted(Runner 未启动)→ peer_advancing
|
|
85
87
|
* 12. plan paused → paused
|
|
86
88
|
* 13. runner paused → paused
|
|
87
89
|
* 14. runner idle 且 plan executing → paused(异常态,提示诊断)
|
|
88
|
-
* 16. plan
|
|
89
|
-
* 已验收但交回仍在进行(delivering / idle)或失败(stopped)时
|
|
90
|
-
* 暂不进终态;仅有 deliveryRoute 不算正在交回。
|
|
90
|
+
* 16. plan cancelled/failed → terminal
|
|
91
91
|
*
|
|
92
92
|
* 注意 rule 14 在 rule 8 之前不会命中(executing 已被 rule 8 拦截),
|
|
93
93
|
* 因此实现时将 rule 14 放在 rule 8 之后、仅当 runner 显式 idle 时生效。
|
|
@@ -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,
|
|
181
|
+
const { status, runnerStatus, interrupted, deliveryHandoffStatus, deliveryHandoffVerdict } = snapshot;
|
|
168
182
|
// 未消费的网络/流式中断是当前行动权事实,优先于 completed/result_ready。
|
|
169
183
|
// 用户显式 resume 后 store 会原子清除此事实,再按正常计划状态投影。
|
|
170
184
|
if (interrupted === true) {
|
|
@@ -189,48 +203,49 @@ function decideGoalPlan(snapshot) {
|
|
|
189
203
|
}
|
|
190
204
|
// rule 16 first: 其他终态计划优先于 runner 残留态
|
|
191
205
|
// (历史 failed/cancelled/completed 上的 runner.blocked 不得再进 needs_you)
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
206
|
+
// Goal 完成不再卡「待用户验收」;Evidence / criteria 仍在完成闸门约束。
|
|
207
|
+
if (status === 'completed') {
|
|
208
|
+
if (deliveryHandoffStatus && deliveryHandoffStatus !== 'delivered') {
|
|
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
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
actionRight: 'needs_you',
|
|
221
|
+
needsYouReason: 'decision',
|
|
222
|
+
nextAction: 'decide_blocked',
|
|
223
|
+
statusLabel: '合不进源头',
|
|
224
|
+
actionLabel: '查看进度',
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
// 只有真实合回进行中才占工作台。仅有 deliveryRoute 不算正在合进。
|
|
228
|
+
if (deliveryHandoffStatus === 'delivering' || deliveryHandoffStatus === 'idle') {
|
|
229
|
+
return {
|
|
230
|
+
actionRight: 'peer_advancing',
|
|
231
|
+
nextAction: 'none',
|
|
232
|
+
statusLabel: '正在合进源头',
|
|
233
|
+
actionLabel: '查看 →',
|
|
234
|
+
};
|
|
235
|
+
}
|
|
201
236
|
}
|
|
202
|
-
// rule 6: 完成且未验收 → 结果就绪
|
|
203
237
|
return {
|
|
204
|
-
actionRight: '
|
|
205
|
-
nextAction: '
|
|
206
|
-
statusLabel: '
|
|
207
|
-
actionLabel: '
|
|
238
|
+
actionRight: 'terminal',
|
|
239
|
+
nextAction: 'none',
|
|
240
|
+
statusLabel: '已完成',
|
|
241
|
+
actionLabel: '查看 →',
|
|
208
242
|
};
|
|
209
243
|
}
|
|
210
|
-
if (status === '
|
|
211
|
-
if (deliveryHandoffStatus === 'stopped') {
|
|
212
|
-
return {
|
|
213
|
-
actionRight: 'result_ready',
|
|
214
|
-
nextAction: 'review_result',
|
|
215
|
-
statusLabel: '交回未完成',
|
|
216
|
-
actionLabel: '查看进度',
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
// 只有真实交回进行中才占工作台。仅有 deliveryRoute 不算正在交回。
|
|
220
|
-
if (deliveryHandoffStatus === 'delivering' || deliveryHandoffStatus === 'idle') {
|
|
221
|
-
return {
|
|
222
|
-
actionRight: 'result_ready',
|
|
223
|
-
nextAction: 'none',
|
|
224
|
-
statusLabel: '正在交回目标分支',
|
|
225
|
-
actionLabel: '查看 →',
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
if (status === 'completed' || status === 'cancelled' || status === 'failed') {
|
|
244
|
+
if (status === 'cancelled' || status === 'failed') {
|
|
230
245
|
return {
|
|
231
246
|
actionRight: 'terminal',
|
|
232
247
|
nextAction: 'none',
|
|
233
|
-
statusLabel: status === '
|
|
248
|
+
statusLabel: status === 'cancelled' ? '已取消' : '已失败',
|
|
234
249
|
actionLabel: '查看 →',
|
|
235
250
|
};
|
|
236
251
|
}
|
|
@@ -360,14 +375,14 @@ function decideGoalPlan(snapshot) {
|
|
|
360
375
|
* 判定顺序(首个命中生效):
|
|
361
376
|
* 3. run waiting_permission → needs_you/user_input(授权权限)
|
|
362
377
|
* 4. run waiting_user → needs_you/user_input(回答问题)
|
|
363
|
-
* 7. 产品方案 A:run succeeded → terminal
|
|
378
|
+
* 7. 产品方案 A:run succeeded → terminal(定时/触发成功默认归档,不进工作台)
|
|
364
379
|
* 15. definition paused/disabled → paused
|
|
365
380
|
* 10. run scheduled/queued/preparing/running → peer_advancing
|
|
366
381
|
* 17. run 终态(succeeded/failed/cancelled/skipped/timed_out/blocked)→ terminal
|
|
367
382
|
* 18. definition completed/archived → terminal
|
|
368
383
|
*
|
|
369
|
-
* 说明:
|
|
370
|
-
* Automation 仅在 needs_you
|
|
384
|
+
* 说明:Goal 完成即终态,Automation 成功也直接终态。
|
|
385
|
+
* Automation 仅在 needs_you(权限/提问)时必须进工作台。
|
|
371
386
|
*/
|
|
372
387
|
export function projectAutomationRun(snapshot) {
|
|
373
388
|
const decision = decideAutomation(snapshot);
|