@ycodium-ai/plugin-api 0.2.2968 → 0.2.2974
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/README.md +29 -0
- package/dist/conversation.d.ts +15 -1587
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js.map +1 -1
- package/dist/conversationBase.d.ts +89 -0
- package/dist/conversationBase.d.ts.map +1 -0
- package/dist/conversationBase.js +2 -0
- package/dist/conversationBase.js.map +1 -0
- package/dist/conversationComposerApi.d.ts +246 -0
- package/dist/conversationComposerApi.d.ts.map +1 -0
- package/dist/conversationComposerApi.js +2 -0
- package/dist/conversationComposerApi.js.map +1 -0
- package/dist/conversationComposerEnvironment.d.ts +71 -0
- package/dist/conversationComposerEnvironment.d.ts.map +1 -0
- package/dist/conversationComposerEnvironment.js +2 -0
- package/dist/conversationComposerEnvironment.js.map +1 -0
- package/dist/conversationComposerHandle.d.ts +80 -0
- package/dist/conversationComposerHandle.d.ts.map +1 -0
- package/dist/conversationComposerHandle.js +2 -0
- package/dist/conversationComposerHandle.js.map +1 -0
- package/dist/conversationDerive.d.ts +132 -0
- package/dist/conversationDerive.d.ts.map +1 -0
- package/dist/conversationDerive.js +2 -0
- package/dist/conversationDerive.js.map +1 -0
- package/dist/conversationDrafts.d.ts +220 -0
- package/dist/conversationDrafts.d.ts.map +1 -0
- package/dist/conversationDrafts.js +2 -0
- package/dist/conversationDrafts.js.map +1 -0
- package/dist/conversationHostModels.d.ts +378 -0
- package/dist/conversationHostModels.d.ts.map +1 -0
- package/dist/conversationHostModels.js +2 -0
- package/dist/conversationHostModels.js.map +1 -0
- package/dist/conversationRows.d.ts +96 -0
- package/dist/conversationRows.d.ts.map +1 -0
- package/dist/conversationRows.js +2 -0
- package/dist/conversationRows.js.map +1 -0
- package/dist/conversationViewProps.d.ts +366 -0
- package/dist/conversationViewProps.d.ts.map +1 -0
- package/dist/conversationViewProps.js +2 -0
- package/dist/conversationViewProps.js.map +1 -0
- package/dist/executor.d.ts +4 -6
- package/dist/executor.d.ts.map +1 -1
- package/dist/executor.js.map +1 -1
- package/dist/executorProcesses.d.ts +38 -0
- package/dist/executorProcesses.d.ts.map +1 -0
- package/dist/executorProcesses.js +5 -0
- package/dist/executorProcesses.js.map +1 -0
- package/dist/index.d.ts +15 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/settings-actions.d.ts +25 -2
- package/dist/settings-actions.d.ts.map +1 -1
- package/dist/settings-actions.js +0 -6
- package/dist/settings-actions.js.map +1 -1
- package/dist/settings-ui.d.ts +46 -0
- package/dist/settings-ui.d.ts.map +1 -0
- package/dist/settings-ui.js +2 -0
- package/dist/settings-ui.js.map +1 -0
- package/dist/threadList.d.ts +2 -0
- package/dist/threadList.d.ts.map +1 -1
- package/dist/ui.d.ts +1 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
package/dist/conversation.d.ts
CHANGED
|
@@ -26,1256 +26,31 @@
|
|
|
26
26
|
* @module @ycodium-ai/plugin-api/conversation
|
|
27
27
|
*/
|
|
28
28
|
import type { ConversationComposerAccountUsage } from "./account-usage.ts";
|
|
29
|
-
import type { ConversationPresetApi } from "./conversationPresets.ts";
|
|
30
|
-
import type { ConversationAttachmentDocumentOpen, ConversationAttachmentsApi, ConversationMessageAttachment, ConversationPastedTextSource } from "./conversationAttachments.ts";
|
|
31
29
|
export type * from "./conversationAttachments.ts";
|
|
32
|
-
import type { ConversationAssistantQuoteApi,
|
|
30
|
+
import type { ConversationAssistantQuoteApi, ConversationThreadReferenceApi } from "./conversationMessageLinks.ts";
|
|
33
31
|
export type * from "./conversationMessageLinks.ts";
|
|
34
32
|
export { CONVERSATION_ASSISTANT_QUOTE_OPEN_EVENT, CONVERSATION_THREAD_REFERENCE_OPEN_EVENT, } from "./conversationMessageLinks.ts";
|
|
35
|
-
import type { ConversationShellCommand
|
|
33
|
+
import type { ConversationShellCommand } from "./conversationComposerParts.ts";
|
|
36
34
|
export type * from "./conversationComposerParts.ts";
|
|
37
|
-
import type { ConversationServerProviderSkill, ConversationServerProviderSlashCommand, ConversationTimelineSkill } from "./conversationSkills.ts";
|
|
38
35
|
export type * from "./conversationSkills.ts";
|
|
39
36
|
import type { ConversationCommunicationRecord, ConversationTrajectoryRow } from "./conversationTrajectory.ts";
|
|
40
37
|
export type * from "./conversationTrajectory.ts";
|
|
41
38
|
import type { ConversationQueuedMessageEdit, ConversationQueueEntry, ConversationPendingQueueSubmission, ConversationQueueState } from "./conversation-queue.ts";
|
|
42
|
-
import type { ConversationWorkEntry } from "./conversationWorkEntry.ts";
|
|
43
39
|
export type * from "./conversationWorkEntry.ts";
|
|
44
40
|
export type { AccountUsageCapability, AccountUsageCredentialIdentity, AccountUsageMetric, AccountUsageMetricKind, AccountUsageRefreshOutcome, AccountUsageRefreshResult, AccountUsageResetOutcome, AccountUsageScopeKind, AccountUsageSnapshot, AccountUsageUnit, ConversationComposerAccountUsage, } from "./account-usage.ts";
|
|
45
|
-
|
|
46
|
-
export type
|
|
47
|
-
|
|
48
|
-
export type
|
|
49
|
-
export type
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
readonly text: string;
|
|
59
|
-
readonly turnId: string | null;
|
|
60
|
-
readonly streaming: boolean;
|
|
61
|
-
readonly createdAt: string;
|
|
62
|
-
/** 助手元信息行的时间取它(流式结束后才画)。 */
|
|
63
|
-
readonly updatedAt: string;
|
|
64
|
-
readonly attachments?: ReadonlyArray<ConversationMessageAttachment> | undefined;
|
|
65
|
-
readonly author?: ConversationMessageAuthor | null | undefined;
|
|
66
|
-
readonly modelSelection?: ConversationModelSelection | undefined;
|
|
67
|
-
}
|
|
68
|
-
/** 助手消息上的模型徽章(宿主 `AssistantModelBadge` 的结构子集)。 */
|
|
69
|
-
export interface ConversationModelBadge {
|
|
70
|
-
readonly instanceId: string;
|
|
71
|
-
/** 实例已被删掉又猜不出 driver 时为 null。 */
|
|
72
|
-
readonly driverKind: string | null;
|
|
73
|
-
readonly providerDisplayName: string;
|
|
74
|
-
readonly accentColor: string | undefined;
|
|
75
|
-
readonly modelLabel: string;
|
|
76
|
-
readonly effortLabel: string | null;
|
|
77
|
-
readonly effortLevel?: string | null;
|
|
78
|
-
readonly identity: string;
|
|
79
|
-
}
|
|
80
|
-
/** 轮次页脚(宿主 `TurnFooterPresentation` 的结构子集)。 */
|
|
81
|
-
export interface ConversationTurnFooter {
|
|
82
|
-
readonly turnId: string;
|
|
83
|
-
readonly state: string;
|
|
84
|
-
readonly completedAt?: string | undefined;
|
|
85
|
-
readonly workingElapsedMs?: number | undefined;
|
|
86
|
-
readonly outputTokens?: number | undefined;
|
|
87
|
-
}
|
|
88
|
-
/** 逐轮用量(宿主 `TurnUsagePresentation` 的结构子集)。 */
|
|
89
|
-
export interface ConversationTurnUsage {
|
|
90
|
-
readonly turnId: string;
|
|
91
|
-
readonly outputTokens?: number | undefined;
|
|
92
|
-
readonly inputTokens?: number | undefined;
|
|
93
|
-
readonly cachedInputTokens?: number | undefined;
|
|
94
|
-
readonly reasoningOutputTokens?: number | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* `inputTokens` 与 `cachedInputTokens` 互斥,相加得总输入,可以据此算命中率。
|
|
97
|
-
* 缺席或为假时 `inputTokens` 含缓存,两者不能相加——那一轮别显示比率。
|
|
98
|
-
*/
|
|
99
|
-
readonly cacheDisjoint?: boolean | undefined;
|
|
100
|
-
}
|
|
101
|
-
/** 建议计划卡片(宿主 `ProposedPlan` 的结构子集)。 */
|
|
102
|
-
export interface ConversationProposedPlan {
|
|
103
|
-
readonly id: string;
|
|
104
|
-
readonly turnId: string | null;
|
|
105
|
-
readonly planMarkdown: string;
|
|
106
|
-
readonly implementedAt: string | null;
|
|
107
|
-
readonly implementationThreadId: string | null;
|
|
108
|
-
readonly createdAt: string;
|
|
109
|
-
}
|
|
110
|
-
/** 一轮的计划步骤条(宿主 `TurnPlanEntry` 的结构子集)。 */
|
|
111
|
-
export interface ConversationTurnPlan {
|
|
112
|
-
readonly id: string;
|
|
113
|
-
readonly createdAt: string;
|
|
114
|
-
readonly turnId: string | null;
|
|
115
|
-
readonly plan: {
|
|
116
|
-
readonly createdAt: string;
|
|
117
|
-
readonly explanation?: string | null | undefined;
|
|
118
|
-
readonly steps: ReadonlyArray<{
|
|
119
|
-
readonly durationMs?: number | undefined;
|
|
120
|
-
readonly step: string;
|
|
121
|
-
readonly status: string;
|
|
122
|
-
}>;
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
export type ConversationDraftId = string;
|
|
126
|
-
export type ConversationThreadId = string;
|
|
127
|
-
export type ConversationEnvironmentId = string;
|
|
128
|
-
export interface ConversationScopedThreadRef {
|
|
129
|
-
/** 宿主给的引用对象;别当字符串解析。只需线程 id 的接口应直接收 {@link ConversationThreadId}。 */
|
|
130
|
-
readonly environmentId: ConversationEnvironmentId;
|
|
131
|
-
readonly threadId: ConversationThreadId;
|
|
132
|
-
}
|
|
133
|
-
export type ConversationTurnId = string;
|
|
134
|
-
export type ConversationProjectId = string;
|
|
135
|
-
export type ConversationApprovalRequestId = string;
|
|
136
|
-
export type ConversationProviderInstanceId = string;
|
|
137
|
-
export type ConversationProviderDriverKind = string;
|
|
138
|
-
export type ConversationProviderRequestKind = "command" | "file-read" | "file-change" | "web-fetch" | "web-search" | "skill" | "mcp-tool" | "mcp-elicitation" | "tool";
|
|
139
|
-
export type ConversationRuntimeMode = string;
|
|
140
|
-
export type ConversationRuntimeModeSwitch = "in-session" | "next-turn";
|
|
141
|
-
export type ConversationProviderInteractionMode = "default" | "plan";
|
|
142
|
-
export type ConversationProviderDeclineReasonRelay = "none" | "native" | "queued";
|
|
143
|
-
/** composer 目标:已存在的会话或尚未落库的草稿。 */
|
|
144
|
-
export type ConversationComposerThreadTarget = ConversationScopedThreadRef | ConversationDraftId;
|
|
145
|
-
export interface ConversationModelSelection {
|
|
146
|
-
instanceId: ConversationProviderInstanceId;
|
|
147
|
-
model: string;
|
|
148
|
-
options?: ReadonlyArray<ConversationProviderOptionSelection> | undefined;
|
|
149
|
-
}
|
|
150
|
-
export interface ConversationProviderOptionSelection {
|
|
151
|
-
id: string;
|
|
152
|
-
value: string | boolean;
|
|
153
|
-
}
|
|
154
|
-
export type ConversationProviderOptionDescriptor = {
|
|
155
|
-
type: "select";
|
|
156
|
-
id: string;
|
|
157
|
-
label: string;
|
|
158
|
-
description?: string | undefined;
|
|
159
|
-
currentValue?: string | undefined;
|
|
160
|
-
options: ReadonlyArray<{
|
|
161
|
-
id: string;
|
|
162
|
-
label: string;
|
|
163
|
-
description?: string | undefined;
|
|
164
|
-
isDefault?: boolean | undefined;
|
|
165
|
-
}>;
|
|
166
|
-
/** 旧目录可带的 prompt 注入型取值标记;保留形状供解码,宿主不据此改写正文。 */
|
|
167
|
-
promptInjectedValues?: ReadonlyArray<string> | undefined;
|
|
168
|
-
} | {
|
|
169
|
-
type: "boolean";
|
|
170
|
-
id: string;
|
|
171
|
-
label: string;
|
|
172
|
-
description?: string | undefined;
|
|
173
|
-
currentValue?: boolean | undefined;
|
|
174
|
-
};
|
|
175
|
-
export interface ConversationModelCapabilities {
|
|
176
|
-
optionDescriptors?: ReadonlyArray<ConversationProviderOptionDescriptor> | undefined;
|
|
177
|
-
}
|
|
178
|
-
export interface ConversationServerProviderModel {
|
|
179
|
-
slug: string;
|
|
180
|
-
name: string;
|
|
181
|
-
shortName?: string | undefined;
|
|
182
|
-
subProvider?: string | undefined;
|
|
183
|
-
isDefault?: boolean | undefined;
|
|
184
|
-
isCustom?: boolean | undefined;
|
|
185
|
-
aliases?: ReadonlyArray<string> | undefined;
|
|
186
|
-
capabilities?: ConversationModelCapabilities | undefined;
|
|
187
|
-
}
|
|
188
|
-
export interface ConversationServerProviderNativeMode {
|
|
189
|
-
id: string;
|
|
190
|
-
name: string;
|
|
191
|
-
description?: string | undefined;
|
|
192
|
-
}
|
|
193
|
-
/** 宿主 `ServerProvider` 的结构子集(composer 子树读到的字段)。 */
|
|
194
|
-
export interface ConversationServerProvider {
|
|
195
|
-
instanceId: ConversationProviderInstanceId;
|
|
196
|
-
driver: ConversationProviderDriverKind;
|
|
197
|
-
displayName?: string | undefined;
|
|
198
|
-
enabled: boolean;
|
|
199
|
-
installed: boolean;
|
|
200
|
-
accentColor?: string | undefined;
|
|
201
|
-
continuation?: {
|
|
202
|
-
groupKey?: string | undefined;
|
|
203
|
-
} | undefined;
|
|
204
|
-
readiness: {
|
|
205
|
-
state: string;
|
|
206
|
-
detail?: string | undefined;
|
|
207
|
-
};
|
|
208
|
-
supportsNativeModeSwitch?: boolean | undefined;
|
|
209
|
-
supportsContextCompaction?: boolean | undefined;
|
|
210
|
-
/**
|
|
211
|
-
* 改权限模式什么时候生效,宿主按执行器名片算好交过来。缺席按 `"next-turn"`:
|
|
212
|
-
* 多标一句「下一轮生效」只是保守,反过来会骗用户说已经切了。
|
|
213
|
-
*
|
|
214
|
-
* 插件**不得**按 driver 名字自己推这一位——名片会在手搬进插件时改,抄一份名单
|
|
215
|
-
* 就会照旧行为提示。
|
|
216
|
-
*/
|
|
217
|
-
runtimeModeSwitch?: ConversationRuntimeModeSwitch | undefined;
|
|
218
|
-
showInteractionModeToggle?: boolean | undefined;
|
|
219
|
-
/** 名片的旧型号 slug 别名(旧 → 现行),宿主经快照带来;缺席 = 不改写。经 `model.buildSlugAliases` 读。 */
|
|
220
|
-
modelSlugAliases?: {
|
|
221
|
-
readonly [slug: string]: string;
|
|
222
|
-
} | undefined;
|
|
223
|
-
currentNativeModeId?: string | undefined;
|
|
224
|
-
nativeModes?: ReadonlyArray<ConversationServerProviderNativeMode> | undefined;
|
|
225
|
-
/** 没选过档的线程四档各落哪一档。只经 `model.resolveNativeMode` 读,插件不自己查。 */
|
|
226
|
-
nativeModeByRuntimeMode?: {
|
|
227
|
-
readonly [runtimeMode: string]: string;
|
|
228
|
-
} | undefined;
|
|
229
|
-
versionAdvisory?: {
|
|
230
|
-
latestVersion?: string | null | undefined;
|
|
231
|
-
} | undefined;
|
|
232
|
-
models: ReadonlyArray<ConversationServerProviderModel>;
|
|
233
|
-
skills?: ReadonlyArray<ConversationServerProviderSkill> | undefined;
|
|
234
|
-
slashCommands?: ReadonlyArray<ConversationServerProviderSlashCommand> | undefined;
|
|
235
|
-
auth: {
|
|
236
|
-
status: string;
|
|
237
|
-
email?: string | undefined;
|
|
238
|
-
};
|
|
239
|
-
/** 快照还有 version / checkedAt 等字段;子集不列举,收窄断言时原样穿过。 */
|
|
240
|
-
[key: string]: unknown;
|
|
241
|
-
}
|
|
242
|
-
/** 宿主 `ProviderInstanceEntry`(web providerInstances.ts)的结构子集。 */
|
|
243
|
-
export interface ConversationProviderInstanceEntry {
|
|
244
|
-
instanceId: ConversationProviderInstanceId;
|
|
245
|
-
driverKind: ConversationProviderDriverKind;
|
|
246
|
-
displayName: string;
|
|
247
|
-
/** 这一格坐的是哪双手(品牌名)。昵称在 `displayName`,两者可能不同。 */
|
|
248
|
-
agentName?: string | undefined;
|
|
249
|
-
accentColor?: string | undefined;
|
|
250
|
-
accountEmail?: string | undefined;
|
|
251
|
-
continuationGroupKey?: string | undefined;
|
|
252
|
-
enabled: boolean;
|
|
253
|
-
installed: boolean;
|
|
254
|
-
readiness: string;
|
|
255
|
-
snapshot: ConversationServerProvider;
|
|
256
|
-
models: ReadonlyArray<ConversationServerProviderModel>;
|
|
257
|
-
}
|
|
258
|
-
export interface ConversationAppModelOption {
|
|
259
|
-
slug: string;
|
|
260
|
-
name: string;
|
|
261
|
-
shortName?: string | undefined;
|
|
262
|
-
subProvider?: string | undefined;
|
|
263
|
-
description?: string | undefined;
|
|
264
|
-
isDefault?: boolean | undefined;
|
|
265
|
-
aliases?: ReadonlyArray<string> | undefined;
|
|
266
|
-
/** 这个实例的目录里暂时没有它,只因为本线程存着才列出来(OpenCode)。 */
|
|
267
|
-
isUnavailable?: boolean | undefined;
|
|
268
|
-
}
|
|
269
|
-
export interface ConversationModelFavorite {
|
|
270
|
-
environmentId: ConversationEnvironmentId;
|
|
271
|
-
instanceId: ConversationProviderInstanceId;
|
|
272
|
-
model: string;
|
|
273
|
-
}
|
|
274
|
-
/** 宿主 `UnifiedSettings` 的结构子集(composer 子树读到的字段)。 */
|
|
275
|
-
export interface ConversationUnifiedSettings {
|
|
276
|
-
planModeEnabled: boolean;
|
|
277
|
-
showSkillsInSlashMenu: boolean;
|
|
278
|
-
providerInstances?: Readonly<Record<string, unknown>> | undefined;
|
|
279
|
-
[key: string]: unknown;
|
|
280
|
-
}
|
|
281
|
-
export type ConversationResolvedKeybindingsConfig = ReadonlyArray<{
|
|
282
|
-
command: string;
|
|
283
|
-
shortcut: string;
|
|
284
|
-
whenAst?: unknown;
|
|
285
|
-
}>;
|
|
286
|
-
export type ConversationKeybindingCommand = string;
|
|
287
|
-
export type ConversationProviderApprovalDecision = "accept" | "acceptForSession" | "acceptAlways" | "decline" | "cancel";
|
|
288
|
-
export interface ConversationProviderApprovalOption {
|
|
289
|
-
decision: ConversationProviderApprovalDecision;
|
|
290
|
-
label: string;
|
|
291
|
-
id?: string | undefined;
|
|
292
|
-
description?: string | undefined;
|
|
293
|
-
}
|
|
294
|
-
export interface ConversationProviderRequestArg {
|
|
295
|
-
name: string;
|
|
296
|
-
value: string;
|
|
297
|
-
}
|
|
298
|
-
export interface ConversationProviderRequestFileChange {
|
|
299
|
-
path: string;
|
|
300
|
-
/** 服务端摊平过的变更内容:unified diff 或待替换的旧/新文本。 */
|
|
301
|
-
content?: {
|
|
302
|
-
kind: "unified";
|
|
303
|
-
diff: string;
|
|
304
|
-
} | {
|
|
305
|
-
kind: "replace";
|
|
306
|
-
oldText?: string | undefined;
|
|
307
|
-
newText: string;
|
|
308
|
-
} | undefined;
|
|
309
|
-
omitted?: string | undefined;
|
|
310
|
-
additions?: number | undefined;
|
|
311
|
-
deletions?: number | undefined;
|
|
312
|
-
}
|
|
313
|
-
/** 宿主 `session-logic.PendingApproval` 的结构子集。 */
|
|
314
|
-
export interface ConversationPendingApproval {
|
|
315
|
-
requestId: ConversationApprovalRequestId;
|
|
316
|
-
requestKind: ConversationProviderRequestKind;
|
|
317
|
-
createdAt: string;
|
|
318
|
-
detail?: string | undefined;
|
|
319
|
-
appName?: string | undefined;
|
|
320
|
-
options?: ReadonlyArray<ConversationProviderApprovalOption> | undefined;
|
|
321
|
-
declineReasonRelay?: ConversationProviderDeclineReasonRelay | undefined;
|
|
322
|
-
args?: ReadonlyArray<ConversationProviderRequestArg> | undefined;
|
|
323
|
-
fileChanges?: ReadonlyArray<ConversationProviderRequestFileChange> | undefined;
|
|
324
|
-
turnId?: ConversationTurnId | undefined;
|
|
325
|
-
}
|
|
326
|
-
export interface ConversationUserInputQuestionOption {
|
|
327
|
-
id?: string | undefined;
|
|
328
|
-
label: string;
|
|
329
|
-
description?: string | undefined;
|
|
330
|
-
/** 计划审批选项的语义;`kind: "plan"` 的题上带了它,就用界面自己的文案代替 label / description。 */
|
|
331
|
-
planAction?: "approve" | "revise" | "stop" | undefined;
|
|
332
|
-
}
|
|
333
|
-
export interface ConversationUserInputQuestion {
|
|
334
|
-
id: string;
|
|
335
|
-
header?: string | undefined;
|
|
336
|
-
question: string;
|
|
337
|
-
multiSelect?: boolean | undefined;
|
|
338
|
-
allowFreeform?: boolean | undefined;
|
|
339
|
-
kind?: string | undefined;
|
|
340
|
-
options: ReadonlyArray<ConversationUserInputQuestionOption>;
|
|
341
|
-
}
|
|
342
|
-
/** 宿主 `session-logic.PendingUserInput` 的结构子集。 */
|
|
343
|
-
export interface ConversationPendingUserInput {
|
|
344
|
-
requestId: ConversationApprovalRequestId;
|
|
345
|
-
createdAt: string;
|
|
346
|
-
questions: ReadonlyArray<ConversationUserInputQuestion>;
|
|
347
|
-
}
|
|
348
|
-
/** 还没回答也没忽略的异步提问:agent 没停下等,回答作为下一条消息发出,也可以不答。 */
|
|
349
|
-
export interface ConversationPendingQuestion {
|
|
350
|
-
readonly requestId: ConversationApprovalRequestId;
|
|
351
|
-
readonly createdAt: string;
|
|
352
|
-
readonly turnId: ConversationTurnId | null;
|
|
353
|
-
readonly questions: ReadonlyArray<ConversationUserInputQuestion>;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* 一条会话里没关的异步提问与回答、忽略它们的动作。快照在提问没变时保持同一引用。
|
|
357
|
-
* 动作失败时返回可以直接给用户看的话,成功(或被更新的请求取代)时为 null。
|
|
358
|
-
*/
|
|
359
|
-
export interface ConversationQuestions {
|
|
360
|
-
readonly pending: readonly ConversationPendingQuestion[];
|
|
361
|
-
/** 每题一个答案,多选给字符串数组;有题没答服务器会拒绝。 */
|
|
362
|
-
answer(requestId: string, answers: Readonly<Record<string, string | readonly string[]>>): Promise<string | null>;
|
|
363
|
-
dismiss(requestId: string): Promise<string | null>;
|
|
364
|
-
}
|
|
365
|
-
export interface ConversationPendingUserInputDraftAnswer {
|
|
366
|
-
selectedOptionLabels?: string[];
|
|
367
|
-
customAnswer?: string;
|
|
368
|
-
/** 这道题随答案带的附件数;只有允许自由作答的题才有。 */
|
|
369
|
-
attachmentCount?: number;
|
|
370
|
-
/** 附件还在上传或上传失败:这道题暂时不能提交。 */
|
|
371
|
-
attachmentsBlocked?: boolean;
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* 决定卡:插件或宿主功能问用户一个问题(宿主 `ThreadDecisionCard` 的结构子集)。
|
|
375
|
-
*
|
|
376
|
-
* 跟审批不是一回事:审批是 agent 要做一件事求许可,决定卡是**插件**在问
|
|
377
|
-
* (`askedBy.kind === "plugin"` 时卡上显示是谁问的)。
|
|
378
|
-
*
|
|
379
|
-
* `text` 是英文原文,`key` 有值时按 catalog 解——这个模块只搬 key,不解析。
|
|
380
|
-
*/
|
|
381
|
-
export interface ConversationThreadDecisionText {
|
|
382
|
-
readonly text: string;
|
|
383
|
-
readonly key?: string | undefined;
|
|
384
|
-
readonly params?: Readonly<Record<string, string | number>> | undefined;
|
|
385
|
-
}
|
|
386
|
-
export interface ConversationThreadDecisionOption {
|
|
387
|
-
readonly id: string;
|
|
388
|
-
readonly label: ConversationThreadDecisionText;
|
|
389
|
-
/** 只影响按钮档位;`danger` 用于「这一下会拆掉东西」。 */
|
|
390
|
-
readonly tone?: "default" | "primary" | "danger" | undefined;
|
|
391
|
-
}
|
|
392
|
-
export interface ConversationThreadDecisionCard {
|
|
393
|
-
/** 已作废的历史卡为 null;回答时必须有它。 */
|
|
394
|
-
readonly requestId: string | null;
|
|
395
|
-
readonly askedBy: {
|
|
396
|
-
readonly kind: "plugin";
|
|
397
|
-
readonly pluginId: string;
|
|
398
|
-
} | {
|
|
399
|
-
readonly kind: "host";
|
|
400
|
-
readonly feature: string;
|
|
401
|
-
};
|
|
402
|
-
readonly title: ConversationThreadDecisionText;
|
|
403
|
-
readonly body: ReadonlyArray<ConversationThreadDecisionText>;
|
|
404
|
-
readonly detail: {
|
|
405
|
-
readonly text: string;
|
|
406
|
-
readonly language?: string | undefined;
|
|
407
|
-
} | null;
|
|
408
|
-
readonly options: ReadonlyArray<ConversationThreadDecisionOption>;
|
|
409
|
-
/** null 表示还等人答。 */
|
|
410
|
-
readonly outcome: string | null;
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* 输入区被谁占着——`@ycodium/client-runtime` 选举结果(`ComposerOccupant`)的结构
|
|
414
|
-
* 镜像,四种都在。决定卡两处都画:输入区上方钉一张(要人回答),消息流里留一行
|
|
415
|
-
* (`WorkRows.tsx` 的 `DecisionCardRow`,回头能翻到当时问的是什么)——审批与
|
|
416
|
-
* agent 提问本来就是这个待遇,决定卡在 2026-09-17 之前只有后一半。
|
|
417
|
-
*
|
|
418
|
-
* 宿主构造时**不要 `as` 强转**:那会把两边的编译期互锁掐断。宿主形状与这份镜像的
|
|
419
|
-
* 可赋值关系由 `apps/web` 的 `composerOccupantContract.test.ts` 守着。
|
|
420
|
-
*/
|
|
421
|
-
export type ConversationComposerOccupant = {
|
|
422
|
-
readonly kind: "approval";
|
|
423
|
-
readonly approval: ConversationPendingApproval;
|
|
424
|
-
readonly pendingCount: number;
|
|
425
|
-
} | {
|
|
426
|
-
readonly kind: "decision";
|
|
427
|
-
/** 宿主 `ThreadDecisionState` 的结构子集:卡在 `card` 里,外层那几个字段插件用不到。 */
|
|
428
|
-
readonly decision: {
|
|
429
|
-
readonly card: ConversationThreadDecisionCard;
|
|
430
|
-
};
|
|
431
|
-
readonly pendingCount: number;
|
|
432
|
-
} | {
|
|
433
|
-
readonly kind: "user-input";
|
|
434
|
-
readonly userInput: ConversationPendingUserInput;
|
|
435
|
-
readonly pendingCount: number;
|
|
436
|
-
} | {
|
|
437
|
-
readonly kind: "plan-follow-up";
|
|
438
|
-
};
|
|
439
|
-
/** 宿主 `PreviewAnnotationPayload` 的结构子集(composer 只读展示)。 */
|
|
440
|
-
export interface ConversationPreviewAnnotationElement {
|
|
441
|
-
id: string;
|
|
442
|
-
element: unknown;
|
|
443
|
-
}
|
|
444
|
-
export interface ConversationPreviewAnnotationPayload {
|
|
445
|
-
id: string;
|
|
446
|
-
kind: string;
|
|
447
|
-
comment: string;
|
|
448
|
-
elements: ReadonlyArray<ConversationPreviewAnnotationElement>;
|
|
449
|
-
regions: ReadonlyArray<unknown>;
|
|
450
|
-
strokes: ReadonlyArray<unknown>;
|
|
451
|
-
styleChanges: ReadonlyArray<unknown>;
|
|
452
|
-
[key: string]: unknown;
|
|
453
|
-
}
|
|
454
|
-
/** 宿主 `EnvironmentConnectionPresentation` 的结构子集。 */
|
|
455
|
-
export interface ConversationEnvironmentConnectionPresentation {
|
|
456
|
-
label: string;
|
|
457
|
-
[key: string]: unknown;
|
|
458
|
-
}
|
|
459
|
-
/** 宿主 `ContextWindowSnapshot` 的结构子集。 */
|
|
460
|
-
export interface ConversationContextWindowSnapshot {
|
|
461
|
-
usedTokens: number;
|
|
462
|
-
maxTokens: number | null;
|
|
463
|
-
usedPercentage: number | null;
|
|
464
|
-
totalProcessedTokens?: number | null | undefined;
|
|
465
|
-
compactsAutomatically?: boolean | undefined;
|
|
466
|
-
autoCompactThreshold?: number | null | undefined;
|
|
467
|
-
}
|
|
468
|
-
export type ConversationSessionPhase = "idle" | "connecting" | "running" | "disconnected" | string;
|
|
469
|
-
/** 宿主 `Thread` 的结构子集(composer 只读这些 meta 字段)。 */
|
|
470
|
-
export interface ConversationThreadMeta {
|
|
471
|
-
id: ConversationThreadId;
|
|
472
|
-
presetId?: string | null | undefined;
|
|
473
|
-
nativeModeId?: string | null | undefined;
|
|
474
|
-
session?: {
|
|
475
|
-
providerInstanceId?: ConversationProviderInstanceId | undefined;
|
|
476
|
-
nativeModeId?: string | null | undefined;
|
|
477
|
-
status?: string | undefined;
|
|
478
|
-
activeTurnId?: ConversationTurnId | null | undefined;
|
|
479
|
-
} | undefined;
|
|
480
|
-
latestTurn?: {
|
|
481
|
-
turnId: ConversationTurnId;
|
|
482
|
-
} | null | undefined;
|
|
483
|
-
proposedPlans: ReadonlyArray<{
|
|
484
|
-
id: string;
|
|
485
|
-
planMarkdown: string;
|
|
486
|
-
}>;
|
|
487
|
-
}
|
|
488
|
-
export interface ConversationThreadPreset {
|
|
489
|
-
presetId: string;
|
|
490
|
-
displayName: string;
|
|
491
|
-
description?: string | undefined;
|
|
492
|
-
promptPrefix?: string | undefined;
|
|
493
|
-
}
|
|
494
|
-
export interface ConversationComposerImageAttachment {
|
|
495
|
-
id: string;
|
|
496
|
-
name: string;
|
|
497
|
-
mimeType: string;
|
|
498
|
-
sizeBytes: number;
|
|
499
|
-
/** 附件类型判定(可内联图片 or 上传文件);与宿主 ChatAttachment 同构。 */
|
|
500
|
-
type: "image" | "file";
|
|
501
|
-
previewUrl: string;
|
|
502
|
-
file: File;
|
|
503
|
-
source?: ConversationPastedTextSource | undefined;
|
|
504
|
-
[key: string]: unknown;
|
|
505
|
-
}
|
|
506
|
-
export interface ConversationPersistedComposerImageAttachment {
|
|
507
|
-
id: string;
|
|
508
|
-
name: string;
|
|
509
|
-
mimeType: string;
|
|
510
|
-
sizeBytes: number;
|
|
511
|
-
dataUrl: string;
|
|
512
|
-
storageId?: string | undefined;
|
|
513
|
-
remote?: {
|
|
514
|
-
environmentId: string;
|
|
515
|
-
attachmentId: string;
|
|
516
|
-
} | undefined;
|
|
517
|
-
source?: ConversationPastedTextSource | undefined;
|
|
518
|
-
}
|
|
519
|
-
export interface ConversationTerminalContextSelection {
|
|
520
|
-
terminalId: string;
|
|
521
|
-
terminalLabel: string;
|
|
522
|
-
lineStart: number;
|
|
523
|
-
lineEnd: number;
|
|
524
|
-
text: string;
|
|
525
|
-
}
|
|
526
|
-
export interface ConversationTerminalContextDraft extends ConversationTerminalContextSelection {
|
|
527
|
-
id: string;
|
|
528
|
-
threadId: ConversationThreadId;
|
|
529
|
-
createdAt: string;
|
|
530
|
-
}
|
|
531
|
-
export interface ConversationElementContextStackFrame {
|
|
532
|
-
functionName: string | null;
|
|
533
|
-
fileName: string | null;
|
|
534
|
-
lineNumber: number | null;
|
|
535
|
-
columnNumber: number | null;
|
|
536
|
-
}
|
|
537
|
-
export interface ConversationElementContextSelection {
|
|
538
|
-
pageUrl: string;
|
|
539
|
-
pageTitle: string | null;
|
|
540
|
-
tagName: string;
|
|
541
|
-
selector: string | null;
|
|
542
|
-
htmlPreview: string;
|
|
543
|
-
componentName: string | null;
|
|
544
|
-
source: ConversationElementContextStackFrame | null;
|
|
545
|
-
styles: string;
|
|
546
|
-
}
|
|
547
|
-
export interface ConversationElementContextDraft extends ConversationElementContextSelection {
|
|
548
|
-
id: string;
|
|
549
|
-
threadId: ConversationThreadId;
|
|
550
|
-
pickedAt: string;
|
|
551
|
-
}
|
|
552
|
-
export interface ConversationReviewCommentContext {
|
|
553
|
-
readonly id: string;
|
|
554
|
-
readonly sectionId: string;
|
|
555
|
-
readonly sectionTitle: string;
|
|
556
|
-
readonly filePath: string;
|
|
557
|
-
readonly startIndex: number;
|
|
558
|
-
readonly endIndex: number;
|
|
559
|
-
readonly rangeLabel: string;
|
|
560
|
-
readonly text: string;
|
|
561
|
-
readonly diff: string;
|
|
562
|
-
}
|
|
563
|
-
export interface ConversationPromptStashEntry {
|
|
564
|
-
id: string;
|
|
565
|
-
createdAt: string;
|
|
566
|
-
prompt: string;
|
|
567
|
-
attachments: ReadonlyArray<ConversationPersistedComposerImageAttachment>;
|
|
568
|
-
droppedImageNames: ReadonlyArray<string>;
|
|
569
|
-
unreadableImageNames?: ReadonlyArray<string> | undefined;
|
|
570
|
-
pendingImageCount?: number | undefined;
|
|
571
|
-
}
|
|
572
|
-
/**
|
|
573
|
-
* 上传失败的原因码,插件按码取自己的译文。`rejected` 时 `httpStatus` 带服务器回的状态码;
|
|
574
|
-
* 宿主以后可能加新码,不认识的码与没给码的旧宿主一样退回 `reason`(宿主的英文诊断串)。
|
|
575
|
-
*/
|
|
576
|
-
export type ConversationAttachmentUploadFailureCode = "start-failed" | "not-connected" | "rejected" | "timed-out" | "cancelled" | "failed";
|
|
577
|
-
export type ConversationAttachmentUploadState = {
|
|
578
|
-
status: "ready";
|
|
579
|
-
environmentId: string;
|
|
580
|
-
attachmentId: string;
|
|
581
|
-
} | {
|
|
582
|
-
status: "uploading";
|
|
583
|
-
environmentId: string;
|
|
584
|
-
progress: number;
|
|
585
|
-
previous?: unknown;
|
|
586
|
-
} | {
|
|
587
|
-
status: "failed";
|
|
588
|
-
environmentId: string;
|
|
589
|
-
reason: string;
|
|
590
|
-
code?: ConversationAttachmentUploadFailureCode;
|
|
591
|
-
httpStatus?: number;
|
|
592
|
-
attachmentId?: string;
|
|
593
|
-
};
|
|
594
|
-
/** 宿主 `ComposerThreadDraftState` 的结构子集:一条会话输入框里的草稿。 */
|
|
595
|
-
export interface ConversationComposerThreadDraft {
|
|
596
|
-
prompt: string;
|
|
597
|
-
images: ConversationComposerImageAttachment[];
|
|
598
|
-
nonPersistedImageIds: string[];
|
|
599
|
-
persistedAttachments: ConversationPersistedComposerImageAttachment[];
|
|
600
|
-
terminalContexts: ConversationTerminalContextDraft[];
|
|
601
|
-
elementContexts: ConversationElementContextDraft[];
|
|
602
|
-
previewAnnotations: ConversationPreviewAnnotationPayload[];
|
|
603
|
-
reviewComments: ConversationReviewCommentContext[];
|
|
604
|
-
modelSelectionByProvider: Readonly<Record<string, ConversationModelSelection | undefined>>;
|
|
605
|
-
nativeModeByProvider?: Readonly<Record<string, string | null | undefined>> | undefined;
|
|
606
|
-
activeProvider: ConversationProviderInstanceId | null;
|
|
607
|
-
runtimeMode: ConversationRuntimeMode | null;
|
|
608
|
-
interactionMode: ConversationProviderInteractionMode | null;
|
|
609
|
-
selectedPluginActionKey: string | null;
|
|
610
|
-
}
|
|
611
|
-
/**
|
|
612
|
-
* 草稿字段 + store 的 action 面(zustand 的 state 与 action 同住一个对象;hook 经
|
|
613
|
-
* api.draft.useStore 穿界,插件只用它取 action)。
|
|
614
|
-
*/
|
|
615
|
-
export interface ConversationComposerDraftState extends ConversationComposerThreadDraft {
|
|
616
|
-
setPrompt(target: ConversationComposerThreadTarget, prompt: string): void;
|
|
617
|
-
setTerminalContexts(target: ConversationComposerThreadTarget, contexts: ConversationTerminalContextDraft[]): void;
|
|
618
|
-
setProviderModelOptions(target: ConversationComposerThreadTarget, provider: ConversationProviderDriverKind, nextProviderOptions: ReadonlyArray<ConversationProviderOptionSelection> | null | undefined, options?: {
|
|
619
|
-
instanceId?: ConversationProviderInstanceId | null | undefined;
|
|
620
|
-
model?: string | null | undefined;
|
|
621
|
-
persistSticky?: boolean;
|
|
622
|
-
}): void;
|
|
623
|
-
setNativeMode(target: ConversationComposerThreadTarget, instanceId: ConversationProviderInstanceId, nativeModeId: string | null): void;
|
|
624
|
-
addImage(target: ConversationComposerThreadTarget, image: ConversationComposerImageAttachment): void;
|
|
625
|
-
addImages(target: ConversationComposerThreadTarget, images: ConversationComposerImageAttachment[]): void;
|
|
626
|
-
removeImage(target: ConversationComposerThreadTarget, imageId: string): void;
|
|
627
|
-
insertTerminalContext(target: ConversationComposerThreadTarget, prompt: string, context: ConversationTerminalContextDraft, index: number): boolean;
|
|
628
|
-
removeTerminalContext(target: ConversationComposerThreadTarget, contextId: string): void;
|
|
629
|
-
removeElementContext(target: ConversationComposerThreadTarget, contextId: string): void;
|
|
630
|
-
removePreviewAnnotation(target: ConversationComposerThreadTarget, annotationId: string): void;
|
|
631
|
-
removeReviewComment(target: ConversationComposerThreadTarget, commentId: string): void;
|
|
632
|
-
clearComposerPromptAndImages(target: ConversationComposerThreadTarget): void;
|
|
633
|
-
}
|
|
634
|
-
/** 宿主 `useComposerDraftStore` 同形:zustand store hook 原样穿界。 */
|
|
635
|
-
export interface ConversationComposerDraftStoreHook {
|
|
636
|
-
<T>(selector: (state: ConversationComposerDraftState) => T): T;
|
|
637
|
-
getState(): ConversationComposerDraftState;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* 输入区这只手现在拿不拿得出型号。宿主只在一处判(`resolveInstanceModelState`),
|
|
641
|
-
* 座位标签与发送闸都读这个结论,不要各自再判一次「有没有型号」。
|
|
642
|
-
*/
|
|
643
|
-
export type ConversationComposerModelStatus =
|
|
644
|
-
/** 有型号:`selectedModel` 就是它。 */
|
|
645
|
-
"known"
|
|
646
|
-
/** 首探还在跑:清单不算数,等它落地,不要替这只手选一个。 */
|
|
647
|
-
| "probing"
|
|
648
|
-
/** 探测跑完了,这只手一个型号都没报。 */
|
|
649
|
-
| "missing";
|
|
650
|
-
export interface ConversationEffectiveComposerModelState {
|
|
651
|
-
/** `selectedModelStatus` 不是 `known` 时为空串——不会回落到别的手或全局默认型号。 */
|
|
652
|
-
selectedModel: string;
|
|
653
|
-
selectedModelStatus: ConversationComposerModelStatus;
|
|
654
|
-
modelOptions: Readonly<Record<string, ReadonlyArray<ConversationProviderOptionSelection> | undefined>> | null;
|
|
655
|
-
}
|
|
656
|
-
export interface ConversationPromptStashStoreState {
|
|
657
|
-
entries: ReadonlyArray<ConversationPromptStashEntry>;
|
|
658
|
-
stashEntry(entry: ConversationPromptStashEntry): {
|
|
659
|
-
evicted: ConversationPromptStashEntry | null;
|
|
660
|
-
written: boolean;
|
|
661
|
-
durable: boolean;
|
|
662
|
-
};
|
|
663
|
-
takeEntry(id: string): {
|
|
664
|
-
entry: ConversationPromptStashEntry | null;
|
|
665
|
-
durable: boolean;
|
|
666
|
-
};
|
|
667
|
-
finalizeEntryImages(id: string, images: {
|
|
668
|
-
attachments: ReadonlyArray<ConversationPersistedComposerImageAttachment>;
|
|
669
|
-
droppedImageNames: ReadonlyArray<string>;
|
|
670
|
-
unreadableImageNames: ReadonlyArray<string>;
|
|
671
|
-
}): {
|
|
672
|
-
attached: boolean;
|
|
673
|
-
durable: boolean;
|
|
674
|
-
};
|
|
675
|
-
}
|
|
676
|
-
export interface ConversationPromptStashStoreHook {
|
|
677
|
-
<T>(selector: (state: ConversationPromptStashStoreState) => T): T;
|
|
678
|
-
getState(): ConversationPromptStashStoreState;
|
|
679
|
-
}
|
|
680
|
-
export interface ConversationAttachmentUploadStoreState {
|
|
681
|
-
uploadsByImageId: Readonly<Record<string, ConversationAttachmentUploadState>>;
|
|
682
|
-
}
|
|
683
|
-
export interface ConversationAttachmentUploadStoreHook {
|
|
684
|
-
<T>(selector: (state: ConversationAttachmentUploadStoreState) => T): T;
|
|
685
|
-
}
|
|
686
|
-
export interface ConversationCompressedStashImage {
|
|
687
|
-
mimeType: string;
|
|
688
|
-
sizeBytes: number;
|
|
689
|
-
dataUrl: string;
|
|
690
|
-
}
|
|
691
|
-
export type ConversationCompressStashImageResult = {
|
|
692
|
-
ok: true;
|
|
693
|
-
image: ConversationCompressedStashImage;
|
|
694
|
-
} | {
|
|
695
|
-
ok: false;
|
|
696
|
-
reason: "too-large" | "unreadable";
|
|
697
|
-
};
|
|
698
|
-
export type ConversationCompressImageFileResult = {
|
|
699
|
-
ok: true;
|
|
700
|
-
file: File;
|
|
701
|
-
} | {
|
|
702
|
-
ok: false;
|
|
703
|
-
reason: "too-large" | "unreadable";
|
|
704
|
-
};
|
|
705
|
-
export interface ConversationComposerSendState {
|
|
706
|
-
trimmedPrompt: string;
|
|
707
|
-
sendableTerminalContexts: ConversationTerminalContextDraft[];
|
|
708
|
-
expiredTerminalContextCount: number;
|
|
709
|
-
hasSendableContent: boolean;
|
|
710
|
-
}
|
|
711
|
-
export interface ConversationComposerPathSearchEntry {
|
|
712
|
-
path: string;
|
|
713
|
-
kind: "file" | "directory";
|
|
714
|
-
}
|
|
715
|
-
/** 某个实例在某个项目目录里的斜杠命令与技能(宿主 `ProviderWorkspaceInventoryResult` 的子集)。 */
|
|
716
|
-
export interface ConversationWorkspaceInventory {
|
|
717
|
-
readonly slashCommands: ReadonlyArray<ConversationServerProviderSlashCommand>;
|
|
718
|
-
readonly skills: ReadonlyArray<ConversationServerProviderSkill>;
|
|
719
|
-
}
|
|
720
|
-
export interface ConversationComposerPathSearchState {
|
|
721
|
-
entries: ReadonlyArray<ConversationComposerPathSearchEntry>;
|
|
722
|
-
error: string | null;
|
|
723
|
-
isPending: boolean;
|
|
724
|
-
}
|
|
725
|
-
export interface ConversationPluginComposerOption {
|
|
726
|
-
readonly id: string;
|
|
727
|
-
readonly pluginId: string;
|
|
728
|
-
readonly actionId: string;
|
|
729
|
-
readonly choiceId: string;
|
|
730
|
-
readonly prepareCommand: string;
|
|
731
|
-
readonly title: string;
|
|
732
|
-
readonly description?: string | undefined;
|
|
733
|
-
}
|
|
734
|
-
export interface ConversationPluginComposerChoices {
|
|
735
|
-
readonly options: readonly ConversationPluginComposerOption[];
|
|
736
|
-
readonly isKnown: boolean;
|
|
737
|
-
}
|
|
738
|
-
export interface ConversationPierreIconResolution {
|
|
739
|
-
readonly symbolId: string;
|
|
740
|
-
readonly specific: boolean;
|
|
741
|
-
}
|
|
742
|
-
/** `keybindings.ts` 的快捷键解析选项(结构子集)。 */
|
|
743
|
-
export interface ConversationShortcutMatchOptions {
|
|
744
|
-
platform?: string;
|
|
745
|
-
context?: {
|
|
746
|
-
terminalFocus?: boolean;
|
|
747
|
-
terminalOpen?: boolean;
|
|
748
|
-
modelPickerOpen?: boolean;
|
|
749
|
-
};
|
|
750
|
-
}
|
|
751
|
-
export interface ConversationShortcutEventLike {
|
|
752
|
-
type?: string;
|
|
753
|
-
code?: string;
|
|
754
|
-
key: string;
|
|
755
|
-
metaKey: boolean;
|
|
756
|
-
ctrlKey: boolean;
|
|
757
|
-
altKey: boolean;
|
|
758
|
-
shiftKey: boolean;
|
|
759
|
-
repeat?: boolean;
|
|
760
|
-
defaultPrevented?: boolean;
|
|
761
|
-
isComposing?: boolean;
|
|
762
|
-
keyCode?: number;
|
|
763
|
-
target?: unknown;
|
|
764
|
-
preventDefault(): void;
|
|
765
|
-
stopPropagation(): void;
|
|
766
|
-
}
|
|
767
|
-
export interface ConversationComposerApi {
|
|
768
|
-
/** react-dom 不可 import:菜单浮层 portal 由宿主注入。 */
|
|
769
|
-
createPortal(children: unknown, container: Element | DocumentFragment, key?: string): unknown;
|
|
770
|
-
/** 宿主 toast(web `notifications/notify`)。 */
|
|
771
|
-
readonly notify: {
|
|
772
|
-
info(title: string, description?: string): void;
|
|
773
|
-
warning(title: string, description?: string): void;
|
|
774
|
-
error(title: string, description?: string): void;
|
|
775
|
-
};
|
|
776
|
-
/** 宿主 `composerDraftStore`。store hook 原样穿界,hook 规则照常适用。 */
|
|
777
|
-
readonly draft: {
|
|
778
|
-
useStore: ConversationComposerDraftStoreHook;
|
|
779
|
-
/**
|
|
780
|
-
* 按选择器订一条会话草稿的部分字段。结果按浅比较,没变就不重渲染:正文每改一个字
|
|
781
|
-
* 草稿就换新对象,只读附件或手的组件不该跟着醒。草稿不存在时选择器拿到空草稿。
|
|
782
|
-
*/
|
|
783
|
-
useThreadDraftSelector<T>(target: ConversationComposerThreadTarget, selector: (draft: ConversationComposerThreadDraft) => T): T;
|
|
784
|
-
useEffectiveModelState(input: {
|
|
785
|
-
threadRef?: ConversationComposerThreadTarget;
|
|
786
|
-
draftId?: ConversationDraftId;
|
|
787
|
-
providers: ReadonlyArray<ConversationServerProvider>;
|
|
788
|
-
selectedProvider: ConversationProviderDriverKind;
|
|
789
|
-
selectedInstanceId?: ConversationProviderInstanceId | null;
|
|
790
|
-
threadModelSelection: ConversationModelSelection | null | undefined;
|
|
791
|
-
projectModelSelection: ConversationModelSelection | null | undefined;
|
|
792
|
-
settings: ConversationUnifiedSettings;
|
|
793
|
-
}): ConversationEffectiveComposerModelState;
|
|
794
|
-
hydrateImagesFromPersisted(attachments: ReadonlyArray<ConversationPersistedComposerImageAttachment>): ConversationComposerImageAttachment[];
|
|
795
|
-
restoreAttachments(): void;
|
|
796
|
-
};
|
|
797
|
-
/** 宿主 `promptStashStore`。 */
|
|
798
|
-
readonly stash: {
|
|
799
|
-
useStore: ConversationPromptStashStoreHook;
|
|
800
|
-
readonly maxEntries: number;
|
|
801
|
-
partitionAttachments(attachments: ReadonlyArray<ConversationPersistedComposerImageAttachment>): {
|
|
802
|
-
kept: ConversationPersistedComposerImageAttachment[];
|
|
803
|
-
droppedNames: string[];
|
|
804
|
-
};
|
|
805
|
-
};
|
|
806
|
-
/** 宿主 `lib/attachmentUploadQueue`。 */
|
|
807
|
-
readonly uploads: {
|
|
808
|
-
useStore: ConversationAttachmentUploadStoreHook;
|
|
809
|
-
start(input: {
|
|
810
|
-
environmentId: ConversationEnvironmentId;
|
|
811
|
-
image: ConversationComposerImageAttachment;
|
|
812
|
-
}): void;
|
|
813
|
-
retry(input: {
|
|
814
|
-
environmentId: ConversationEnvironmentId;
|
|
815
|
-
image: ConversationComposerImageAttachment;
|
|
816
|
-
}): void;
|
|
817
|
-
release(imageId: string): void;
|
|
818
|
-
};
|
|
819
|
-
/** 宿主 `lib/imageCompression`。 */
|
|
820
|
-
readonly imageCompression: {
|
|
821
|
-
isHeicFile(file: Pick<File, "name" | "type">): boolean;
|
|
822
|
-
prepareForAttachment(file: File, maxBytes: number): Promise<ConversationCompressImageFileResult>;
|
|
823
|
-
compressForStash(file: File): Promise<ConversationCompressStashImageResult>;
|
|
824
|
-
};
|
|
825
|
-
/**
|
|
826
|
-
* 与 provider 目录耦合的派生(实例快照、名片给的旧 slug 别名表不可镜像,全部走宿主函数)。
|
|
827
|
-
* 别名表只在还原存下来的选择时用:选择器里的 slug 来自选项列表,直接对得上。
|
|
828
|
-
*/
|
|
829
|
-
readonly model: {
|
|
830
|
-
createSelection(instanceId: ConversationProviderInstanceId, model: string, options?: ReadonlyArray<ConversationProviderOptionSelection> | null): ConversationModelSelection;
|
|
831
|
-
/** 两份选择的值是否相同(实例 + 型号 + 选项)。服务器回声会重建对象,别按引用判。 */
|
|
832
|
-
selectionsEqual(left: ConversationModelSelection, right: ConversationModelSelection): boolean;
|
|
833
|
-
/** 把快照的 `modelSlugAliases` 折成 `normalizeSlug` 要的简写表;同一份快照对象得到同一张表。 */
|
|
834
|
-
buildSlugAliases(cardAliases: {
|
|
835
|
-
readonly [slug: string]: string;
|
|
836
|
-
} | null | undefined): ReadonlyMap<string, string>;
|
|
837
|
-
normalizeSlug(model: string | null | undefined, aliases?: ReadonlyMap<string, string>): string | null;
|
|
838
|
-
resolveSelectableModel(value: string | null | undefined, options: ReadonlyArray<{
|
|
839
|
-
slug: string;
|
|
840
|
-
name: string;
|
|
841
|
-
}>, aliases?: ReadonlyMap<string, string>): string | null;
|
|
842
|
-
getModelCapabilities(models: ReadonlyArray<ConversationServerProviderModel>, model: string | null | undefined, planModeEnabled?: boolean, aliases?: ReadonlyMap<string, string>): ConversationModelCapabilities;
|
|
843
|
-
deriveInstanceEntries(providers: ReadonlyArray<ConversationServerProvider>): ReadonlyArray<ConversationProviderInstanceEntry>;
|
|
844
|
-
applyInstanceSettings(entries: ReadonlyArray<ConversationProviderInstanceEntry>, settings: ConversationUnifiedSettings): ReadonlyArray<ConversationProviderInstanceEntry>;
|
|
845
|
-
readonly noProviderSelection: ConversationModelSelection;
|
|
846
|
-
makeDriverKind(value: string): ConversationProviderDriverKind;
|
|
847
|
-
getInteractionModeToggle(providers: ReadonlyArray<ConversationServerProvider>, provider: ConversationProviderDriverKind): boolean;
|
|
848
|
-
/**
|
|
849
|
-
* 这一轮按这只手的哪一档跑——座位只画它。宿主开会话时用同一个函数解出同一档交给手,
|
|
850
|
-
* 插件不得自己由 `runtimeMode` 或 `currentNativeModeId` 另推(那就是两个答案)。
|
|
851
|
-
* 返回 null = 这只手不报档,座位画四档。
|
|
852
|
-
*/
|
|
853
|
-
resolveNativeMode(provider: ConversationServerProvider | null | undefined, selection: {
|
|
854
|
-
readonly runtimeMode: ConversationRuntimeMode;
|
|
855
|
-
readonly nativeModeId?: string | null | undefined;
|
|
856
|
-
}): {
|
|
857
|
-
readonly modes: ReadonlyArray<ConversationServerProviderNativeMode>;
|
|
858
|
-
readonly current: ConversationServerProviderNativeMode;
|
|
859
|
-
} | null;
|
|
860
|
-
/**
|
|
861
|
-
* `selectedModel` 只传本线程在这个实例上存着的型号:OpenCode 的目录暂时没有它时,
|
|
862
|
-
* 结果里多一行 `isUnavailable` 的选项,不要换成默认型号。别的实例的型号不要传。
|
|
863
|
-
*/
|
|
864
|
-
getAppModelOptionsForInstance(settings: ConversationUnifiedSettings, entry: ConversationProviderInstanceEntry, selectedModel?: string | null): ReadonlyArray<ConversationAppModelOption>;
|
|
865
|
-
sortProviderModelItems<T extends {
|
|
866
|
-
slug: string;
|
|
867
|
-
instanceId: string;
|
|
868
|
-
}>(items: ReadonlyArray<T>, options?: {
|
|
869
|
-
favoriteModelKeys?: ReadonlySet<string> | ReadonlyArray<string>;
|
|
870
|
-
groupFavorites?: boolean;
|
|
871
|
-
instanceOrder?: ReadonlyArray<string>;
|
|
872
|
-
}): T[];
|
|
873
|
-
/** provider 更新中(rail 角标用)。 */
|
|
874
|
-
isProviderUpdateInFlight(snapshot: ConversationServerProvider): boolean;
|
|
875
|
-
/** 模型选择器一行的动作判定(select / continue / blocked)。 */
|
|
876
|
-
resolvePickerRowAction(input: {
|
|
877
|
-
readonly disabledReason: string | null;
|
|
878
|
-
readonly continuationLabel: string | null;
|
|
879
|
-
}): {
|
|
880
|
-
readonly kind: "select";
|
|
881
|
-
} | {
|
|
882
|
-
readonly kind: "continue";
|
|
883
|
-
readonly label: string;
|
|
884
|
-
} | {
|
|
885
|
-
readonly kind: "blocked";
|
|
886
|
-
readonly reason: string;
|
|
887
|
-
};
|
|
888
|
-
};
|
|
889
|
-
/** 宿主 `plugins/pluginComposer` 的选项查询。 */
|
|
890
|
-
readonly pluginComposer: {
|
|
891
|
-
useOptions(environmentId: ConversationEnvironmentId | null, projectId: ConversationProjectId | null): ConversationPluginComposerChoices;
|
|
892
|
-
};
|
|
893
|
-
/** 宿主客户端设置(模型收藏、环境标识模式)。 */
|
|
894
|
-
readonly settings: {
|
|
895
|
-
useClientSettings<T = unknown>(selector?: (settings: {
|
|
896
|
-
favorites?: ConversationModelFavorite[] | undefined;
|
|
897
|
-
}) => T): T;
|
|
898
|
-
useUpdateClientSettings(): (patch: {
|
|
899
|
-
favorites?: ConversationModelFavorite[];
|
|
900
|
-
}) => void;
|
|
901
|
-
useEnvironmentIdentificationMode(): string;
|
|
902
|
-
};
|
|
903
|
-
readonly environment: {
|
|
904
|
-
useActiveEnvironmentId(): ConversationEnvironmentId | null;
|
|
905
|
-
};
|
|
906
|
-
/** thread preset 列表(宿主 serverEnvironment 查询封装)。 */
|
|
907
|
-
readonly presets: ConversationPresetApi;
|
|
908
|
-
/** 同屏会话仲裁(宿主 useChatPaneKeydown / chatPaneVisibility)。 */
|
|
909
|
-
readonly pane: {
|
|
910
|
-
useKeydown(onKeydown: (event: KeyboardEvent) => void, options?: {
|
|
911
|
-
capture?: boolean;
|
|
912
|
-
target?: "window" | "document";
|
|
913
|
-
}): void;
|
|
914
|
-
useActive(): boolean;
|
|
915
|
-
useVisible(): boolean;
|
|
916
|
-
};
|
|
917
|
-
/** 宿主 `keybindings.ts` 的快捷键解析。 */
|
|
918
|
-
readonly keybindings: {
|
|
919
|
-
resolveShortcutCommand(event: ConversationShortcutEventLike, keybindings: ConversationResolvedKeybindingsConfig, options?: ConversationShortcutMatchOptions): ConversationKeybindingCommand | null;
|
|
920
|
-
approvalDecisionFromCommand(command: string | null): ConversationProviderApprovalDecision | null;
|
|
921
|
-
modelPickerJumpCommandForIndex(index: number): string | null;
|
|
922
|
-
modelPickerJumpIndexFromCommand(command: string): number | null;
|
|
923
|
-
shortcutLabelForCommand(keybindings: ConversationResolvedKeybindingsConfig, command: ConversationKeybindingCommand, options?: ConversationShortcutMatchOptions | string): string | null;
|
|
924
|
-
};
|
|
925
|
-
readonly terminalFocus: {
|
|
926
|
-
getOwner(): unknown;
|
|
927
|
-
};
|
|
928
|
-
readonly commandPalette: {
|
|
929
|
-
isOpen(): boolean;
|
|
930
|
-
};
|
|
931
|
-
/** 宿主 `lib/composerPathSearchState`(RPC 查询封装)。 */
|
|
932
|
-
readonly pathSearch: {
|
|
933
|
-
useComposerPathSearch(target: {
|
|
934
|
-
environmentId: ConversationEnvironmentId;
|
|
935
|
-
cwd: string | null;
|
|
936
|
-
query: string | null;
|
|
937
|
-
}): ConversationComposerPathSearchState;
|
|
938
|
-
};
|
|
939
|
-
/**
|
|
940
|
-
* 宿主按项目目录查斜杠命令与技能(`provider.readWorkspaceInventory`,宿主自己缓存与失效)。
|
|
941
|
-
* 输入区的 `/` 与 `$` 菜单读它,而不是 provider 快照里整台机器的那份:项目自带的命令与技能
|
|
942
|
-
* 只有在那个目录里才查得到。
|
|
943
|
-
*/
|
|
944
|
-
readonly providerInventory: {
|
|
945
|
-
/**
|
|
946
|
-
* 返回 `target` 这个(实例、目录)的列表;还没回来、老服务器不认、环境/实例/目录未知、
|
|
947
|
-
* 或结果不是这个目标的,都返回 `null`,调用方沿用快照里的列表。
|
|
948
|
-
*/
|
|
949
|
-
useWorkspaceInventory(target: {
|
|
950
|
-
environmentId: ConversationEnvironmentId;
|
|
951
|
-
instanceId: ConversationProviderInstanceId | null;
|
|
952
|
-
cwd: string | null;
|
|
953
|
-
/** 已存在的服务端会话的线程 id;带上就叠加 agent 在该会话里自报的命令。草稿给 null。 */
|
|
954
|
-
threadId: ConversationThreadId | null;
|
|
955
|
-
}): ConversationWorkspaceInventory | null;
|
|
956
|
-
};
|
|
957
|
-
/** 宿主 `lib/terminalContext` 的纯函数(占位符增删)。 */
|
|
958
|
-
readonly terminalContext: {
|
|
959
|
-
insertInlinePlaceholder(prompt: string, cursor: number): {
|
|
960
|
-
prompt: string;
|
|
961
|
-
cursor: number;
|
|
962
|
-
contextIndex: number;
|
|
963
|
-
};
|
|
964
|
-
removeInlinePlaceholder(prompt: string, contextIndex: number): {
|
|
965
|
-
prompt: string;
|
|
966
|
-
cursor: number;
|
|
967
|
-
};
|
|
968
|
-
};
|
|
969
|
-
/** 宿主 `lib/elementContext` 的标签格式化。 */
|
|
970
|
-
readonly elementContext: {
|
|
971
|
-
formatLabel(context: ConversationElementContextSelection): string;
|
|
972
|
-
formatSourceLabel(context: ConversationElementContextSelection): string | null;
|
|
973
|
-
normalizeSelection(value: unknown): ConversationElementContextDraft | null;
|
|
974
|
-
};
|
|
975
|
-
/** 宿主 `ChatView.logic` 的发送态派生。 */
|
|
976
|
-
readonly chat: {
|
|
977
|
-
deriveComposerSendState(options: {
|
|
978
|
-
prompt: string;
|
|
979
|
-
imageCount: number;
|
|
980
|
-
terminalContexts: ReadonlyArray<ConversationTerminalContextDraft>;
|
|
981
|
-
elementContextCount?: number;
|
|
982
|
-
}): ConversationComposerSendState;
|
|
983
|
-
};
|
|
984
|
-
readonly theme: {
|
|
985
|
-
useResolvedTheme(): "light" | "dark";
|
|
986
|
-
};
|
|
987
|
-
/** 当前 i18n 语言(DiffStatLabel 的 aria 文案用 Intl.ListFormat)。 */
|
|
988
|
-
readonly i18n: {
|
|
989
|
-
useLanguage(): string;
|
|
990
|
-
};
|
|
991
|
-
/** dev backdrop(环境标识为 artwork 时的启动按钮背景)。 */
|
|
992
|
-
readonly devBackdrop: {
|
|
993
|
-
useVisible(enabled: boolean): boolean;
|
|
994
|
-
};
|
|
995
|
-
/** 文件图标 sprite(宿主 vendored Symbols 图标集 + 注入器)。 */
|
|
996
|
-
readonly pierreIcons: {
|
|
997
|
-
useSpriteReady(): boolean;
|
|
998
|
-
ensureSprite(): void;
|
|
999
|
-
resolveForEntry(path: string, kind: "file" | "directory"): ConversationPierreIconResolution;
|
|
1000
|
-
};
|
|
1001
|
-
}
|
|
1002
|
-
export interface ConversationComposerHandle {
|
|
1003
|
-
focusAtEnd(): void;
|
|
1004
|
-
focusAt(cursor: number): void;
|
|
1005
|
-
addDroppedFiles(files: File[]): void;
|
|
1006
|
-
/** 拖入的文件夹:能解析出本机路径就插成路径引用,否则提示。宿主没接线时可以不调用。 */
|
|
1007
|
-
addDroppedFolders?(folders: File[]): void;
|
|
1008
|
-
insertTextAtEnd(text: string, options?: {
|
|
1009
|
-
ensureLeadingBoundary?: boolean;
|
|
1010
|
-
}): boolean;
|
|
1011
|
-
toggleModelPicker(): void;
|
|
1012
|
-
/** 快捷键换权限档:座位画什么就轮什么(这只手自己的档,或宿主四档)。 */
|
|
1013
|
-
cyclePermissionMode(direction: 1 | -1): void;
|
|
1014
|
-
/**
|
|
1015
|
-
* 这次发送的身份:插件动作 + 正文。
|
|
1016
|
-
*
|
|
1017
|
-
* **只给「等一个异步操作回来后,确认用户没改主意」用。** 发送时要先问插件把正文
|
|
1018
|
-
* 准备好,那是一次往返;回来时用户可能已经换了插件动作或改了字,这两样任一变了
|
|
1019
|
-
* 就得丢弃这次发送。
|
|
1020
|
-
*
|
|
1021
|
-
* 它是命令式的(读此刻真值),不能换成订阅——订阅拿到的是最后推送过的值,在
|
|
1022
|
-
* React 还没重渲染时会是旧的,这个防护就废了。
|
|
1023
|
-
*
|
|
1024
|
-
* 要防的东西变多(比如模型也不许换)就往这里加字段,别回头去读整个发送上下文:
|
|
1025
|
-
* 那样谁都能在 await 之后读任意状态,没人说得清哪些是真需要的。
|
|
1026
|
-
*/
|
|
1027
|
-
readSendIdentity(): {
|
|
1028
|
-
pluginActionId: string | null;
|
|
1029
|
-
prompt: string;
|
|
1030
|
-
};
|
|
1031
|
-
readSnapshot(): {
|
|
1032
|
-
value: string;
|
|
1033
|
-
cursor: number;
|
|
1034
|
-
expandedCursor: number;
|
|
1035
|
-
terminalContextIds: string[];
|
|
1036
|
-
};
|
|
1037
|
-
/** 外部改写 prompt(如 onSend 后)之后重置光标 / 触发 / 高亮。 */
|
|
1038
|
-
resetCursorState(options?: {
|
|
1039
|
-
cursor?: number;
|
|
1040
|
-
prompt?: string;
|
|
1041
|
-
detectTrigger?: boolean;
|
|
1042
|
-
}): void;
|
|
1043
|
-
/** 从终端抽屉插入一段终端上下文。 */
|
|
1044
|
-
addTerminalContext(selection: ConversationTerminalContextSelection): void;
|
|
1045
|
-
/** 发送前读取 composer 的完整选择状态。 */
|
|
1046
|
-
getSendContext(): {
|
|
1047
|
-
prompt: string;
|
|
1048
|
-
images: ConversationComposerImageAttachment[];
|
|
1049
|
-
terminalContexts: ConversationTerminalContextDraft[];
|
|
1050
|
-
elementContexts: ConversationElementContextDraft[];
|
|
1051
|
-
previewAnnotations: ConversationPreviewAnnotationPayload[];
|
|
1052
|
-
reviewComments: ConversationReviewCommentContext[];
|
|
1053
|
-
selectedModelOptionsForDispatch: unknown;
|
|
1054
|
-
selectedModelSelection: ConversationModelSelection;
|
|
1055
|
-
selectedNativeModeId?: string;
|
|
1056
|
-
providerAvailable: boolean;
|
|
1057
|
-
selectedProvider: ConversationProviderDriverKind;
|
|
1058
|
-
selectedModel: string;
|
|
1059
|
-
/** 与输入区座位、发送闸同一处结论。不是 `known` 时 `selectedModel` 是空串,别发。 */
|
|
1060
|
-
selectedModelStatus: ConversationComposerModelStatus;
|
|
1061
|
-
selectedProviderModels: ReadonlyArray<ConversationServerProviderModel>;
|
|
1062
|
-
selectedPluginAction: ConversationPluginComposerOption | null;
|
|
1063
|
-
};
|
|
1064
|
-
/** provider turn 开始前校验合成输入。 */
|
|
1065
|
-
validateProviderInput(providerInput: string): boolean;
|
|
1066
|
-
}
|
|
1067
|
-
/**
|
|
1068
|
-
* 同步发送读的那份上下文。子组件把读函数推到宿主的 ref 上,宿主不要经
|
|
1069
|
-
* imperative handle 反问。await 之后核对用户有没有改主意,仍用 `readSendIdentity`。
|
|
1070
|
-
*/
|
|
1071
|
-
export type ConversationComposerSendContextReader = ConversationComposerHandle["getSendContext"];
|
|
1072
|
-
export type ConversationTimelineRow = {
|
|
1073
|
-
readonly kind: "turn-identity";
|
|
1074
|
-
readonly id: string;
|
|
1075
|
-
readonly turnId: string;
|
|
1076
|
-
readonly createdAt: string;
|
|
1077
|
-
readonly badge: ConversationModelBadge;
|
|
1078
|
-
} | {
|
|
1079
|
-
readonly kind: "turn-summary";
|
|
1080
|
-
readonly id: string;
|
|
1081
|
-
readonly createdAt: string;
|
|
1082
|
-
readonly footer: ConversationTurnFooter;
|
|
1083
|
-
readonly copyText?: string | undefined;
|
|
1084
|
-
readonly cardAnchor?: true | undefined;
|
|
1085
|
-
/** 同一轮的身份行(谁答的、何时开始):回答上方不画标题行,在轮次末尾那排给。 */
|
|
1086
|
-
readonly identity?: Extract<ConversationTimelineRow, {
|
|
1087
|
-
kind: "turn-identity";
|
|
1088
|
-
}>;
|
|
1089
|
-
} | {
|
|
1090
|
-
readonly kind: "tool-group";
|
|
1091
|
-
readonly id: string;
|
|
1092
|
-
readonly createdAt: string;
|
|
1093
|
-
readonly groupId: string;
|
|
1094
|
-
readonly entries: readonly ConversationWorkEntry[];
|
|
1095
|
-
} | {
|
|
1096
|
-
readonly kind: "work";
|
|
1097
|
-
readonly id: string;
|
|
1098
|
-
readonly createdAt: string;
|
|
1099
|
-
readonly groupedEntries: ConversationWorkEntry[];
|
|
1100
|
-
readonly isExpandedToolGroupEntry: boolean;
|
|
1101
|
-
readonly isLastExpandedToolGroupEntry: boolean;
|
|
1102
|
-
} | {
|
|
1103
|
-
readonly kind: "message";
|
|
1104
|
-
readonly id: string;
|
|
1105
|
-
readonly createdAt: string;
|
|
1106
|
-
readonly message: ConversationChatMessage;
|
|
1107
|
-
readonly presentation?: "full" | "compact" | undefined;
|
|
1108
|
-
readonly textTone?: "primary" | "process" | undefined;
|
|
1109
|
-
readonly durationStart: string;
|
|
1110
|
-
readonly showAssistantMeta: boolean;
|
|
1111
|
-
readonly showAssistantCopyButton: boolean;
|
|
1112
|
-
readonly copyInFooter?: boolean | undefined;
|
|
1113
|
-
readonly assistantCopyStreaming: boolean;
|
|
1114
|
-
readonly modelBadge: ConversationModelBadge | null;
|
|
1115
|
-
} | {
|
|
1116
|
-
readonly kind: "model-switch";
|
|
1117
|
-
readonly id: string;
|
|
1118
|
-
readonly createdAt: string;
|
|
1119
|
-
readonly badge: ConversationModelBadge;
|
|
1120
|
-
readonly pending: boolean;
|
|
1121
|
-
} | {
|
|
1122
|
-
readonly kind: "proposed-plan";
|
|
1123
|
-
readonly id: string;
|
|
1124
|
-
readonly createdAt: string;
|
|
1125
|
-
readonly proposedPlan: ConversationProposedPlan;
|
|
1126
|
-
} | {
|
|
1127
|
-
readonly kind: "turn-plan";
|
|
1128
|
-
readonly id: string;
|
|
1129
|
-
readonly createdAt: string;
|
|
1130
|
-
readonly turnPlan: ConversationTurnPlan;
|
|
1131
|
-
} | {
|
|
1132
|
-
readonly kind: "working";
|
|
1133
|
-
readonly id: string;
|
|
1134
|
-
readonly turnId?: string | null | undefined;
|
|
1135
|
-
readonly createdAt: string | null;
|
|
1136
|
-
readonly modelBadge?: ConversationModelBadge | undefined;
|
|
1137
|
-
readonly compacting: boolean;
|
|
1138
|
-
};
|
|
1139
|
-
/** 一轮一组的区间表(宿主 `TimelineTurnGroup` 的结构子集;rows 下标区间)。 */
|
|
1140
|
-
export interface ConversationTurnGroup {
|
|
1141
|
-
readonly key: string;
|
|
1142
|
-
readonly start: number;
|
|
1143
|
-
readonly end: number;
|
|
1144
|
-
}
|
|
1145
|
-
/** 一轮一节的分节模型:插件用随迁的纯函数从 rows + groups 构建。 */
|
|
1146
|
-
export interface ConversationTurnSection {
|
|
1147
|
-
readonly key: string;
|
|
1148
|
-
readonly turnId: string | null;
|
|
1149
|
-
readonly rows: readonly ConversationTimelineRow[];
|
|
1150
|
-
}
|
|
1151
|
-
/** 轮次导航面板里一节的可读摘要。 */
|
|
1152
|
-
export interface ConversationTurnSectionSummary {
|
|
1153
|
-
readonly sectionKey: string;
|
|
1154
|
-
readonly anchorRowId: string;
|
|
1155
|
-
readonly userText: string | null;
|
|
1156
|
-
readonly assistantText: string | null;
|
|
1157
|
-
readonly headerText: string | null;
|
|
1158
|
-
}
|
|
1159
|
-
export interface ConversationRowsDeriveInput {
|
|
1160
|
-
readonly activities: readonly ConversationThreadActivity[];
|
|
1161
|
-
readonly timelineEntries: readonly ConversationTimelineEntry[];
|
|
1162
|
-
readonly latestTurn: ConversationLatestTurn | null;
|
|
1163
|
-
readonly runningTurnId: string | null;
|
|
1164
|
-
/** 插件本地展开态:用户显式展开 + 本会话自动展开(含中断保留)。 */
|
|
1165
|
-
readonly expandedTurnIds: ReadonlySet<string>;
|
|
1166
|
-
readonly isWorking: boolean;
|
|
1167
|
-
readonly activeTurnStartedAt: string | null;
|
|
1168
|
-
readonly resolveModelBadge: ((selection: ConversationModelSelection | undefined) => ConversationModelBadge | null) | undefined;
|
|
1169
|
-
readonly pendingModelSelection: ConversationModelSelection | null | undefined;
|
|
1170
|
-
}
|
|
1171
|
-
/** 宿主已知轮次的行缓存键(插件持有缓存,键值对插件不透明)。 */
|
|
1172
|
-
export type ConversationKnownTurns = ReadonlyMap<string, ConversationLatestTurn>;
|
|
1173
|
-
export interface ConversationDerivedRows {
|
|
1174
|
-
readonly rows: ConversationTimelineRow[];
|
|
1175
|
-
readonly turnGroups: readonly ConversationTurnGroup[];
|
|
1176
|
-
}
|
|
1177
|
-
/** 最新一轮的派生输入(宿主 `TimelineLatestTurn` 的结构子集)。 */
|
|
1178
|
-
export interface ConversationLatestTurn {
|
|
1179
|
-
readonly turnId: string;
|
|
1180
|
-
readonly state: string;
|
|
1181
|
-
readonly requestedAt?: string | undefined;
|
|
1182
|
-
readonly startedAt: string | null;
|
|
1183
|
-
readonly completedAt: string | null;
|
|
1184
|
-
readonly userMessageId: string | null;
|
|
1185
|
-
readonly assistantMessageId: string | null;
|
|
1186
|
-
readonly modelSelection?: ConversationModelSelection | undefined;
|
|
1187
|
-
readonly waitSpans?: unknown;
|
|
1188
|
-
}
|
|
1189
|
-
/** 行派生缓存。`deriveGroups` 是纯函数;缓存身份归插件,跨派生复用行对象。 */
|
|
1190
|
-
export interface ConversationRowsCache {
|
|
1191
|
-
deriveGroups(input: ConversationRowsDeriveInput): ConversationDerivedRows;
|
|
1192
|
-
}
|
|
1193
|
-
/** `parseSystemNotificationText` 的结果(宿主 `ParsedSystemNotification` 的子集)。 */
|
|
1194
|
-
export interface ConversationParsedSystemNotification {
|
|
1195
|
-
readonly childThreadId: string;
|
|
1196
|
-
readonly title: string;
|
|
1197
|
-
readonly kind: "child.settled" | "child.failed" | "child.approval" | "child.stopped" | "plugin.notice" | "selfdev.resolved";
|
|
1198
|
-
readonly requestId: string | null;
|
|
1199
|
-
readonly summary: string;
|
|
1200
|
-
}
|
|
1201
|
-
/** `parseThreadHandoverText` 的结果(宿主 `ParsedThreadHandover` 的子集)。 */
|
|
1202
|
-
export interface ConversationParsedThreadHandover {
|
|
1203
|
-
readonly sourceThreadId: string;
|
|
1204
|
-
readonly includedTurns: number;
|
|
1205
|
-
readonly body: string;
|
|
1206
|
-
}
|
|
1207
|
-
/** `parsePresetPrefixText` 的结果(宿主 `ParsedPresetPrefix` 的子集)。 */
|
|
1208
|
-
export interface ConversationParsedPresetPrefix {
|
|
1209
|
-
readonly presetId: string;
|
|
1210
|
-
readonly prefix: string;
|
|
1211
|
-
/** 前缀块后面用户自己写的那半,可能为空。 */
|
|
1212
|
-
readonly body: string;
|
|
1213
|
-
}
|
|
1214
|
-
/** 卡住提示的可读子集(宿主 `TurnStallState` 的结构子集)。 */
|
|
1215
|
-
export interface ConversationTurnStall {
|
|
1216
|
-
readonly reason: "childThread" | "tool" | "approval" | "userInput" | "model";
|
|
1217
|
-
/** 最后一次有动静的时刻,插件按它自己走秒。 */
|
|
1218
|
-
readonly since: string;
|
|
1219
|
-
}
|
|
1220
|
-
/** 滚动落点:视口顶对应行的 id 与相对行顶的偏移;负值保留行前留白。 */
|
|
1221
|
-
export interface ConversationScrollAnchor {
|
|
1222
|
-
readonly rowId: string;
|
|
1223
|
-
readonly offsetPx: number;
|
|
1224
|
-
}
|
|
1225
|
-
/** 工具行的状态点取值;非工具行为 null。 */
|
|
1226
|
-
export type ConversationWorkEntryStatus = "success" | "failed" | "running" | null;
|
|
1227
|
-
/** 折叠工具组按动作分类的口径(宿主 `ToolGroupAction`)。 */
|
|
1228
|
-
export type ConversationToolGroupAction = "read" | "edit" | "command" | "code-search" | "search" | "other";
|
|
1229
|
-
export interface ConversationDeriveApi extends ConversationMessageLinkText {
|
|
1230
|
-
/** 每个时间线实例建一份(插件侧 useRef 持有)。 */
|
|
1231
|
-
createRowsCache(): ConversationRowsCache;
|
|
1232
|
-
/** 滚动是否已到末尾的判定(保持与宿主一致的容差)。 */
|
|
1233
|
-
resolveIsAtEnd(state: {
|
|
1234
|
-
isAtEnd?: boolean | undefined;
|
|
1235
|
-
contentLength?: number | undefined;
|
|
1236
|
-
scroll?: number | undefined;
|
|
1237
|
-
scrollLength?: number | undefined;
|
|
1238
|
-
} | undefined, endInset: number): boolean | undefined;
|
|
1239
|
-
/** 合组锚翻译:tool-group 自锚 id → 组行 id。 */
|
|
1240
|
-
resolveToolGroupRevealRowId(rows: readonly ConversationTimelineRow[], rowId: string): string;
|
|
1241
|
-
/** 时间线上真正摊开的轮次:用户显式展开 + 本会话自动展开(含中断保留)。 */
|
|
1242
|
-
resolveExpandedTurnIds(persistedTurnIds: readonly string[], autoExpandedTurnIds: ReadonlySet<string>): ReadonlySet<string>;
|
|
1243
|
-
/** 系统通知 / 会话移交 / preset 前缀文案的解析(消息行按内容切换呈现)。 */
|
|
1244
|
-
parseSystemNotificationText(text: string): ConversationParsedSystemNotification | null;
|
|
1245
|
-
parseThreadHandoverText(text: string): ConversationParsedThreadHandover | null;
|
|
1246
|
-
parsePresetPrefixText(text: string): ConversationParsedPresetPrefix | null;
|
|
1247
|
-
/** provider 重试提示文案。文案 key 归插件词表(providerRetry.*),宿主函数
|
|
1248
|
-
* 只组模板参数。 */
|
|
1249
|
-
providerRetryMessage(state: unknown, t: (key: string, options?: Record<string, unknown>) => string): string;
|
|
1250
|
-
/** 助手消息复制按钮的可见性(流式中/空回复不画)。 */
|
|
1251
|
-
resolveAssistantMessageCopyState(input: {
|
|
1252
|
-
readonly text: string | null;
|
|
1253
|
-
readonly showCopyButton: boolean;
|
|
1254
|
-
readonly streaming: boolean;
|
|
1255
|
-
}): {
|
|
1256
|
-
readonly text: string | null;
|
|
1257
|
-
readonly visible: boolean;
|
|
1258
|
-
};
|
|
1259
|
-
/** 助手正文是否保留原始换行(特定标记的正文按原样显示)。 */
|
|
1260
|
-
shouldPreserveAssistantLineBreaks(text: string): boolean;
|
|
1261
|
-
/** 思考/折叠回复的一行预览(与宿主同一条末行有效规则)。 */
|
|
1262
|
-
reasoningPreviewText(text: string): string;
|
|
1263
|
-
/** 工具行状态点(失败优先于进行中);非工具行为 null。 */
|
|
1264
|
-
resolveWorkEntryStatus(entry: ConversationWorkEntry): ConversationWorkEntryStatus;
|
|
1265
|
-
/** 这条工具记录按展示口径算不算失败(红字/红点/失败计数)。 */
|
|
1266
|
-
workEntryIndicatesFailure(entry: ConversationWorkEntry): boolean;
|
|
1267
|
-
/** 一组工具调用按动作分类(图标与计数)。 */
|
|
1268
|
-
toolGroupAction(entry: ConversationWorkEntry): ConversationToolGroupAction;
|
|
1269
|
-
/** 工具记录里的命令文本(结构化输入优先于回显)。 */
|
|
1270
|
-
resolveToolCommand(entry: ConversationWorkEntry): string | undefined;
|
|
1271
|
-
/** 参数 JSON 里的命令与 description 摘要。 */
|
|
1272
|
-
parseToolCommandInput(input: unknown): {
|
|
1273
|
-
readonly command?: string | undefined;
|
|
1274
|
-
readonly description?: string | undefined;
|
|
1275
|
-
} | null;
|
|
1276
|
-
/** 末条助手消息是否已完整落地(shell 与明细独立到达,流式半段不算)。 */
|
|
1277
|
-
hasSettledAssistantMessage(entries: readonly ConversationTimelineEntry[], messageId: string | null): boolean;
|
|
1278
|
-
}
|
|
41
|
+
import type { ConversationThreadActivity, ConversationTimelineEntry, ConversationTurnUsage } from "./conversationBase.ts";
|
|
42
|
+
export type * from "./conversationBase.ts";
|
|
43
|
+
import type { ConversationApprovalRequestId, ConversationComposerOccupant, ConversationContextWindowSnapshot, ConversationEnvironmentId, ConversationModelSelection, ConversationPendingApproval, ConversationPendingUserInput, ConversationPendingUserInputDraftAnswer, ConversationProjectId, ConversationProviderApprovalDecision, ConversationProviderDriverKind, ConversationProviderInteractionMode, ConversationQuestions, ConversationRuntimeMode, ConversationServerProvider, ConversationThreadId } from "./conversationHostModels.ts";
|
|
44
|
+
export type * from "./conversationHostModels.ts";
|
|
45
|
+
export type * from "./conversationDrafts.ts";
|
|
46
|
+
export type * from "./conversationComposerEnvironment.ts";
|
|
47
|
+
export type * from "./conversationComposerApi.ts";
|
|
48
|
+
export type * from "./conversationComposerHandle.ts";
|
|
49
|
+
export type * from "./conversationRows.ts";
|
|
50
|
+
import type { ConversationLatestTurn, ConversationTurnStall } from "./conversationDerive.ts";
|
|
51
|
+
export type * from "./conversationDerive.ts";
|
|
52
|
+
import type { ConversationComposerBanners, ConversationComposerStatus, ConversationTrajectoryToolCallDetailData, ConversationVisibleTurnRange } from "./conversationViewProps.ts";
|
|
53
|
+
export type * from "./conversationViewProps.ts";
|
|
1279
54
|
export type { ConversationQueuedMessageEdit, ConversationQueuedAttachment, ConversationQueueEntry, ConversationPendingQueueSubmission, ConversationQueueState, ConversationQueueActions, } from "./conversation-queue.ts";
|
|
1280
55
|
/**
|
|
1281
56
|
* 宿主数据接口的契约版本。宿主与插件各自编译进自己构建时的这个数字;两边不一致时
|
|
@@ -1621,353 +396,6 @@ export interface ConversationComposerPlan {
|
|
|
1621
396
|
readonly status: "pending" | "inProgress" | "completed";
|
|
1622
397
|
}[] | null;
|
|
1623
398
|
}
|
|
1624
|
-
export type ConversationViewMode = "chat" | "trajectory" | "map";
|
|
1625
|
-
/** 会话身份与多 pane 仲裁。`active` 为 false 的实例不得绑定全局监听。 */
|
|
1626
|
-
export interface ConversationScopeProps {
|
|
1627
|
-
readonly environmentId: string;
|
|
1628
|
-
readonly threadId: string;
|
|
1629
|
-
/** 会话路由键(宿主 scoped thread key),草稿会话也有稳定值。 */
|
|
1630
|
-
readonly threadKey: string;
|
|
1631
|
-
/** 这是同屏会话里接收全局操作的那一个。 */
|
|
1632
|
-
readonly active: boolean;
|
|
1633
|
-
/** 面板可见(保活隐藏时为 false:停观察器、停测量、停跟随)。 */
|
|
1634
|
-
readonly visible: boolean;
|
|
1635
|
-
/** 处于同屏分组中。 */
|
|
1636
|
-
readonly grouped: boolean;
|
|
1637
|
-
}
|
|
1638
|
-
export interface ConversationModeProps {
|
|
1639
|
-
readonly mode: ConversationViewMode;
|
|
1640
|
-
/** 持久化归宿主;插件只上报用户选择。 */
|
|
1641
|
-
onModeChange(mode: ConversationViewMode): void;
|
|
1642
|
-
}
|
|
1643
|
-
/** 聊天/轨迹切换的快捷键展示文案(宿主解析键位绑定,插件不读键位配置)。 */
|
|
1644
|
-
export interface ConversationShortcutLabels {
|
|
1645
|
-
readonly toggleTrajectory: string | null;
|
|
1646
|
-
readonly interrupt: string | null;
|
|
1647
|
-
}
|
|
1648
|
-
/**
|
|
1649
|
-
* 宿主驱动聊天时间线的入口。跟随末尾、「回到底部」与手势停跟都归插件,宿主只在
|
|
1650
|
-
* 自己发出消息后请求回到末尾。
|
|
1651
|
-
*/
|
|
1652
|
-
export interface ConversationTimelineControl {
|
|
1653
|
-
/**
|
|
1654
|
-
* 解除展开阅读锁、恢复跟随并滚到末尾。聊天停在历史窗口时先经数据窗口的
|
|
1655
|
-
* `onReturnToLatest` 换回最新页;时间线不可见时等重新可见再滚。
|
|
1656
|
-
*/
|
|
1657
|
-
followEnd(options?: {
|
|
1658
|
-
readonly animated?: boolean;
|
|
1659
|
-
}): void;
|
|
1660
|
-
}
|
|
1661
|
-
/** 可见和受交互保护的轮次;历史页保留归宿主,插件只报告当前呈现范围。 */
|
|
1662
|
-
export interface ConversationVisibleTurnRange {
|
|
1663
|
-
readonly selectionTurnRange?: {
|
|
1664
|
-
readonly firstTurnId: ConversationTurnId;
|
|
1665
|
-
readonly lastTurnId: ConversationTurnId;
|
|
1666
|
-
} | null;
|
|
1667
|
-
readonly firstTurnId: ConversationTurnId | null;
|
|
1668
|
-
readonly lastTurnId: ConversationTurnId | null;
|
|
1669
|
-
readonly protectedTurnIds: ReadonlyArray<ConversationTurnId>;
|
|
1670
|
-
}
|
|
1671
|
-
export interface ConversationTimelineProps {
|
|
1672
|
-
/** 行派生(= ConversationViewProps.derive;时间线经 ctx 下发给行组件)。 */
|
|
1673
|
-
readonly derive: ConversationDeriveApi;
|
|
1674
|
-
/** 会话路由键:开合态、滚动落点、已读上报都按它隔离(= scope.threadKey)。 */
|
|
1675
|
-
readonly threadKey: string;
|
|
1676
|
-
/** 宿主 ScopedThreadRef(对插件不透明):markdown/计划卡按它取机器上下文。 */
|
|
1677
|
-
readonly threadRef: unknown;
|
|
1678
|
-
/** 会话所属机器(= scope.environmentId):计划卡保存走它。 */
|
|
1679
|
-
readonly environmentId: string;
|
|
1680
|
-
readonly threadTitle: string;
|
|
1681
|
-
readonly resolveModelBadge: ((selection: ConversationModelSelection | undefined) => ConversationModelBadge | null) | undefined;
|
|
1682
|
-
readonly markdownCwd: string | undefined;
|
|
1683
|
-
readonly resolvedTheme: "light" | "dark";
|
|
1684
|
-
readonly timestampFormat: string;
|
|
1685
|
-
readonly workspaceRoot: string | undefined;
|
|
1686
|
-
readonly skills: ReadonlyArray<ConversationTimelineSkill>;
|
|
1687
|
-
readonly contentInsetEndAdjustment: number;
|
|
1688
|
-
readonly awaitingUserDecision: boolean;
|
|
1689
|
-
readonly hideEmptyPlaceholder: boolean;
|
|
1690
|
-
readonly topFadeEnabled: boolean;
|
|
1691
|
-
/** 宿主拿到的时间线控制入口;插件在挂载、换会话与卸载时同步它。 */
|
|
1692
|
-
readonly controlRef: {
|
|
1693
|
-
current: ConversationTimelineControl | null;
|
|
1694
|
-
} | ((control: ConversationTimelineControl | null) => void);
|
|
1695
|
-
readonly agentPanelModel: unknown;
|
|
1696
|
-
/** 草稿/断开会话传 null:决定卡只显示状态、无按钮。 */
|
|
1697
|
-
readonly onRespondToDecision: ((requestId: string, optionId: string) => void) | null;
|
|
1698
|
-
readonly onInterrupt: (() => void) | null;
|
|
1699
|
-
/** 结果是服务器是否受理:true 时「取消」保持停用,等订阅推回新状态;false 时恢复可点。 */
|
|
1700
|
-
readonly onCancelScheduledWake: ((wakeId: string) => Promise<boolean>) | null;
|
|
1701
|
-
readonly onOpenFileDiff: (filePath: string) => void;
|
|
1702
|
-
readonly onForkFromUserMessage: ((messageId: string) => void) | null;
|
|
1703
|
-
/** 当前登录者;用户消息作者是它或没有作者时画成「你说的」,否则在气泡上方署名。 */
|
|
1704
|
-
readonly selfUserId?: string | null | undefined;
|
|
1705
|
-
/** 插件交 `ConversationExpandedImagePreview`;宿主的 Markdown 也经它交宿主自己的形状,所以参数是 unknown。 */
|
|
1706
|
-
readonly onImageExpand: (preview: unknown) => void;
|
|
1707
|
-
/** 附件区的文档卡(PDF、Office)在宿主的文档查看器里打开。可选:宿主没给时卡片照旧是新标签页链接。 */
|
|
1708
|
-
readonly onAttachmentDocumentOpen?: ConversationAttachmentDocumentOpen | undefined;
|
|
1709
|
-
readonly onOpenAgents: (() => void) | null;
|
|
1710
|
-
/**
|
|
1711
|
-
* 工具呈现接缝:一组工具/过程行的展开体。宿主先用现有实现渲染,接
|
|
1712
|
-
* tool-display 插件后改指其视图;缺省时插件画极简回退(标题+摘要)。
|
|
1713
|
-
*/
|
|
1714
|
-
readonly renderWorkGroup?: ((input: {
|
|
1715
|
-
readonly row: ConversationTimelineRow;
|
|
1716
|
-
readonly threadRef: unknown;
|
|
1717
|
-
readonly visible: boolean;
|
|
1718
|
-
}) => unknown) | undefined;
|
|
1719
|
-
/** 折叠工具组的展开详情接缝(懒加载的工具调用输入/输出)。 */
|
|
1720
|
-
readonly renderToolCallDetail?: ((input: {
|
|
1721
|
-
readonly entry: ConversationWorkEntry;
|
|
1722
|
-
readonly threadRef: unknown;
|
|
1723
|
-
readonly threadKey: string;
|
|
1724
|
-
readonly workspaceRoot: string | undefined;
|
|
1725
|
-
readonly revision: string;
|
|
1726
|
-
readonly onOpenFileDiff: (filePath: string) => void;
|
|
1727
|
-
readonly onDisclosureChange?: (() => void) | undefined;
|
|
1728
|
-
}) => unknown) | undefined;
|
|
1729
|
-
/** 滚动落点持久化(卸载前保存、重挂恢复)。 */
|
|
1730
|
-
loadScrollAnchor(threadKey: string): ConversationScrollAnchor | null;
|
|
1731
|
-
saveScrollAnchor(threadKey: string, anchor: ConversationScrollAnchor | null): void;
|
|
1732
|
-
/** 开合态持久化:用户显式展开的轮次跨会话保留。 */
|
|
1733
|
-
readonly disclosure: {
|
|
1734
|
-
usePersistedExpandedTurnIds(threadKey: string): readonly string[];
|
|
1735
|
-
setTurnExpanded(threadKey: string, turnId: string, expanded: boolean): void;
|
|
1736
|
-
};
|
|
1737
|
-
/** 已读上报:可见帧内最后一条完成消息变化时由宿主标记。 */
|
|
1738
|
-
useVisibleThreadCompletion(input: unknown): void;
|
|
1739
|
-
/**
|
|
1740
|
-
* 计划卡「保存到工作区」的宿主 RPC(写文件走宿主命令管线)。null 时不画
|
|
1741
|
-
* 该菜单项(草稿会话、环境断开)。
|
|
1742
|
-
*/
|
|
1743
|
-
readonly onSavePlanToWorkspace: ((input: {
|
|
1744
|
-
readonly environmentId: string;
|
|
1745
|
-
readonly workspaceRoot: string;
|
|
1746
|
-
readonly relativePath: string;
|
|
1747
|
-
readonly contents: string;
|
|
1748
|
-
}) => Promise<{
|
|
1749
|
-
readonly ok: true;
|
|
1750
|
-
readonly relativePath: string;
|
|
1751
|
-
} | {
|
|
1752
|
-
readonly ok: false;
|
|
1753
|
-
}>) | null;
|
|
1754
|
-
}
|
|
1755
|
-
/** 轨迹行工具详情的懒加载请求(行级版本 = 状态 + 末次活动 id)。 */
|
|
1756
|
-
export interface ConversationTrajectoryToolCallDetailRequest {
|
|
1757
|
-
readonly threadRef: unknown;
|
|
1758
|
-
readonly toolCallId: string;
|
|
1759
|
-
readonly turnId: string | null;
|
|
1760
|
-
readonly revision: string;
|
|
1761
|
-
}
|
|
1762
|
-
/** 已回取的工具详情;输入/输出可能只到一半——已知事实不许从界面消失。 */
|
|
1763
|
-
export interface ConversationTrajectoryToolCallDetailData {
|
|
1764
|
-
readonly input?: string | undefined;
|
|
1765
|
-
readonly output?: string | undefined;
|
|
1766
|
-
}
|
|
1767
|
-
/**
|
|
1768
|
-
* 轨迹面板里宿主仍要给的部分。行、翻页与工具详情由插件经 {@link ConversationHostData}
|
|
1769
|
-
* 自己读;在轨迹中选中一行后切回聊天定位由插件自己协调。
|
|
1770
|
-
*/
|
|
1771
|
-
export interface ConversationTrajectoryProps {
|
|
1772
|
-
readonly timestampFormat: string;
|
|
1773
|
-
}
|
|
1774
|
-
/** 输入卡上方的横幅堆条目(宿主算好顺序;icon/title 等是宿主创建的节点,插件原样渲染)。 */
|
|
1775
|
-
export interface ConversationComposerBannerItem {
|
|
1776
|
-
readonly id: string;
|
|
1777
|
-
readonly variant: "default" | "error" | "info" | "success" | "warning";
|
|
1778
|
-
/** 平静、低频的提示可缩成单行,不占用完整告警卡片。 */
|
|
1779
|
-
readonly presentation?: "banner" | "compact" | undefined;
|
|
1780
|
-
/** 排序提示:平静变体也要前置(如实时更新进度)。栈本身忽略它。 */
|
|
1781
|
-
readonly urgent?: boolean | undefined;
|
|
1782
|
-
readonly icon: unknown;
|
|
1783
|
-
readonly title: unknown;
|
|
1784
|
-
readonly description?: unknown;
|
|
1785
|
-
readonly actions?: unknown;
|
|
1786
|
-
readonly className?: string | undefined;
|
|
1787
|
-
readonly actionClassName?: string | undefined;
|
|
1788
|
-
readonly dismissLabel?: string | undefined;
|
|
1789
|
-
readonly onDismiss?: (() => void) | undefined;
|
|
1790
|
-
}
|
|
1791
|
-
/** 输入卡上方的横幅堆(宿主排好了顺序)与横幅带出的宿主浮层。 */
|
|
1792
|
-
export interface ConversationComposerBanners {
|
|
1793
|
-
readonly items: ReadonlyArray<ConversationComposerBannerItem>;
|
|
1794
|
-
/** 宿主 React 节点(例如切回分支前的确认框),插件原样挂在输入卡旁;没有时为 null。 */
|
|
1795
|
-
readonly overlay: unknown;
|
|
1796
|
-
}
|
|
1797
|
-
/** 输入卡读的会话与发送状态(`ConversationHostData.useComposerStatus`)。 */
|
|
1798
|
-
export interface ConversationComposerStatus {
|
|
1799
|
-
readonly activeThreadId: ConversationThreadId | null;
|
|
1800
|
-
/** 只读这些 meta 字段;宿主给低频 meta 视图而不是完整 detail。 */
|
|
1801
|
-
readonly activeThread: Pick<ConversationThreadMeta, "id" | "session" | "latestTurn" | "presetId" | "nativeModeId"> | undefined;
|
|
1802
|
-
readonly isLocalDraftThread: boolean;
|
|
1803
|
-
/** 草稿会话还没有项目,发不出去。 */
|
|
1804
|
-
readonly projectSelectionRequired: boolean;
|
|
1805
|
-
readonly phase: ConversationSessionPhase;
|
|
1806
|
-
/** 消息刚发出、服务器还没确认。 */
|
|
1807
|
-
readonly isSendBusy: boolean;
|
|
1808
|
-
/** 发送被挡下的原因(宿主解析好的文案);能发时为 null。 */
|
|
1809
|
-
readonly sendDisabledReason: string | null;
|
|
1810
|
-
/**
|
|
1811
|
-
* 用户之前选的 agent(实例 id)已删或被停用时的那个 id,否则 null。宿主不替用户换别的,
|
|
1812
|
-
* 输入卡据此把原来的选择连同「不可用」画出来,发送由 `sendDisabledReason` 挡住。
|
|
1813
|
-
*/
|
|
1814
|
-
readonly unavailableAgentInstanceId?: string | null;
|
|
1815
|
-
/**
|
|
1816
|
-
* 这条会话从没选过 agent(草稿、会话、线程、项目默认都没存过实例 id)。宿主不替用户挑,
|
|
1817
|
-
* 输入卡画「选择 agent」占位、不显示任何 agent,发送由 `sendDisabledReason` 挡住。
|
|
1818
|
-
*/
|
|
1819
|
-
readonly noAgentChosen?: boolean;
|
|
1820
|
-
/** 刚发出的消息在等新 worktree 建好。 */
|
|
1821
|
-
readonly isPreparingWorktree: boolean;
|
|
1822
|
-
/** 准备的五步进度与取消;旧服务器或进度未到时为 null,输入卡只显示「正在准备」。 */
|
|
1823
|
-
readonly worktreeSetup?: ConversationWorktreeSetupProgress | null;
|
|
1824
|
-
/** 会话所在机器没连上时,它的名字与连接状态。 */
|
|
1825
|
-
readonly environmentUnavailable: {
|
|
1826
|
-
readonly label: string;
|
|
1827
|
-
readonly connection: ConversationEnvironmentConnectionPresentation;
|
|
1828
|
-
} | null;
|
|
1829
|
-
readonly compactDisabled: boolean;
|
|
1830
|
-
readonly compactDisabledReason: string | null;
|
|
1831
|
-
}
|
|
1832
|
-
export interface ConversationComposerProps {
|
|
1833
|
-
/** 宿主注入的 composer API(store/hook/纯函数面)。 */
|
|
1834
|
-
api: ConversationComposerApi;
|
|
1835
|
-
composerDraftTarget: ConversationComposerThreadTarget;
|
|
1836
|
-
environmentId: ConversationEnvironmentId;
|
|
1837
|
-
attachmentUploadsCapabilityKnown: boolean;
|
|
1838
|
-
supportsAttachmentUploads: boolean;
|
|
1839
|
-
routeKind: "server" | "draft";
|
|
1840
|
-
routeThreadRef: ConversationScopedThreadRef;
|
|
1841
|
-
draftId: ConversationDraftId | null;
|
|
1842
|
-
forceExpandedOnMobile: boolean;
|
|
1843
|
-
/**
|
|
1844
|
-
* 输入区座位。骨架调用 `renderSlot`;整条输入区被占住时走 `renderSlotChain`。
|
|
1845
|
-
* 缺席(测试)时骨架画内置默认控件。`fallback` 是骨架的内置控件:座位无人占用、
|
|
1846
|
-
* 或占用者渲染时抛错,宿主都画它,一个插件的控件坏掉不会连带整块会话区。
|
|
1847
|
-
*/
|
|
1848
|
-
slots?: {
|
|
1849
|
-
readonly renderSlot: (name: string, owner?: unknown, fallback?: unknown) => unknown;
|
|
1850
|
-
readonly renderSlotChain: (name: string, owner: unknown, fallback: unknown) => unknown;
|
|
1851
|
-
};
|
|
1852
|
-
resolvedTheme: "light" | "dark";
|
|
1853
|
-
settings: ConversationUnifiedSettings;
|
|
1854
|
-
keybindings: ConversationResolvedKeybindingsConfig;
|
|
1855
|
-
terminalOpen: boolean;
|
|
1856
|
-
gitCwd: string | null;
|
|
1857
|
-
promptRef: {
|
|
1858
|
-
readonly current: string;
|
|
1859
|
-
};
|
|
1860
|
-
composerImagesRef: {
|
|
1861
|
-
readonly current: ConversationComposerImageAttachment[];
|
|
1862
|
-
};
|
|
1863
|
-
composerTerminalContextsRef: {
|
|
1864
|
-
readonly current: ConversationTerminalContextDraft[];
|
|
1865
|
-
};
|
|
1866
|
-
composerElementContextsRef: {
|
|
1867
|
-
readonly current: ConversationElementContextDraft[];
|
|
1868
|
-
};
|
|
1869
|
-
/**
|
|
1870
|
-
* 同步发送读这里。子组件每轮把读函数推上来;正文等活在 ref 里的字段,
|
|
1871
|
-
* 调用时读此刻真值,不是上一次渲染的快照。
|
|
1872
|
-
*/
|
|
1873
|
-
sendContextRef: {
|
|
1874
|
-
current: ConversationComposerSendContextReader | null;
|
|
1875
|
-
};
|
|
1876
|
-
/**
|
|
1877
|
-
* 宿主 imperative handle。callback ref 或 object ref;插件经
|
|
1878
|
-
* `useImperativeHandle` 写入。宿主发送路径用带品牌的适配别名读它。
|
|
1879
|
-
*/
|
|
1880
|
-
composerRef: {
|
|
1881
|
-
current: ConversationComposerHandle | null;
|
|
1882
|
-
} | ((handle: ConversationComposerHandle | null) => void);
|
|
1883
|
-
/** `steer`:agent 在干活时照常排队,再请当前这一轮接住它;宿主当场拒发时同步回 `false`(原因宿主说)。 */
|
|
1884
|
-
onSend: (e?: {
|
|
1885
|
-
preventDefault: () => void;
|
|
1886
|
-
}, intent?: "foreground" | "background" | "steer") => false | void | Promise<void>;
|
|
1887
|
-
onInterrupt: () => void;
|
|
1888
|
-
/** Esc 两段式停止已武装:停止按钮显示「再按一次」态。缺席按 false。 */
|
|
1889
|
-
interruptArmed?: boolean;
|
|
1890
|
-
/** slash 菜单「最近使用」:item id 列表,新在前。宿主本机持久化。 */
|
|
1891
|
-
recentSlashCommandIds?: ReadonlyArray<string>;
|
|
1892
|
-
/** slash 菜单选中一条时回宿主记一次使用。 */
|
|
1893
|
-
onSlashCommandUsed?: (itemId: string) => void;
|
|
1894
|
-
/** slash 菜单分组小标题:宿主解析好的文案(内置插件命名空间运行期不注册,见 0026 后续记录)。 */
|
|
1895
|
-
slashMenuSectionTitles?: Readonly<Record<string, string>>;
|
|
1896
|
-
/** 停止按钮武装态文案(宿主解析)。 */
|
|
1897
|
-
interruptArmedLabel?: string;
|
|
1898
|
-
/** 派发原生压缩命令。服务端按 adapter 能力位执行,不再伪造一条 `/compact` 消息。 */
|
|
1899
|
-
onCompactContext: () => void;
|
|
1900
|
-
onImplementPlanInNewThread: () => void;
|
|
1901
|
-
/** 点了某个实例下的一行模型:`model` 归 `instanceId`。 */
|
|
1902
|
-
onProviderModelSelect: (instanceId: ConversationProviderInstanceId, model: string) => void;
|
|
1903
|
-
/** 选手格换手:`carried` 是换手前的选择,型号归不归新手由宿主判,选手格不猜。 */
|
|
1904
|
-
onProviderInstanceSelect: (instanceId: ConversationProviderInstanceId, carried: ConversationModelSelection) => void;
|
|
1905
|
-
/** 选择器(模型或档位)一改就把合成后的选择交出去,由宿主立刻落库。 */
|
|
1906
|
-
onModelSelectionChosen?: ((selection: ConversationModelSelection) => void) | undefined;
|
|
1907
|
-
/** 选中 / 清空团队。传 null 表示回到单模型;选模型时由宿主用它清掉团队。 */
|
|
1908
|
-
onSelectPluginAction: (teamId: string | null) => void;
|
|
1909
|
-
/** 跳到设置里的 Teams 位置。 */
|
|
1910
|
-
onManagePlugins: () => void;
|
|
1911
|
-
getModelDisabledReason: (instanceId: ConversationProviderInstanceId, model: string) => string | null;
|
|
1912
|
-
/** 被挡下的模型还能不能靠开新 thread 接着干;返回那一行的动作文案,或 null。 */
|
|
1913
|
-
getModelContinuationLabel: (instanceId: ConversationProviderInstanceId, model: string) => string | null;
|
|
1914
|
-
onContinueInModel: (instanceId: ConversationProviderInstanceId, model: string) => void;
|
|
1915
|
-
toggleInteractionMode: () => void;
|
|
1916
|
-
handleRuntimeModeChange: (mode: ConversationRuntimeMode) => void;
|
|
1917
|
-
handleInteractionModeChange: (mode: ConversationProviderInteractionMode) => void;
|
|
1918
|
-
handleNativeModeChange: (nativeModeId: string) => void;
|
|
1919
|
-
focusComposer: () => void;
|
|
1920
|
-
scheduleComposerFocus: () => void;
|
|
1921
|
-
setThreadError: (threadId: ConversationThreadId | null, error: string | null) => void;
|
|
1922
|
-
onExpandImage: (preview: unknown) => void;
|
|
1923
|
-
/**
|
|
1924
|
-
* 输入卡第一行左侧:新建会话 / 历史 / 导入。宿主 React 节点,插件原样摆。
|
|
1925
|
-
* 缺席(测试、着陆页没有输入卡)就不画。
|
|
1926
|
-
*/
|
|
1927
|
-
readonly sessionActions?: unknown;
|
|
1928
|
-
/**
|
|
1929
|
-
* 输入卡第一行右段、轮次导航左边:会话的 agents 控制(按钮 + 舰队弹窗)。
|
|
1930
|
-
* 宿主 React 节点,插件原样摆;本会话没 spawn 过 agent 时宿主给 null。
|
|
1931
|
-
*/
|
|
1932
|
-
readonly agentsControl?: unknown;
|
|
1933
|
-
/**
|
|
1934
|
-
* 输入卡第一行右段、agents 控制左边:终端开关。宿主 React 节点,插件原样摆;
|
|
1935
|
-
* 0026 Q1 拍板从顶栏搬进玻璃壳(右面板与最大化开关仍留顶栏)。
|
|
1936
|
-
*/
|
|
1937
|
-
readonly terminalControl?: unknown;
|
|
1938
|
-
/** 输入卡下缘内容(分支工具条等宿主工作区控件),原样渲染。 */
|
|
1939
|
-
readonly belowSlot: unknown;
|
|
1940
|
-
/** 草稿首条消息的居中大标题态。 */
|
|
1941
|
-
readonly draftHero: {
|
|
1942
|
-
readonly active: boolean;
|
|
1943
|
-
readonly headline: unknown;
|
|
1944
|
-
readonly forceExpandedOnMobile: boolean;
|
|
1945
|
-
readonly transitionGroupRef?: ((element: HTMLDivElement | null) => void) | undefined;
|
|
1946
|
-
readonly composerAnchorRef?: ((element: HTMLDivElement | null) => void) | undefined;
|
|
1947
|
-
readonly composerTransitionName?: string | undefined;
|
|
1948
|
-
readonly headlineTransitionName?: string | undefined;
|
|
1949
|
-
};
|
|
1950
|
-
readonly contextStrip: boolean;
|
|
1951
|
-
/**
|
|
1952
|
-
* 浮层根元素上报:宿主量它的高度给时间线让位(contentInsetEndAdjustment),
|
|
1953
|
-
* 并在其中找 `[data-chat-composer-stack="true"]` 量输入卡占的列(浮动预览可停在两侧留白)。
|
|
1954
|
-
* 卸载时以 null 收尾。元素对契约不透明(本文件不引 DOM 类型)。
|
|
1955
|
-
*/
|
|
1956
|
-
readonly onOverlayElementChange?: ((element: unknown) => void) | undefined;
|
|
1957
|
-
}
|
|
1958
|
-
/** `views.conversation` 的完整 props。 */
|
|
1959
|
-
export interface ConversationViewProps {
|
|
1960
|
-
readonly scope: ConversationScopeProps;
|
|
1961
|
-
readonly mode: ConversationModeProps;
|
|
1962
|
-
readonly shortcuts: ConversationShortcutLabels;
|
|
1963
|
-
readonly derive: ConversationDeriveApi;
|
|
1964
|
-
/** 宿主数据接口。老版本宿主不给;插件发现缺席或版本不同时显示版本不一致的说明。 */
|
|
1965
|
-
readonly data?: ConversationHostData | undefined;
|
|
1966
|
-
readonly timeline: ConversationTimelineProps;
|
|
1967
|
-
readonly trajectory: ConversationTrajectoryProps;
|
|
1968
|
-
readonly composer: ConversationComposerProps;
|
|
1969
|
-
readonly attachments: ConversationAttachmentsApi;
|
|
1970
|
-
}
|
|
1971
399
|
export { CONVERSATION_PLUGIN_ID, CONVERSATION_PROMPT_PREVIEW_VIEW_ID, CONVERSATION_VIEW_BRIDGE_PROP, CONVERSATION_VIEW_ID, CONVERSATION_VIEW_REBINDABLE_BRIDGE_CAPABILITY, type ConversationPromptPreviewViewProps, } from "./conversation-view.ts";
|
|
1972
400
|
/**
|
|
1973
401
|
* Prompt 里占位终端上下文的 wire 字符(U+FFFC)。宿主与插件必须用同一份,
|