@peer-agent/protocol 0.0.4 → 0.0.5-beta.2
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.js +8 -0
- package/dist/system-context.d.ts +1 -1
- package/dist/task-overview.d.ts +33 -1
- package/dist/task-overview.js +22 -1
- package/package.json +1 -1
package/dist/goal.js
CHANGED
|
@@ -61,6 +61,14 @@ function handoffStoppedReasonLabel(reason, locale) {
|
|
|
61
61
|
return locale === 'zh' ? '同一目标正在交回' : 'same target is delivering';
|
|
62
62
|
case 'merge_conflict':
|
|
63
63
|
return locale === 'zh' ? '交回时发生冲突' : 'delivery conflicted';
|
|
64
|
+
case 'target_checkout_dirty':
|
|
65
|
+
return locale === 'zh'
|
|
66
|
+
? '你正在目标分支上,还有未提交改动,交回已暂停'
|
|
67
|
+
: 'target checkout is dirty; delivery paused';
|
|
68
|
+
case 'git_timeout':
|
|
69
|
+
return locale === 'zh' ? '交回超时,可重试' : 'delivery timed out; retry available';
|
|
70
|
+
case 'git_lock':
|
|
71
|
+
return locale === 'zh' ? '仓库正被占用,可重试' : 'repository is locked; retry available';
|
|
64
72
|
default:
|
|
65
73
|
return locale === 'zh' ? '交回已停止' : 'delivery stopped';
|
|
66
74
|
}
|
package/dist/system-context.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface AttachmentContextItem {
|
|
|
17
17
|
readonly contentIncluded: boolean;
|
|
18
18
|
readonly transport: AttachmentContextTransport;
|
|
19
19
|
}
|
|
20
|
-
export type ContextAttachmentSourceKind = 'user_upload' | 'clipboard' | 'skill' | 'memory' | 'hook' | 'mcp' | 'runtime' | string;
|
|
20
|
+
export type ContextAttachmentSourceKind = 'user_upload' | 'clipboard' | 'skill' | 'memory' | 'hook' | 'mcp' | 'runtime' | 'session_reference' | 'workspace_file' | 'workspace_dir' | 'git_diff' | string;
|
|
21
21
|
export type ContextAttachmentScope = 'turn' | 'conversation' | 'workspace' | 'session' | string;
|
|
22
22
|
export type ContextAttachmentLifecycle = 'ephemeral' | 'durable_ref' | 'evidence_ref' | string;
|
|
23
23
|
export interface ContextAttachmentItem extends AttachmentContextItem {
|
package/dist/task-overview.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* 存储读出字段后组装快照,renderer 只拿到投影产物。这样契约边界清晰,
|
|
19
19
|
* 且测试无需构造巨型 fixture。
|
|
20
20
|
*/
|
|
21
|
-
import type { GoalPlanStatus, GoalRunnerStatus, GoalTiming } from './goal.ts';
|
|
21
|
+
import type { GoalDeliveryHandoffStatus, GoalPlanStatus, GoalRunnerStatus, GoalTiming } from './goal.ts';
|
|
22
22
|
import type { AutomationLifecycleStatus, AutomationRunStatus } from './automation.ts';
|
|
23
23
|
/**
|
|
24
24
|
* 任务的下一步行动权归属(§11.2)。
|
|
@@ -59,12 +59,42 @@ export type TaskNextAction = 'approve_plan' | 'confirm_scope' | 'grant_permissio
|
|
|
59
59
|
* status 与 GoalTask.status / ExecutionStatus 字面量对齐。
|
|
60
60
|
*/
|
|
61
61
|
export type TaskOverviewPlanStepStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled' | 'waiting_user';
|
|
62
|
+
export type TaskOverviewArtifactKind = 'code' | 'file' | 'image';
|
|
63
|
+
export interface TaskOverviewCodePreview {
|
|
64
|
+
readonly kind: 'code';
|
|
65
|
+
readonly additions: number;
|
|
66
|
+
readonly deletions: number;
|
|
67
|
+
readonly diffLines: readonly string[];
|
|
68
|
+
}
|
|
69
|
+
export interface TaskOverviewImagePreview {
|
|
70
|
+
readonly kind: 'image';
|
|
71
|
+
readonly dataUrl: string;
|
|
72
|
+
readonly width: number;
|
|
73
|
+
readonly height: number;
|
|
74
|
+
}
|
|
75
|
+
export type TaskOverviewArtifactPreview = TaskOverviewCodePreview | TaskOverviewImagePreview;
|
|
76
|
+
/** 由 GoalTask.evidenceRefs / EvidenceIndex 派生的用户可浏览产物。 */
|
|
77
|
+
export interface TaskOverviewArtifact {
|
|
78
|
+
/** 原始 Artifact 引用;仅用于追溯与列表 key,不直接展示给用户。 */
|
|
79
|
+
readonly ref: string;
|
|
80
|
+
readonly kind: TaskOverviewArtifactKind;
|
|
81
|
+
/** 用户可理解的产物名称,不得包含内部 UUID 或协议引用。 */
|
|
82
|
+
readonly label: string;
|
|
83
|
+
/** 与产物类型匹配的动作文案,例如“预览截图”“查看结果”。 */
|
|
84
|
+
readonly actionLabel: string;
|
|
85
|
+
/** Provider 产生、main 规范化后的有界 hover 内容。 */
|
|
86
|
+
readonly preview?: TaskOverviewArtifactPreview;
|
|
87
|
+
/** main 进程确认可安全打开后才提供。 */
|
|
88
|
+
readonly openPath?: string;
|
|
89
|
+
}
|
|
62
90
|
export interface TaskOverviewPlanStep {
|
|
63
91
|
readonly taskId: string;
|
|
64
92
|
readonly title: string;
|
|
65
93
|
readonly status: TaskOverviewPlanStepStatus;
|
|
66
94
|
/** 当前 Runner 正在推进的步骤。 */
|
|
67
95
|
readonly current?: boolean;
|
|
96
|
+
/** 仅属于该叶子任务的 Evidence 派生产物。 */
|
|
97
|
+
readonly artifacts?: readonly TaskOverviewArtifact[];
|
|
68
98
|
}
|
|
69
99
|
export interface TaskOverviewItem {
|
|
70
100
|
/** 稳定投影身份(conversationId、planId 或 automationId+runId)。 */
|
|
@@ -93,6 +123,7 @@ export interface TaskOverviewItem {
|
|
|
93
123
|
* 没隔离或没验收时不出现。
|
|
94
124
|
*/
|
|
95
125
|
readonly deliveryHandoffLabel?: string;
|
|
126
|
+
readonly deliveryHandoffStatus?: GoalDeliveryHandoffStatus;
|
|
96
127
|
/** 状态描述(原型卡片中部,如「Peer 正在验证」「等待权限」)。 */
|
|
97
128
|
readonly statusLabel: string;
|
|
98
129
|
/** 执行异常的可展示原因;仅异常/暂停投影存在,不承载控制状态。 */
|
|
@@ -196,6 +227,7 @@ export interface GoalPlanProjectionSnapshot {
|
|
|
196
227
|
readonly deliveryRoute?: string;
|
|
197
228
|
/** 用户可见的交回状态;没隔离或没验收时省略。 */
|
|
198
229
|
readonly deliveryHandoffLabel?: string;
|
|
230
|
+
readonly deliveryHandoffStatus?: GoalDeliveryHandoffStatus;
|
|
199
231
|
readonly progress?: {
|
|
200
232
|
readonly completed: number;
|
|
201
233
|
readonly total: number;
|
package/dist/task-overview.js
CHANGED
|
@@ -136,6 +136,7 @@ export function projectGoalPlan(snapshot, options) {
|
|
|
136
136
|
...(snapshot.workspaceLabel ? { workspaceLabel: snapshot.workspaceLabel } : {}),
|
|
137
137
|
...(snapshot.deliveryRoute ? { deliveryRoute: snapshot.deliveryRoute } : {}),
|
|
138
138
|
...(snapshot.deliveryHandoffLabel ? { deliveryHandoffLabel: snapshot.deliveryHandoffLabel } : {}),
|
|
139
|
+
...(snapshot.deliveryHandoffStatus ? { deliveryHandoffStatus: snapshot.deliveryHandoffStatus } : {}),
|
|
139
140
|
...(snapshot.requiresQualityReview ? { requiresQualityReview: true } : {}),
|
|
140
141
|
...(snapshot.qualityReviewStatus ? { qualityReviewStatus: snapshot.qualityReviewStatus } : {}),
|
|
141
142
|
...(snapshot.qualityChecks?.length ? { qualityChecks: snapshot.qualityChecks } : {}),
|
|
@@ -157,7 +158,7 @@ export function projectGoalPlan(snapshot, options) {
|
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
160
|
function decideGoalPlan(snapshot) {
|
|
160
|
-
const { status, runnerStatus, interrupted, accepted } = snapshot;
|
|
161
|
+
const { status, runnerStatus, interrupted, accepted, deliveryHandoffStatus } = snapshot;
|
|
161
162
|
// 未消费的网络/流式中断是当前行动权事实,优先于 completed/result_ready。
|
|
162
163
|
// 用户显式 resume 后 store 会原子清除此事实,再按正常计划状态投影。
|
|
163
164
|
if (interrupted === true) {
|
|
@@ -200,6 +201,26 @@ function decideGoalPlan(snapshot) {
|
|
|
200
201
|
actionLabel: '查看结果',
|
|
201
202
|
};
|
|
202
203
|
}
|
|
204
|
+
if (status === 'completed' && accepted === true && deliveryHandoffStatus !== 'delivered') {
|
|
205
|
+
if (deliveryHandoffStatus === 'stopped') {
|
|
206
|
+
return {
|
|
207
|
+
actionRight: 'result_ready',
|
|
208
|
+
nextAction: 'review_result',
|
|
209
|
+
statusLabel: '交回未完成',
|
|
210
|
+
actionLabel: '查看结果',
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
if (deliveryHandoffStatus === 'delivering'
|
|
214
|
+
|| deliveryHandoffStatus === 'idle'
|
|
215
|
+
|| Boolean(snapshot.deliveryRoute)) {
|
|
216
|
+
return {
|
|
217
|
+
actionRight: 'result_ready',
|
|
218
|
+
nextAction: 'none',
|
|
219
|
+
statusLabel: '正在交回目标分支',
|
|
220
|
+
actionLabel: '查看 →',
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
}
|
|
203
224
|
if (status === 'completed' || status === 'cancelled' || status === 'failed') {
|
|
204
225
|
return {
|
|
205
226
|
actionRight: 'terminal',
|