@peer-agent/protocol 0.1.0-rc.47 → 0.1.0-rc.49
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/bot-conversation-read.d.ts +29 -0
- package/dist/document-reference.d.ts +29 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/project-matter.d.ts +223 -0
- package/dist/project-matter.js +1 -0
- package/dist/project.d.ts +2 -0
- package/dist/updater.d.ts +13 -3
- package/package.json +1 -1
|
@@ -23,3 +23,32 @@ export interface BotRecoveryStatus {
|
|
|
23
23
|
readonly retryable: boolean;
|
|
24
24
|
}
|
|
25
25
|
export declare function projectBotRecoveryStatus(error: unknown, phase?: string): BotRecoveryStatus;
|
|
26
|
+
export interface BotPendingInput {
|
|
27
|
+
readonly inputId: string;
|
|
28
|
+
readonly createdAt: string;
|
|
29
|
+
readonly text: string;
|
|
30
|
+
readonly threadTarget: {
|
|
31
|
+
readonly kind: 'main_chat';
|
|
32
|
+
} | {
|
|
33
|
+
readonly kind: 'matter';
|
|
34
|
+
readonly matterId: string;
|
|
35
|
+
};
|
|
36
|
+
readonly surface: 'desktop' | 'quick_chat' | 'tui' | 'remote';
|
|
37
|
+
}
|
|
38
|
+
export interface BotInputDeliveryBlocker {
|
|
39
|
+
readonly stage: 'lease' | 'recovery' | 'queue' | 'consume' | 'commit' | 'model' | 'execution';
|
|
40
|
+
readonly errorCode: string;
|
|
41
|
+
readonly pendingCount: number | null;
|
|
42
|
+
readonly leaseOwnerSurface: 'desktop' | 'tui' | null;
|
|
43
|
+
readonly heldByOtherHost: boolean;
|
|
44
|
+
readonly updatedAt: string;
|
|
45
|
+
readonly suggestedActions: readonly ('take_over' | 'retry' | 'open_diagnostics' | 'open_settings')[];
|
|
46
|
+
}
|
|
47
|
+
/** Pending text is authorized conversation data. Diagnostics carry only the blocker. */
|
|
48
|
+
export interface BotInputDeliveryRead {
|
|
49
|
+
readonly pendingInputs?: readonly BotPendingInput[];
|
|
50
|
+
readonly pendingInputsTotal?: number;
|
|
51
|
+
readonly pendingInputsTruncated?: boolean;
|
|
52
|
+
readonly pendingInputsErrorCode?: string;
|
|
53
|
+
readonly deliveryBlocker?: BotInputDeliveryBlocker | null;
|
|
54
|
+
}
|
|
@@ -43,7 +43,7 @@ export interface LocalDocumentObservation extends LocalDocumentIdentity {
|
|
|
43
43
|
export interface LocalDocumentReadResult {
|
|
44
44
|
readonly metadataOnly?: boolean;
|
|
45
45
|
readonly ok: boolean;
|
|
46
|
-
readonly status: 'ok' | 'not_found' | 'not_file' | 'too_large' | 'binary' | 'invalid_path' | 'error' | 'permission_denied' | 'scope_denied' | 'ambiguous_path' | 'workspace_unavailable' | 'relative_base_required' | 'version_changed' | 'source_changed' | 'version_unavailable' | 'not_git_repo' | 'invalid_ref' | 'revision_unavailable' | 'unsupported_entry';
|
|
46
|
+
readonly status: 'ok' | 'not_found' | 'not_file' | 'too_large' | 'binary' | 'invalid_path' | 'error' | 'permission_denied' | 'sensitive_path' | 'scope_denied' | 'ambiguous_path' | 'workspace_unavailable' | 'relative_base_required' | 'version_changed' | 'source_changed' | 'version_unavailable' | 'not_git_repo' | 'invalid_ref' | 'revision_unavailable' | 'unsupported_entry';
|
|
47
47
|
readonly content: string;
|
|
48
48
|
readonly size?: number;
|
|
49
49
|
readonly resolvedFrom?: string;
|
|
@@ -81,3 +81,31 @@ export interface BotResourceSearchResult {
|
|
|
81
81
|
readonly visited?: number;
|
|
82
82
|
readonly error?: string;
|
|
83
83
|
}
|
|
84
|
+
/** Renderer click context is a lookup hint. The Desktop host owns the authorization. */
|
|
85
|
+
export interface DocumentPreviewRequest {
|
|
86
|
+
readonly reference: BotDocumentReference;
|
|
87
|
+
readonly conversationId: string;
|
|
88
|
+
readonly messageId?: string;
|
|
89
|
+
readonly evidenceRef?: string;
|
|
90
|
+
readonly challenge?: string;
|
|
91
|
+
}
|
|
92
|
+
export type DocumentPreviewAccessResult = {
|
|
93
|
+
readonly ok: true;
|
|
94
|
+
readonly status: 'scoped';
|
|
95
|
+
} | {
|
|
96
|
+
readonly ok: true;
|
|
97
|
+
readonly status: 'allowed';
|
|
98
|
+
readonly token: string;
|
|
99
|
+
readonly path: string;
|
|
100
|
+
readonly source: 'external' | 'conversation' | 'worktree';
|
|
101
|
+
} | {
|
|
102
|
+
readonly ok: false;
|
|
103
|
+
readonly status: 'scope_denied';
|
|
104
|
+
readonly canRequestSingleFilePreview: true;
|
|
105
|
+
readonly path: string;
|
|
106
|
+
readonly challenge: string;
|
|
107
|
+
} | {
|
|
108
|
+
readonly ok: false;
|
|
109
|
+
readonly status: LocalDocumentReadResult['status'];
|
|
110
|
+
readonly canRequestSingleFilePreview?: never;
|
|
111
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -944,3 +944,4 @@ export type { ConversationExecutionIdentity, ConversationExecution } from './con
|
|
|
944
944
|
export * from './quiet-reply.js';
|
|
945
945
|
export type { WorkingPlanStepStatus, WorkingPlanStepView, WorkingPlanView } from './working-plan.ts';
|
|
946
946
|
export * from "./parent-coordination.js";
|
|
947
|
+
export * from "./project-matter.ts";
|
package/dist/index.js
CHANGED
|
@@ -74,3 +74,4 @@ export * from "./interactive-verification.js";
|
|
|
74
74
|
export { normalizeConversationExecution, conversationExecutionPermitsNewRun, validConversationSpend } from "./conversation-execution.js";
|
|
75
75
|
export * from './quiet-reply.js';
|
|
76
76
|
export * from "./parent-coordination.js";
|
|
77
|
+
export * from "./project-matter.js";
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/** Rust Core project.matter.* v1, used by the trusted Desktop bridge. */
|
|
2
|
+
export type MatterStatus = 'pending' | 'in_progress' | 'waiting' | 'delivered' | 'cancelled';
|
|
3
|
+
export type MatterGroup = 'needsYou' | 'active' | 'delivered' | 'cancelled';
|
|
4
|
+
export type MatterCriterion = {
|
|
5
|
+
id: string;
|
|
6
|
+
text: string;
|
|
7
|
+
status?: 'open' | 'met' | 'waived';
|
|
8
|
+
waiverReceiptRef?: string;
|
|
9
|
+
};
|
|
10
|
+
export type MatterBrief = {
|
|
11
|
+
title: string;
|
|
12
|
+
goal: string;
|
|
13
|
+
constraints?: readonly string[];
|
|
14
|
+
doneMeans: string | readonly MatterCriterion[];
|
|
15
|
+
};
|
|
16
|
+
export type MatterSource = {
|
|
17
|
+
kind: string;
|
|
18
|
+
ref?: string;
|
|
19
|
+
};
|
|
20
|
+
export type MatterSummary = {
|
|
21
|
+
matterId: string;
|
|
22
|
+
number: number;
|
|
23
|
+
title: string;
|
|
24
|
+
status: MatterStatus;
|
|
25
|
+
needsYou: boolean;
|
|
26
|
+
revision: number;
|
|
27
|
+
briefRevision: number;
|
|
28
|
+
waitReason: string | null;
|
|
29
|
+
cancelReason: string | null;
|
|
30
|
+
cancelSettling: boolean;
|
|
31
|
+
lastEffectiveChangeAt: string;
|
|
32
|
+
};
|
|
33
|
+
export type MatterDecisionDraft = {
|
|
34
|
+
context: string;
|
|
35
|
+
question: string;
|
|
36
|
+
options: readonly {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
recommended?: boolean;
|
|
40
|
+
}[];
|
|
41
|
+
approveDoneMeans?: MatterBrief['doneMeans'];
|
|
42
|
+
};
|
|
43
|
+
export type MatterDecision = MatterDecisionDraft & {
|
|
44
|
+
requestId: string;
|
|
45
|
+
};
|
|
46
|
+
export type MatterGit = {
|
|
47
|
+
repo: string | null;
|
|
48
|
+
baseBranch: string | null;
|
|
49
|
+
baseSha: string | null;
|
|
50
|
+
taskBranch: string | null;
|
|
51
|
+
isolation: string | null;
|
|
52
|
+
};
|
|
53
|
+
export type MatterArtifact = {
|
|
54
|
+
kind?: string;
|
|
55
|
+
ref?: string;
|
|
56
|
+
path?: string;
|
|
57
|
+
title?: string;
|
|
58
|
+
label?: string;
|
|
59
|
+
};
|
|
60
|
+
export type MatterDelivery = {
|
|
61
|
+
summary: string;
|
|
62
|
+
deliveredAt: string;
|
|
63
|
+
git?: MatterGit | null;
|
|
64
|
+
evidenceRefs?: readonly string[];
|
|
65
|
+
artifacts?: readonly MatterArtifact[];
|
|
66
|
+
};
|
|
67
|
+
export type Matter = MatterBrief & Omit<MatterSummary, 'waitReason'> & {
|
|
68
|
+
origin: MatterSource;
|
|
69
|
+
waiting?: {
|
|
70
|
+
reason: string;
|
|
71
|
+
source: MatterSource;
|
|
72
|
+
} | null;
|
|
73
|
+
needsYouDecision?: MatterDecision | null;
|
|
74
|
+
delivery?: MatterDelivery | null;
|
|
75
|
+
deliveryHistory: readonly MatterDelivery[];
|
|
76
|
+
historyWithheld?: boolean;
|
|
77
|
+
};
|
|
78
|
+
export type MatterRun = {
|
|
79
|
+
sessionId: string;
|
|
80
|
+
followUpEpoch: number;
|
|
81
|
+
role: string;
|
|
82
|
+
state: string;
|
|
83
|
+
hostStatus?: string;
|
|
84
|
+
executionMode?: string;
|
|
85
|
+
git?: MatterGit | null;
|
|
86
|
+
briefRevision?: number | null;
|
|
87
|
+
};
|
|
88
|
+
export type MatterActivity = {
|
|
89
|
+
activityId: string;
|
|
90
|
+
seq: number;
|
|
91
|
+
kind: string;
|
|
92
|
+
actorKind: string;
|
|
93
|
+
body: string;
|
|
94
|
+
payload: Record<string, unknown>;
|
|
95
|
+
createdAt: string;
|
|
96
|
+
};
|
|
97
|
+
export type MatterChanged = {
|
|
98
|
+
workspaceId: string;
|
|
99
|
+
matterId: string;
|
|
100
|
+
revision: number;
|
|
101
|
+
};
|
|
102
|
+
export type MatterListPage = {
|
|
103
|
+
limit?: number;
|
|
104
|
+
deliveredLimit?: number;
|
|
105
|
+
} & Partial<Record<`${MatterGroup}Cursor`, string>>;
|
|
106
|
+
export type MatterDetailPage = {
|
|
107
|
+
afterSeq?: number;
|
|
108
|
+
activityLimit?: number;
|
|
109
|
+
runOffset?: number;
|
|
110
|
+
runLimit?: number;
|
|
111
|
+
};
|
|
112
|
+
type Scope = {
|
|
113
|
+
workspaceId: string;
|
|
114
|
+
version?: 1;
|
|
115
|
+
};
|
|
116
|
+
type Write = Scope & {
|
|
117
|
+
operationId: string;
|
|
118
|
+
};
|
|
119
|
+
type Target = {
|
|
120
|
+
matterId: string;
|
|
121
|
+
};
|
|
122
|
+
type CAS = {
|
|
123
|
+
revision: number;
|
|
124
|
+
briefRevision?: number;
|
|
125
|
+
};
|
|
126
|
+
type Answer = {
|
|
127
|
+
requestId: string;
|
|
128
|
+
} & ({
|
|
129
|
+
optionId: string;
|
|
130
|
+
text?: never;
|
|
131
|
+
} | {
|
|
132
|
+
text: string;
|
|
133
|
+
optionId?: never;
|
|
134
|
+
});
|
|
135
|
+
type Patch = {
|
|
136
|
+
brief?: MatterBrief;
|
|
137
|
+
status?: MatterStatus;
|
|
138
|
+
waiting?: {
|
|
139
|
+
reason: string;
|
|
140
|
+
source: MatterSource & {
|
|
141
|
+
ref: string;
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
decision?: MatterDecisionDraft;
|
|
145
|
+
userReceiptRef?: string;
|
|
146
|
+
delivery?: {
|
|
147
|
+
summary: string;
|
|
148
|
+
sessionId?: string;
|
|
149
|
+
followUpEpoch?: number;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
export type MatterList = Record<MatterGroup, readonly MatterSummary[]> & Record<`${MatterGroup}Cursor`, string | null> & {
|
|
153
|
+
activeCount: number;
|
|
154
|
+
cancelledCount: number;
|
|
155
|
+
};
|
|
156
|
+
export type MatterDetail = {
|
|
157
|
+
matter: Matter;
|
|
158
|
+
activities: readonly MatterActivity[];
|
|
159
|
+
runs: readonly MatterRun[];
|
|
160
|
+
nextActivitySeq: number | null;
|
|
161
|
+
nextRunOffset: number | null;
|
|
162
|
+
};
|
|
163
|
+
type Receipt = Target & CAS & {
|
|
164
|
+
number: number;
|
|
165
|
+
status: MatterStatus;
|
|
166
|
+
seq?: number;
|
|
167
|
+
activityId?: string;
|
|
168
|
+
};
|
|
169
|
+
interface MatterRequests {
|
|
170
|
+
list: Scope & {
|
|
171
|
+
page?: MatterListPage;
|
|
172
|
+
};
|
|
173
|
+
get: Scope & Target & {
|
|
174
|
+
page?: MatterDetailPage;
|
|
175
|
+
};
|
|
176
|
+
create: Write & {
|
|
177
|
+
brief: MatterBrief;
|
|
178
|
+
};
|
|
179
|
+
update: Write & Target & CAS & {
|
|
180
|
+
patch: Patch;
|
|
181
|
+
};
|
|
182
|
+
comment: Write & Target & {
|
|
183
|
+
body: string;
|
|
184
|
+
};
|
|
185
|
+
answer_decision: Write & Target & CAS & {
|
|
186
|
+
answer: Answer;
|
|
187
|
+
};
|
|
188
|
+
reopen: Write & Target & CAS & {
|
|
189
|
+
reason: string;
|
|
190
|
+
};
|
|
191
|
+
cancel: Write & Target & CAS & {
|
|
192
|
+
reason: string;
|
|
193
|
+
};
|
|
194
|
+
claim_session: Write & {
|
|
195
|
+
claim: {
|
|
196
|
+
sessionId: string;
|
|
197
|
+
} & ({
|
|
198
|
+
brief: MatterBrief;
|
|
199
|
+
} | (Target & Pick<CAS, 'revision'>));
|
|
200
|
+
};
|
|
201
|
+
export_markdown: Scope & Target;
|
|
202
|
+
}
|
|
203
|
+
type ReadResults = {
|
|
204
|
+
list: MatterList;
|
|
205
|
+
get: MatterDetail;
|
|
206
|
+
export_markdown: Target & {
|
|
207
|
+
markdown: string;
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
type MatterFailure = {
|
|
211
|
+
ok: false;
|
|
212
|
+
code: string;
|
|
213
|
+
revision?: number;
|
|
214
|
+
briefRevision?: number;
|
|
215
|
+
};
|
|
216
|
+
export type MatterResult<K extends keyof MatterRequests> = MatterFailure | ({
|
|
217
|
+
ok: true;
|
|
218
|
+
version: 1;
|
|
219
|
+
} & (K extends keyof ReadResults ? ReadResults[K] : Receipt));
|
|
220
|
+
export type ProjectMatterRpc = <K extends keyof MatterRequests>(request: MatterRequests[K] & {
|
|
221
|
+
method: K;
|
|
222
|
+
}) => Promise<MatterResult<K>>;
|
|
223
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/project.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Bot list projection. Sort is recent activity only.
|
|
3
3
|
* needsYou changes the badge and the filter, not the order.
|
|
4
4
|
*/
|
|
5
|
+
import type { BotInputDeliveryBlocker } from './bot-conversation-read.ts';
|
|
5
6
|
import type { ProjectModelPolicy } from './model-routing.ts';
|
|
6
7
|
import type { PendingApprovalState, WorkSessionStatus } from './delegation.ts';
|
|
7
8
|
import type { FollowUpProjection } from './task-overview.ts';
|
|
@@ -57,6 +58,7 @@ export interface ProjectDiagnostics {
|
|
|
57
58
|
readonly acquiredAt: string | null;
|
|
58
59
|
readonly heartbeatAt: string | null;
|
|
59
60
|
} | null;
|
|
61
|
+
readonly inputDeliveryBlocker?: BotInputDeliveryBlocker | null;
|
|
60
62
|
readonly input: {
|
|
61
63
|
readonly depth: number | null;
|
|
62
64
|
readonly executionDepth: number | null;
|
package/dist/updater.d.ts
CHANGED
|
@@ -17,12 +17,22 @@ export type UpdateChannelPreference = 'auto' | UpdateChannel;
|
|
|
17
17
|
export type UpdaterPhase = 'idle' | 'checking' | 'available' | 'not-available' | 'downloading'
|
|
18
18
|
/** 更新已下载,等待用户点击「安装」后退出替换并重启(mac / Windows / Linux AppImage 同一语义)。 */
|
|
19
19
|
| 'downloaded' | 'error';
|
|
20
|
+
export type UpdaterDownloadStage = 'connecting' | 'downloading' | 'verifying';
|
|
21
|
+
/** Download facts projected by the desktop host. The package estimate is independent of the transfer total. */
|
|
22
|
+
export interface UpdaterDownloadTelemetry {
|
|
23
|
+
readonly transferredBytes?: number;
|
|
24
|
+
readonly totalBytes?: number;
|
|
25
|
+
readonly bytesPerSecond?: number;
|
|
26
|
+
readonly downloadStage?: UpdaterDownloadStage;
|
|
27
|
+
readonly packageSizeBytes?: number;
|
|
28
|
+
readonly isFallbackFull?: boolean;
|
|
29
|
+
}
|
|
20
30
|
/** 主进程向渲染层广播的更新事件(与 auto-updater 的 onEvent 一一对应)。 */
|
|
21
|
-
export interface UpdaterEvent {
|
|
31
|
+
export interface UpdaterEvent extends UpdaterDownloadTelemetry {
|
|
22
32
|
readonly type: 'checking-for-update' | 'update-available' | 'update-not-available' | 'download-progress' | 'update-downloaded' | 'error';
|
|
23
33
|
/** 目标/可用版本号(available / downloaded / not-available 时携带)。 */
|
|
24
34
|
readonly version?: string;
|
|
25
|
-
/** 下载进度百分比(download-progress 时携带,0–100
|
|
35
|
+
/** 下载进度百分比(download-progress 时携带,0–100,最多一位小数)。 */
|
|
26
36
|
readonly percent?: number;
|
|
27
37
|
/** 错误信息(error 时携带)。 */
|
|
28
38
|
readonly message?: string;
|
|
@@ -32,7 +42,7 @@ export interface UpdaterEvent {
|
|
|
32
42
|
readonly releaseNotes?: string;
|
|
33
43
|
}
|
|
34
44
|
/** 渲染层订阅 / 主动查询时获得的更新状态快照。 */
|
|
35
|
-
export interface UpdaterStatus {
|
|
45
|
+
export interface UpdaterStatus extends UpdaterDownloadTelemetry {
|
|
36
46
|
/** 当前应用版本号(来自 app.getVersion)。 */
|
|
37
47
|
readonly currentVersion: string;
|
|
38
48
|
/** 实际生效的更新通道(preference=auto 时为版本号推断结果)。 */
|