paseo-plugin-zcode-provider 0.3.0 → 0.4.1
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/NOTICE.md +2 -2
- package/README.md +9 -9
- package/package.json +4 -4
- package/server/account.ts +10 -0
- package/server/build-info.ts +1 -1
- package/server/discovery/manifest.ts +2 -2
- package/server/mapping.ts +31 -0
- package/server/provider.ts +5 -18
- package/server/runtime/pins.ts +3 -3
- package/server/session.ts +7 -10
- package/server/unsupported-capabilities.ts +4 -1
- package/server/vendor/zcode/NOTICE.md +4 -1
- package/server/vendor/zcode/packages/rpc/src/channelClient.ts +1 -0
- package/server/vendor/zcode/packages/rpc/src/channelServer.ts +2 -0
- package/server/vendor/zcode/packages/rpc/src/channels.shared.ts +1 -0
- package/server/vendor/zcode/packages/rpc/src/protocol.ts +3 -2
- package/server/vendor/zcode/packages/shared/src/app-runtime-preferences.ts +18 -0
- package/server/vendor/zcode/packages/shared/src/attachment-source.ts +5 -0
- package/server/vendor/zcode/packages/shared/src/bots.ts +385 -2
- package/server/vendor/zcode/packages/shared/src/browser-use/commands.ts +3 -1
- package/server/vendor/zcode/packages/shared/src/channel-mention.ts +131 -0
- package/server/vendor/zcode/packages/shared/src/conversationSelection.ts +37 -0
- package/server/vendor/zcode/packages/shared/src/dynamic-workflow-feature.ts +137 -0
- package/server/vendor/zcode/packages/shared/src/env.ts +15 -11
- package/server/vendor/zcode/packages/shared/src/highspeed.ts +232 -0
- package/server/vendor/zcode/packages/shared/src/mcp-apps/appTools.ts +148 -0
- package/server/vendor/zcode/packages/shared/src/mcp-apps/contract.ts +262 -0
- package/server/vendor/zcode/packages/shared/src/mcp-apps/instance.ts +12 -0
- package/server/vendor/zcode/packages/shared/src/mcp-apps/resourceMime.ts +73 -0
- package/server/vendor/zcode/packages/shared/src/mcp-apps/sampling.ts +117 -0
- package/server/vendor/zcode/packages/shared/src/mcp-apps/schemas.ts +90 -0
- package/server/vendor/zcode/packages/shared/src/model-execution.ts +58 -1
- package/server/vendor/zcode/packages/shared/src/oauth.ts +3 -0
- package/server/vendor/zcode/packages/shared/src/off-peak-execution.ts +73 -0
- package/server/vendor/zcode/packages/shared/src/protocol.ts +78 -4
- package/server/vendor/zcode/packages/shared/src/remoteTarget.ts +65 -0
- package/server/vendor/zcode/packages/shared/src/request-security-edition/verification-policy.ts +46 -0
- package/server/vendor/zcode/packages/shared/src/server-remote.ts +93 -0
- package/server/vendor/zcode/packages/shared/src/source-server/compatibility.ts +115 -0
- package/server/vendor/zcode/packages/shared/src/source-server/contracts.ts +426 -0
- package/server/vendor/zcode/packages/shared/src/source-server/errorCodes.ts +74 -0
- package/server/vendor/zcode/packages/shared/src/sqlite-migrations/contract.ts +83 -0
- package/server/vendor/zcode/packages/shared/src/subagent-profile.ts +62 -0
- package/server/vendor/zcode/packages/shared/src/subagent-runtime-config.ts +51 -0
- package/server/vendor/zcode/packages/shared/src/subagents-types.ts +164 -0
- package/server/vendor/zcode/packages/shared/src/usage-stats.ts +14 -0
- package/server/vendor/zcode/packages/shared/src/validationAppSettings.ts +136 -3
- package/server/vendor/zcode/packages/shared/src/version.ts +13 -0
- package/server/vendor/zcode/packages/shared/src/zcode-agent-policy.ts +24 -1
- package/server/vendor/zcode/packages/shared/src/zcode-protocol/index.ts +697 -36
- package/server/vendor/zcode/packages/shared/src/zcode-protocol/trace.ts +11 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-legacy-types.ts +14 -2
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/apply.ts +28 -9
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/attachment-ref.ts +3 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/command.ts +73 -53
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/create-session-config.ts +15 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/create-workflow-display.ts +47 -1
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/delta.ts +58 -2
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/input-intent.ts +31 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/rows.ts +28 -13
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/sessions-index-workflow-activity.ts +37 -3
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/sessions-index.ts +36 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/snapshot.ts +21 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/submission.ts +1 -1
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/toolDisplay.ts +32 -4
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/transport.ts +31 -6
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/wire-assembler.ts +4 -1
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/wire-fault.ts +4 -1
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-artifacts.ts +62 -4
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-command-rejections.ts +30 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-row-meta.ts +40 -3
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-run-settings-command.ts +2 -2
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-runs-delta.ts +6 -5
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-runs.ts +103 -26
- package/server/vendor/zcode/packages/shared/src/zcode-task-mode-schema.ts +13 -1
- package/server/vendor/zcode/packages/shared/src/zcode-task-types-core.ts +31 -2
- package/server/vendor/zcode/packages/shared/src/zcodeEndpoint.ts +188 -73
- package/server/vendor/zcode/provenance.json +189 -80
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const zcodeProtocolTraceSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
traceId: z.string().min(1).optional(),
|
|
6
|
+
parentId: z.string().min(1).optional(),
|
|
7
|
+
spanId: z.string().min(1).optional(),
|
|
8
|
+
traceparent: z.string().min(1).optional(),
|
|
9
|
+
})
|
|
10
|
+
.strict();
|
|
11
|
+
export type ZCodeProtocolTrace = z.infer<typeof zcodeProtocolTraceSchema>;
|
|
@@ -14,11 +14,13 @@ const timestampMsSchema = z.number().int().nonnegative();
|
|
|
14
14
|
export const zcodeDeliveryKindSchema = z.enum(["desktop-continuous", "web-remote-replayable"]);
|
|
15
15
|
export const zcodeMessageVisibilitySchema = z.enum(["user-visible", "model-only"]);
|
|
16
16
|
export const zcodeSyntheticUserMessageSourceSchema = z.enum([
|
|
17
|
+
"agent_listing_delta",
|
|
17
18
|
"background_task",
|
|
18
19
|
"fork",
|
|
19
20
|
"goal_state_change",
|
|
20
21
|
"goal-continuation",
|
|
21
22
|
"plugin_reference",
|
|
23
|
+
"bot_topic_context",
|
|
22
24
|
"rewind",
|
|
23
25
|
"selection_side_chat",
|
|
24
26
|
"subagent",
|
|
@@ -71,7 +73,7 @@ export const zcodePermissionResponseSchema = z
|
|
|
71
73
|
})
|
|
72
74
|
.strict();
|
|
73
75
|
export type ZCodePermissionResponse = z.infer<typeof zcodePermissionResponseSchema>;
|
|
74
|
-
export const zcodeSessionModeSchema = z.enum(["plan", "build", "edit", "yolo", "auto"]);
|
|
76
|
+
export const zcodeSessionModeSchema = z.enum(["plan", "build", "edit", "yolo", "guarded", "auto"]);
|
|
75
77
|
export const zcodeSessionStatusSchema = z.enum([
|
|
76
78
|
"idle",
|
|
77
79
|
"running",
|
|
@@ -89,6 +91,17 @@ export const zcodeSessionKindSchema = z.enum([
|
|
|
89
91
|
"subagent_child",
|
|
90
92
|
"nested_workflow_child",
|
|
91
93
|
]);
|
|
94
|
+
// 修复原因:只识别 subagent_child 会漏掉工作流与辅助对话的父归属、隐藏索引规则。
|
|
95
|
+
// fork 和 workflow_parent 是独立任务,即使有 parentSessionId 也不能沿父链改写项目。
|
|
96
|
+
export function isAuxiliarySessionKind(kind: string | undefined): boolean {
|
|
97
|
+
return isReadonlyAgentSessionKind(kind) || kind === "selection_side_chat";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 辅助对话可继续输入;只有由 Agent / 工作流驱动的子会话对用户只读。
|
|
101
|
+
export function isReadonlyAgentSessionKind(kind: string | undefined): boolean {
|
|
102
|
+
return kind === "subagent_child" || kind === "workflow_child" || kind === "nested_workflow_child";
|
|
103
|
+
}
|
|
104
|
+
|
|
92
105
|
export const zcodeSessionGoalSchema = z
|
|
93
106
|
.object({
|
|
94
107
|
sessionId: nonEmptyString,
|
|
@@ -147,7 +160,6 @@ export const zcodeSessionInfoSchema = z
|
|
|
147
160
|
target: zcodeSessionGoalSchema.nullable().optional(),
|
|
148
161
|
createdAt: timestampMsSchema,
|
|
149
162
|
updatedAt: timestampMsSchema,
|
|
150
|
-
archivedAt: timestampMsSchema.optional(),
|
|
151
163
|
})
|
|
152
164
|
.strict();
|
|
153
165
|
export type ZCodeSessionInfo = z.infer<typeof zcodeSessionInfoSchema>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// 这是协议语义的一部分:coalesce 的「语义保持」就以本函数为裁判——
|
|
3
3
|
// applyAll(s, coalesce(ds)) 必须与 applyAll(s, ds) 逐字节一致(黄金测试)。
|
|
4
4
|
// 客户端 store 的 apply 逻辑是本函数的宿主化改写,不得引入额外分支。
|
|
5
|
+
import type { StreamablePath } from "./core.js";
|
|
5
6
|
import type { ConversationDelta } from "./delta.js";
|
|
6
|
-
import type { ConversationSnapshot } from "./snapshot.js";
|
|
7
7
|
import type { ConversationRow } from "./rows.js";
|
|
8
|
-
import type {
|
|
8
|
+
import type { ConversationSnapshot } from "./snapshot.js";
|
|
9
9
|
import { applyWorkflowRunRemoved, applyWorkflowRunUpdated } from "./workflow-runs-delta.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -34,9 +34,13 @@ export function createMutableConversationSnapshotAccumulator(
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
// row.delta
|
|
38
|
-
// 本函数按协议语义实现为:路径不存在/行不存在时 no-op
|
|
39
|
-
function appendToRow(
|
|
37
|
+
// row.delta 只允许作用于流式态行(§4.4.4 不变量,服务端保证)。
|
|
38
|
+
// 本函数按协议语义实现为:路径不存在/行不存在时 no-op(§4.3:patch 命中未加载行 = no-op)。
|
|
39
|
+
function appendToRow(
|
|
40
|
+
row: ConversationRow,
|
|
41
|
+
path: StreamablePath,
|
|
42
|
+
append: string,
|
|
43
|
+
): ConversationRow {
|
|
40
44
|
switch (path) {
|
|
41
45
|
case "text":
|
|
42
46
|
if (row.kind === "assistantText" || row.kind === "reasoning") {
|
|
@@ -81,15 +85,19 @@ export function applyConversationDelta(
|
|
|
81
85
|
},
|
|
82
86
|
};
|
|
83
87
|
case "row.upserted": {
|
|
84
|
-
const index = snapshot.rows.window.findIndex(
|
|
85
|
-
|
|
88
|
+
const index = snapshot.rows.window.findIndex(
|
|
89
|
+
(row) => row.rowId === delta.row.rowId,
|
|
90
|
+
);
|
|
91
|
+
// §4.3:未加载 rowId = no-op(被逐出的行只能经 rows/range 取回)。
|
|
86
92
|
if (index === -1) return snapshot;
|
|
87
93
|
const window = [...snapshot.rows.window];
|
|
88
94
|
window[index] = delta.row;
|
|
89
95
|
return { ...snapshot, rows: { ...snapshot.rows, window } };
|
|
90
96
|
}
|
|
91
97
|
case "row.removed": {
|
|
92
|
-
const window = snapshot.rows.window.filter(
|
|
98
|
+
const window = snapshot.rows.window.filter(
|
|
99
|
+
(row) => row.rowId < delta.fromRowId,
|
|
100
|
+
);
|
|
93
101
|
const removed = snapshot.rows.window.length - window.length;
|
|
94
102
|
const removesEntireActiveBranch =
|
|
95
103
|
snapshot.rows.firstRowId !== null && delta.fromRowId <= snapshot.rows.firstRowId;
|
|
@@ -109,7 +117,9 @@ export function applyConversationDelta(
|
|
|
109
117
|
};
|
|
110
118
|
}
|
|
111
119
|
case "row.delta": {
|
|
112
|
-
const index = snapshot.rows.window.findIndex(
|
|
120
|
+
const index = snapshot.rows.window.findIndex(
|
|
121
|
+
(row) => row.rowId === delta.rowId,
|
|
122
|
+
);
|
|
113
123
|
const target = snapshot.rows.window[index];
|
|
114
124
|
if (index === -1 || target === undefined) return snapshot;
|
|
115
125
|
const window = [...snapshot.rows.window];
|
|
@@ -119,6 +129,12 @@ export function applyConversationDelta(
|
|
|
119
129
|
case "state.updated":
|
|
120
130
|
// 键级整体替换:patch 中在场的键覆盖,绝不深合并。
|
|
121
131
|
return { ...snapshot, ...delta.patch };
|
|
132
|
+
case "pluginUi.resourceUpdated":
|
|
133
|
+
case "pluginUi.resourceListChanged":
|
|
134
|
+
case "pluginUi.instanceClosed":
|
|
135
|
+
case "pluginUi.appToolCall":
|
|
136
|
+
// live-only 通知 / 信箱投递:不改变快照,由 renderer 另行派发。
|
|
137
|
+
return snapshot;
|
|
122
138
|
// workflowRuns 是唯一开了增量口子的状态键(delta.ts 的注释讲了为什么)。规则整份住在
|
|
123
139
|
// workflow-runs-delta.ts:两个 twin 都只转调它,两边的语义因此没有走散的余地。
|
|
124
140
|
case "workflowRun.updated":
|
|
@@ -199,6 +215,9 @@ export function applyConversationDeltaMutable(
|
|
|
199
215
|
// 与不可变实现相同:patch 在场键整体替换,不能深合并。
|
|
200
216
|
Object.assign(snapshot, delta.patch);
|
|
201
217
|
return;
|
|
218
|
+
case "pluginUi.resourceUpdated":
|
|
219
|
+
case "pluginUi.resourceListChanged":
|
|
220
|
+
return;
|
|
202
221
|
// 与不可变实现调同一个纯函数:workflowRuns 是状态键不是 rows 窗口,没有「原地追加」可优化,
|
|
203
222
|
// 而 accumulator.snapshot 本来就是候选快照自己的对象,赋一个新容器不会碰到已发布的快照。
|
|
204
223
|
case "workflowRun.updated":
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { attachmentSourceKindSchema } from "../attachment-source.js";
|
|
2
3
|
|
|
3
4
|
/** 仅承载已提交内容引用与展示元信息;内容本体不进入 command/topic frame。 */
|
|
4
5
|
export const attachmentRefSchema = z
|
|
@@ -7,6 +8,8 @@ export const attachmentRefSchema = z
|
|
|
7
8
|
fileName: z.string(),
|
|
8
9
|
mime: z.string(),
|
|
9
10
|
bytes: z.number(),
|
|
11
|
+
sourceKind: attachmentSourceKindSchema.optional(),
|
|
12
|
+
messageCount: z.number().int().nonnegative().optional(),
|
|
10
13
|
previewRef: z.string().optional(),
|
|
11
14
|
})
|
|
12
15
|
.strict();
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { createSessionRequestedConfigSchema } from "./create-session-config.js";
|
|
1
2
|
import { localTtftContextSchema, localTtftClockSchema } from "../localTtft.js";
|
|
3
|
+
import { conversationQuotesSchema } from "../conversationSelection.js";
|
|
2
4
|
// Command 层:信封 / ACK / 命令全集 payload。
|
|
3
5
|
// conversation rewind 无独立命令(裁决:= editUserQuery 的 UI 入口);
|
|
4
6
|
// workspace-only 文件撤销走 applyFileRewind,不截断聊天历史。
|
|
@@ -9,7 +11,8 @@ import { v4ConversationFileRewindPreviewResultSchema } from "./transport.js";
|
|
|
9
11
|
import { modelSelectionSchema } from "../model-selection.js";
|
|
10
12
|
import { modelExecutionSchema } from "../model-execution.js";
|
|
11
13
|
import { submissionModeSchema } from "./submission.js";
|
|
12
|
-
import { zcodeAutomationBotDeliveryTargetSchema } from "../bots.js";
|
|
14
|
+
import { botGroupInputSourceSchema, zcodeAutomationBotDeliveryTargetSchema } from "../bots.js";
|
|
15
|
+
import { DYNAMIC_WORKFLOW_MODES } from "../dynamic-workflow-feature.js";
|
|
13
16
|
import {
|
|
14
17
|
amendWorkflowRunSettingsPayloadSchema,
|
|
15
18
|
amendWorkflowRunSettingsResultSchema,
|
|
@@ -24,27 +27,36 @@ import {
|
|
|
24
27
|
zcodeBrowserAmbientContextSchema,
|
|
25
28
|
zcodeProtocolMcpServerSchema,
|
|
26
29
|
} from "../zcode-protocol/index.js";
|
|
30
|
+
import { highspeedMessageMetaSchema } from "../highspeed.js";
|
|
27
31
|
import { sharedContextRefSchema } from "./shared-context-ref.js";
|
|
32
|
+
import { conversationInputSourceSchema } from "./input-intent.js";
|
|
28
33
|
export type { SharedContextRef } from "./shared-context-ref.js";
|
|
34
|
+
export * from "./workflow-command-rejections.js";
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
36
|
+
// sendText / editUserQuery / sendQueuedNow 共用的执行材料不变量:modelExecution 只能依附
|
|
37
|
+
// 本次 modelSelection,禁止在缺 Selection 时单独补供凭据(历史消息 rewind 后不复用旧凭据)。
|
|
38
|
+
function requireModelSelectionForExecution(
|
|
39
|
+
payload: { modelSelection?: unknown; modelExecution?: unknown },
|
|
40
|
+
context: z.RefinementCtx,
|
|
41
|
+
): void {
|
|
42
|
+
if (payload.modelExecution && !payload.modelSelection) {
|
|
43
|
+
context.addIssue({
|
|
44
|
+
code: z.ZodIssueCode.custom,
|
|
45
|
+
message: "modelExecution requires modelSelection",
|
|
46
|
+
path: ["modelExecution"],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
42
50
|
|
|
43
|
-
// ── 命令 payload 全集 ──
|
|
51
|
+
// ── §6.4 命令 payload 全集 ──
|
|
44
52
|
export const commandPayloadSchemas = {
|
|
45
53
|
// firstInput 缺省 → phase=draft 空会话;携带 → 直接 turnHeader+userInput rows。
|
|
46
54
|
createSession: z.object({
|
|
55
|
+
// Host 预留归属使用稳定 ID;CLI 仍负责拒绝覆盖既有会话。
|
|
56
|
+
sessionId: z.string().min(1).optional(),
|
|
57
|
+
additionalDirectories: z.array(z.string().min(1)).max(256).optional(),
|
|
47
58
|
workspaceId: z.string(),
|
|
59
|
+
permissionScope: z.literal("session").optional(),
|
|
48
60
|
firstInput: z
|
|
49
61
|
.object({
|
|
50
62
|
text: z.string(),
|
|
@@ -63,6 +75,8 @@ export const commandPayloadSchemas = {
|
|
|
63
75
|
offPeakToolEnabled: z.boolean().optional(),
|
|
64
76
|
// 动态工作流灰度 flag,与 offPeakToolEnabled 同一模式。
|
|
65
77
|
dynamicWorkflowEnabled: z.boolean().optional(),
|
|
78
|
+
// 灰度 mode 与布尔同行(launch.md「On demand: activation」);旧 CLI 的 z.object 静默丢弃。
|
|
79
|
+
dynamicWorkflowMode: z.enum(DYNAMIC_WORKFLOW_MODES).optional(),
|
|
66
80
|
}),
|
|
67
81
|
// 父会话由 envelope.sessionId 指定;服务端从父 record 派生完整运行配置。
|
|
68
82
|
// firstInput 存在时,child 创建完成后立即启动首条普通输入;缺省则保持空副屏。
|
|
@@ -89,6 +103,8 @@ export const commandPayloadSchemas = {
|
|
|
89
103
|
// Share handover 只允许当前 session 的一个已导入上下文;完整正文由 runtime 从
|
|
90
104
|
// 持久化 provenance 解析,不能随 command 从 renderer 传入。
|
|
91
105
|
context_refs: z.array(sharedContextRefSchema).max(1).optional(),
|
|
106
|
+
// 插件 UI 代发(ui/message)时的来源标记;随 intent 持久化并投影到 userInput row。
|
|
107
|
+
source: conversationInputSourceSchema.optional(),
|
|
92
108
|
heldQueueDisposition: z.enum(["clearQueueAndSend", "keepQueueAndSend"]).optional(),
|
|
93
109
|
// 暂停队列确认框打开时看到的 queueItemId 集合。CLI 在执行 clear/keep 前校验,
|
|
94
110
|
// 防止桌面/手机并发增删后把用户没确认过的新队列一并处置。
|
|
@@ -101,11 +117,18 @@ export const commandPayloadSchemas = {
|
|
|
101
117
|
// 本次执行仍使用上面的标准 Selection;这里只携带不持久化语义、动态鉴权和 child 策略。
|
|
102
118
|
// 仅 idle startNow 接受,防止 Secret/Ticket 进入普通 CommandInbox。
|
|
103
119
|
modelExecution: modelExecutionSchema.optional(),
|
|
120
|
+
// Highspeed 卡快照随输入事实进入 message.data;不包含 runtime 凭据或 header。
|
|
121
|
+
// 加速本轮的模型与凭据走上面的 modelSelection + modelExecution,见
|
|
122
|
+
// docs/highspeed/highspeed-access-mode-migration.md。
|
|
123
|
+
highspeedMeta: highspeedMessageMetaSchema.optional(),
|
|
104
124
|
automationId: z.string().min(1).optional(),
|
|
105
125
|
offPeakTaskId: z.string().min(1).optional(),
|
|
106
126
|
offPeakRunType: z.enum(["init", "resume"]).optional(),
|
|
107
127
|
// Bot 来源只由 Host 注入,用于 CronCreate 在当前 turn 内读取并持久化回推地址。
|
|
108
128
|
botDeliveryTarget: zcodeAutomationBotDeliveryTargetSchema.optional(),
|
|
129
|
+
inputOrigin: z.enum(["desktop", "mobile"]).optional(),
|
|
130
|
+
botGroupSource: botGroupInputSourceSchema.optional(),
|
|
131
|
+
conversationQuotes: conversationQuotesSchema.optional(),
|
|
109
132
|
// 定时任务会话的后续用户输入也必须保持 turn-scoped 工具面隔离;不能借用
|
|
110
133
|
// automationId,否则会把普通用户输入误标成一次 automation 派发。
|
|
111
134
|
toolDisallowlist: z.array(z.string().min(1)).optional(),
|
|
@@ -124,13 +147,7 @@ export const commandPayloadSchemas = {
|
|
|
124
147
|
path: ["offPeakRunType"],
|
|
125
148
|
});
|
|
126
149
|
}
|
|
127
|
-
|
|
128
|
-
context.addIssue({
|
|
129
|
-
code: z.ZodIssueCode.custom,
|
|
130
|
-
message: "modelExecution requires modelSelection",
|
|
131
|
-
path: ["modelExecution"],
|
|
132
|
-
});
|
|
133
|
-
}
|
|
150
|
+
requireModelSelectionForExecution(payload, context);
|
|
134
151
|
}),
|
|
135
152
|
sendGoalCommand: z.object({
|
|
136
153
|
text: z.string(),
|
|
@@ -151,19 +168,48 @@ export const commandPayloadSchemas = {
|
|
|
151
168
|
// running 时对稳定 assistant row 可用。
|
|
152
169
|
forkAssistant: z.object({ target: conversationRowTargetSchema }),
|
|
153
170
|
applyFileRewind: z.object({ target: conversationRowTargetSchema }),
|
|
154
|
-
editUserQuery: z
|
|
171
|
+
editUserQuery: z
|
|
172
|
+
.object({
|
|
155
173
|
target: conversationRowTargetSchema,
|
|
156
174
|
newText: z.string(),
|
|
175
|
+
conversationQuotes: conversationQuotesSchema.optional(),
|
|
157
176
|
attachments: z.array(attachmentRefSchema).optional(),
|
|
177
|
+
// 编辑重发按新的主动发送处理:只接受本次重新 prepare 得到的卡与执行材料,
|
|
178
|
+
// 不从被 rewind 的历史消息复用旧凭据。
|
|
179
|
+
modelSelection: modelSelectionSchema.optional(),
|
|
180
|
+
modelExecution: modelExecutionSchema.optional(),
|
|
181
|
+
highspeedMeta: highspeedMessageMetaSchema.optional(),
|
|
158
182
|
// 缺省 preserve:仅切 conversation branch;rewind 会先安全恢复该轮文件。
|
|
159
183
|
workspaceMode: z.enum(["preserve", "rewind"]).optional(),
|
|
160
|
-
|
|
184
|
+
})
|
|
185
|
+
.superRefine(requireModelSelectionForExecution),
|
|
161
186
|
retryTurn: z.object({ target: conversationRowTargetSchema }),
|
|
187
|
+
// (2026-09-12):原 setToolWidgetState / setSessionPluginUiState 已删除——插件 UI widgetState
|
|
188
|
+
// 回退为宿主 renderer 内存保存,不再写 CLI 会话存储;模型可见信息改走 ui/update-model-context。
|
|
162
189
|
setAssistantFeedback: z.object({
|
|
163
190
|
target: conversationRowTargetSchema,
|
|
164
191
|
feedback: z.enum(["like", "dislike"]).nullable(),
|
|
165
192
|
}),
|
|
166
|
-
|
|
193
|
+
setHighspeedMetrics: z.object({
|
|
194
|
+
target: conversationRowTargetSchema,
|
|
195
|
+
regularTps: z.number().positive(),
|
|
196
|
+
outputTokens: z.number().int().nonnegative(),
|
|
197
|
+
durationMs: z.number().nonnegative(),
|
|
198
|
+
highspeedTps: z.number().positive(),
|
|
199
|
+
savedDurationMs: z.number().nonnegative(),
|
|
200
|
+
modelDurationMs: z.number().nonnegative().optional(),
|
|
201
|
+
toolDurationMs: z.number().nonnegative().optional(),
|
|
202
|
+
otherDurationMs: z.number().nonnegative().optional(),
|
|
203
|
+
}),
|
|
204
|
+
sendQueuedNow: z
|
|
205
|
+
.object({
|
|
206
|
+
queueItemId: z.string(),
|
|
207
|
+
// 手动提升允许 Renderer 为原队列项补充同卡执行材料;凭据不入队列持久化面。
|
|
208
|
+
modelSelection: modelSelectionSchema.optional(),
|
|
209
|
+
modelExecution: modelExecutionSchema.optional(),
|
|
210
|
+
highspeedMeta: highspeedMessageMetaSchema.optional(),
|
|
211
|
+
})
|
|
212
|
+
.superRefine(requireModelSelectionForExecution),
|
|
167
213
|
editQueueItem: z.object({ queueItemId: z.string(), newText: z.string() }),
|
|
168
214
|
// beforeQueueItemId = null → 移到队尾。
|
|
169
215
|
reorderQueueItem: z.object({
|
|
@@ -213,7 +259,7 @@ export const commandPayloadSchemas = {
|
|
|
213
259
|
// additive(冻结面按黄金测试背书演进):agent 协作模式切换。
|
|
214
260
|
// 值域 = core CollaborationMode 的可切换子集(auto 非用户可切,不进 UI 命令面)。
|
|
215
261
|
switchCollaborationMode: z.object({
|
|
216
|
-
mode: z.enum(["build", "edit", "plan", "yolo"]),
|
|
262
|
+
mode: z.enum(["build", "edit", "plan", "yolo", "guarded"]),
|
|
217
263
|
}),
|
|
218
264
|
setFollowupMode: z.object({ mode: z.enum(["queue", "guide"]) }),
|
|
219
265
|
pauseGoal: z.object({}),
|
|
@@ -231,7 +277,7 @@ export const commandPayloadSchemas = {
|
|
|
231
277
|
// 同类:不携 baseRevision(workflowRuns 面免 revision,假 CAS 失败只会误伤)。name 由 agent 从
|
|
232
278
|
// 解析结果填(不变式 6),命令不收 name 覆盖。
|
|
233
279
|
// 拒绝以 fault.command.savedWorkflowStartRejected.<reason> 回 ACK(词表见下方
|
|
234
|
-
// savedWorkflowStartRejectionReasonSchema);能力缺席(无 dwf 端口)→ V4CapabilityUnsupportedError
|
|
280
|
+
// workflow-command-rejections.ts 的 savedWorkflowStartRejectionReasonSchema);能力缺席(无 dwf 端口)→ V4CapabilityUnsupportedError
|
|
235
281
|
// (与 resumeWorkflowRun 同一条错误)。
|
|
236
282
|
startSavedWorkflow: z.object({
|
|
237
283
|
name: z.string().min(1),
|
|
@@ -258,33 +304,6 @@ export const commandTypeSchema = z.enum(
|
|
|
258
304
|
Object.keys(commandPayloadSchemas) as [CommandType, ...CommandType[]],
|
|
259
305
|
);
|
|
260
306
|
|
|
261
|
-
// startSavedWorkflow 拒绝词表:
|
|
262
|
-
// bootstrap handler 铸造 fault code,ui launcher 反查 i18n 文案,两侧共享此枚举避免漂移。
|
|
263
|
-
// invalid_name / not_found:解析阶段;invalid_args:实参校验;compile_failed:analyzeScript 诊断;
|
|
264
|
-
// session_busy:会话有活动 turn;start_failed:port.submit 之前的其它启动失败。
|
|
265
|
-
export const savedWorkflowStartRejectionReasonSchema = z.enum([
|
|
266
|
-
"invalid_name",
|
|
267
|
-
"not_found",
|
|
268
|
-
"invalid_args",
|
|
269
|
-
"compile_failed",
|
|
270
|
-
"session_busy",
|
|
271
|
-
"start_failed",
|
|
272
|
-
]);
|
|
273
|
-
export type SavedWorkflowStartRejectionReason = z.infer<
|
|
274
|
-
typeof savedWorkflowStartRejectionReasonSchema
|
|
275
|
-
>;
|
|
276
|
-
|
|
277
|
-
// 完整 fault code = 前缀 + reason(如 fault.command.savedWorkflowStartRejected.not_found)。
|
|
278
|
-
// 与 workflowRunResumeRejected 命名空间同族;导出常量供 bootstrap 拼接、ui 前缀匹配。
|
|
279
|
-
export const SAVED_WORKFLOW_START_REJECTED_FAULT_PREFIX =
|
|
280
|
-
"fault.command.savedWorkflowStartRejected." as const;
|
|
281
|
-
|
|
282
|
-
// resumeWorkflowRun 的拒绝:前缀 + 端口 reason(not_found / not_resumable / superseded /
|
|
283
|
-
// already_running / script_missing / script_mismatch / compile_failed);`ack.message` 携带
|
|
284
|
-
// compile_failed 的有界诊断。
|
|
285
|
-
export const WORKFLOW_RUN_RESUME_REJECTED_FAULT_PREFIX =
|
|
286
|
-
"fault.command.workflowRunResumeRejected." as const;
|
|
287
|
-
|
|
288
307
|
// cancelBackgroundWork 的拒绝:core 明确回「没有取消任何东西」时(任务不存在 / 已终结 / 类型不支持)
|
|
289
308
|
// 以前缀 + reason 上行,而不是一个假装成功的 accepted——详情页据此告诉用户这个 run 并不在跑。
|
|
290
309
|
// reason 即 core 的 stopBackgroundTask reason 去掉 `background_task_` 前缀:not_found /
|
|
@@ -317,6 +336,7 @@ export const ROW_TARGETING_COMMANDS: ReadonlySet<CommandType> = new Set([
|
|
|
317
336
|
"editUserQuery",
|
|
318
337
|
"retryTurn",
|
|
319
338
|
"setAssistantFeedback",
|
|
339
|
+
"setHighspeedMetrics",
|
|
320
340
|
]);
|
|
321
341
|
|
|
322
342
|
// ── 信封 ──
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { modelSelectionSchema } from "../model-selection.js";
|
|
3
|
+
|
|
4
|
+
export const createSessionRequestedConfigSchema = z.object({
|
|
5
|
+
modelSelection: modelSelectionSchema.optional(),
|
|
6
|
+
provider: z.string().optional(),
|
|
7
|
+
model: z.string().optional(),
|
|
8
|
+
thought: z.string().optional(),
|
|
9
|
+
followupMode: z.enum(["queue", "guide"]).optional(),
|
|
10
|
+
// Bugfix:createSession.config 表达“请求覆盖字段”,不能复用 snapshot 的
|
|
11
|
+
// sessionConfigStateSchema.partial();snapshot 为兼容旧快照给 mode 设了 default("build"),
|
|
12
|
+
// 会把“没传 mode”误变成“请求切回 build”,覆盖 workspace 默认 yolo。
|
|
13
|
+
mode: z.string().optional(),
|
|
14
|
+
planEnabled: z.boolean().optional(),
|
|
15
|
+
});
|
package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/create-workflow-display.ts
CHANGED
|
@@ -41,7 +41,10 @@ const toolCallCreateWorkflowCausalityGraphSchema = z
|
|
|
41
41
|
z
|
|
42
42
|
.object({
|
|
43
43
|
id: z.string().min(1).max(64),
|
|
44
|
-
|
|
44
|
+
// `hole`:开着的留白自己的站点(docs/dynamic-workflow/presentation.md「Holes on the timeline」),
|
|
45
|
+
// 车道恒为 `main`、阶段是留白自己的阶段(无成员);run 的 `holes[]` 按 siteId 与它相接。
|
|
46
|
+
// 与 contracts 的 CREATE_WORKFLOW_STEP_KINDS 同步。
|
|
47
|
+
kind: z.enum(["ask", "world-read", "hole"]),
|
|
45
48
|
label: z.string().min(1).max(128),
|
|
46
49
|
// 内联 `agent()` receiver 让 label 落到兜底串时,那个名字的静态形状。
|
|
47
50
|
labelPattern: namePatternSchema.optional(),
|
|
@@ -56,6 +59,11 @@ const toolCallCreateWorkflowCausalityGraphSchema = z
|
|
|
56
59
|
// 与图的 phases / phaseEdges / exits 同进同退:全在场或全缺席。
|
|
57
60
|
phase: z.string().min(1).max(64).optional(),
|
|
58
61
|
repeat: z.enum(["stack", "serial"]).optional(),
|
|
62
|
+
// 这个站点是某次补全写进来的(docs/dynamic-workflow/presentation.md「Holes on the timeline」):
|
|
63
|
+
// 值是那个留白的站点 id(名字键 `hole#<8 位十六进制>`);留白**自己的**阶段 / 站上是包着它的
|
|
64
|
+
// 留白(嵌套关系只在这里,id 里没有)。时间线据阶段上的同名键画补全的头与区域,step 上的这一份
|
|
65
|
+
// 是检视器素材。additive:旧载荷不带它照常通过 .strict()。
|
|
66
|
+
fill: z.string().min(1).max(64).optional(),
|
|
59
67
|
})
|
|
60
68
|
.strict(),
|
|
61
69
|
)
|
|
@@ -116,12 +124,38 @@ const toolCallCreateWorkflowCausalityGraphSchema = z
|
|
|
116
124
|
// 为空时缺席。是节点事实而不是边——控制没有从那里转移过来,所以不进 phaseEdges。
|
|
117
125
|
// 时间轴据此把相邻阶段折成一条分叉的「带」,侧栏迷你轨道画成双线段。
|
|
118
126
|
alongside: z.array(z.string().min(1).max(64)).min(1).max(32).optional(),
|
|
127
|
+
// 这个阶段是某次补全写进来的:值是那个留白的站点 id。时间线把同一个 `fill` 的连续几站折成
|
|
128
|
+
// 一段「补全的头 + 区域」(docs/dynamic-workflow/presentation.md「Holes on the timeline」)。
|
|
129
|
+
fill: z.string().min(1).max(64).optional(),
|
|
119
130
|
})
|
|
120
131
|
.strict(),
|
|
121
132
|
)
|
|
122
133
|
.max(32)
|
|
123
134
|
.optional(),
|
|
124
135
|
phaseEdges: z.array(workflowEdgeSchema).max(128).optional(),
|
|
136
|
+
// 阶段流(docs/dynamic-workflow/presentation.md「Streams」):两端互为 alongside 的 data 边,
|
|
137
|
+
// 只有 {from, to}——不是 runs after,不进 phaseEdges、不带 back。与词汇表同进同退。
|
|
138
|
+
phaseStreams: z
|
|
139
|
+
.array(z.object({ from: z.string().min(1).max(64), to: z.string().min(1).max(64) }).strict())
|
|
140
|
+
.max(128)
|
|
141
|
+
.optional(),
|
|
142
|
+
// 还开着的留白,源码序(docs/dynamic-workflow/authoring.md「Holes」):一个留白就是一个阶段(id =
|
|
143
|
+
// 站点 id、name = 字面量),所以它同时在 `phases` 里;这张表只补阶段表说不出的两件事——它是留白、
|
|
144
|
+
// 它的类型原文——外加 `tail`(它是脚本的尾巴:轨道要在它之后多跑 40px 再淡出)。补全过的留白不在这里。
|
|
145
|
+
holes: z
|
|
146
|
+
.array(
|
|
147
|
+
z
|
|
148
|
+
.object({
|
|
149
|
+
siteId: z.string().min(1).max(64),
|
|
150
|
+
name: z.string().min(1).max(128),
|
|
151
|
+
type: z.string().min(1).max(128),
|
|
152
|
+
phase: z.string().min(1).max(64).optional(),
|
|
153
|
+
tail: z.boolean().optional(),
|
|
154
|
+
})
|
|
155
|
+
.strict(),
|
|
156
|
+
)
|
|
157
|
+
.max(32)
|
|
158
|
+
.optional(),
|
|
125
159
|
// 控制流可在其后正常完成的阶段(阶段视图的「阶段 → 返回物」箭头);组内可为空数组。
|
|
126
160
|
exits: z.array(z.string().min(1).max(64)).max(32).optional(),
|
|
127
161
|
sink: z.array(z.string().min(1).max(64)).max(64).optional(),
|
|
@@ -151,6 +185,18 @@ export const toolCallCreateWorkflowDisplaySchema = z
|
|
|
151
185
|
.max(100),
|
|
152
186
|
causalityGraph: toolCallCreateWorkflowCausalityGraphSchema.optional(),
|
|
153
187
|
truncated: z.boolean().optional(),
|
|
188
|
+
// FillWorkflowHole 行补的是哪处留白(docs/dynamic-workflow/presentation.md「The fill row」):站点 id、
|
|
189
|
+
// **名字**、草稿路径与行号。行靠它给自己起名、卡的联接靠它累积头的标签——transcript 只存模型自己的
|
|
190
|
+
// 入参,resolveInput 回填的 `hole` 块到不了行,所以名字必须随 display 走。成功与被拒都在场。
|
|
191
|
+
fill: z
|
|
192
|
+
.object({
|
|
193
|
+
siteId: z.string().min(1).max(64),
|
|
194
|
+
name: z.string().min(1).max(128),
|
|
195
|
+
draftPath: z.string().min(1).max(1_024).optional(),
|
|
196
|
+
line: z.number().int().positive().optional(),
|
|
197
|
+
})
|
|
198
|
+
.strict()
|
|
199
|
+
.optional(),
|
|
154
200
|
})
|
|
155
201
|
.strict();
|
|
156
202
|
export type ToolCallCreateWorkflowDisplay = z.infer<typeof toolCallCreateWorkflowDisplaySchema>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { mcpAppInstanceSchema } from "../mcp-apps/instance.js";
|
|
2
|
+
// ConversationDelta:快照增量与插件 UI 的 live-only 通知,操作集合封闭(10-protocol-spec §4.5)。
|
|
2
3
|
// 没有 row.inserted(中间插入)、没有 row.moved、没有字段级 JSON patch——
|
|
3
4
|
// 凡此模型表达不了的结构变化,服务端一律发 snapshot resync,刻意压缩客户端错误面。
|
|
4
5
|
//
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
pendingInteractionSchema,
|
|
19
20
|
planStateSchema,
|
|
20
21
|
queueStateSchema,
|
|
22
|
+
runtimeInitializationSchema,
|
|
21
23
|
sessionActionAvailabilitySchema,
|
|
22
24
|
sessionConfigStateSchema,
|
|
23
25
|
sessionControlSchema,
|
|
@@ -37,6 +39,7 @@ import {
|
|
|
37
39
|
|
|
38
40
|
// StatePatch:键级整体替换(Object.assign),键集合封闭。键内绝不深合并。
|
|
39
41
|
export const statePatchSchema = z.object({
|
|
42
|
+
runtimeInitialization: runtimeInitializationSchema.optional(),
|
|
40
43
|
revision: z.number().optional(),
|
|
41
44
|
control: sessionControlSchema.optional(),
|
|
42
45
|
sharedContextImport: sharedContextImportStateSchema.optional(),
|
|
@@ -61,10 +64,19 @@ export const statePatchSchema = z.object({
|
|
|
61
64
|
});
|
|
62
65
|
export type StatePatch = z.infer<typeof statePatchSchema>;
|
|
63
66
|
|
|
67
|
+
export const pluginUiResourceSubscriberSchema = z
|
|
68
|
+
.object({
|
|
69
|
+
scopeId: z.string(),
|
|
70
|
+
generation: z.number().int().nonnegative(),
|
|
71
|
+
instance: mcpAppInstanceSchema,
|
|
72
|
+
})
|
|
73
|
+
.strict();
|
|
74
|
+
|
|
64
75
|
/**
|
|
65
76
|
* run 的 **header** = `workflowRunSchema` 减去 actors / nodes 两张按实例增量同步的表。
|
|
66
77
|
*
|
|
67
|
-
*
|
|
78
|
+
* `.omit` 派生而不是手抄一份字段表:2026-09-04 的那次订阅永久失效就是「两处各写一份 run 词汇表」
|
|
79
|
+
* 的后果。小集合(reports / artifacts / phases / pendingQuestions…)留在 header 里整键替换——
|
|
68
80
|
* 它们的上界都是几十条,为它们再开一套增量语法只会多一套能写错的东西。
|
|
69
81
|
*/
|
|
70
82
|
export const workflowRunHeaderSchema = workflowRunSchema.omit({ actors: true, nodes: true });
|
|
@@ -106,6 +118,40 @@ export const conversationDeltaSchema = z.discriminatedUnion("op", [
|
|
|
106
118
|
append: z.string(),
|
|
107
119
|
}),
|
|
108
120
|
z.object({ op: z.literal("state.updated"), patch: statePatchSchema }),
|
|
121
|
+
// 插件 UI 订阅的 MCP 资源通知。live-only:不改快照(apply 为 no-op)、不进冷恢复;
|
|
122
|
+
// renderer 按 subscribers 派发给对应沙箱实例。
|
|
123
|
+
z.object({
|
|
124
|
+
op: z.literal("pluginUi.resourceUpdated"),
|
|
125
|
+
pluginId: z.string(),
|
|
126
|
+
serverName: z.string(),
|
|
127
|
+
uri: z.string(),
|
|
128
|
+
subscribers: z.array(pluginUiResourceSubscriberSchema),
|
|
129
|
+
}),
|
|
130
|
+
z.object({
|
|
131
|
+
op: z.literal("pluginUi.resourceListChanged"),
|
|
132
|
+
pluginId: z.string(),
|
|
133
|
+
serverName: z.string(),
|
|
134
|
+
subscribers: z.array(pluginUiResourceSubscriberSchema),
|
|
135
|
+
}),
|
|
136
|
+
z.object({
|
|
137
|
+
op: z.literal("pluginUi.instanceClosed"),
|
|
138
|
+
pluginId: z.string(),
|
|
139
|
+
serverName: z.string(),
|
|
140
|
+
subscribers: z.array(pluginUiResourceSubscriberSchema),
|
|
141
|
+
}),
|
|
142
|
+
// App-Provided Tools 的"实例信箱":模型发起的页面工具调用,live-only 投递给唯一实例(subscribers 恰一项);
|
|
143
|
+
// 渲染端认领后页面 tools/call,结果经 mcp/uiResolveAppToolCall 回传。不改快照、不进冷恢复。
|
|
144
|
+
z.object({
|
|
145
|
+
op: z.literal("pluginUi.appToolCall"),
|
|
146
|
+
activity: z.boolean().optional(),
|
|
147
|
+
cancelled: z.boolean().optional(),
|
|
148
|
+
pluginId: z.string(),
|
|
149
|
+
serverName: z.string(),
|
|
150
|
+
subscribers: z.array(pluginUiResourceSubscriberSchema),
|
|
151
|
+
callId: z.string(),
|
|
152
|
+
toolName: z.string(),
|
|
153
|
+
arguments: z.record(z.string(), z.unknown()),
|
|
154
|
+
}),
|
|
109
155
|
/**
|
|
110
156
|
* 一条 dwf run 的键级增量。`revision` 是**这次变化之后**的 `workflowRuns.revision`(绝对值);
|
|
111
157
|
* 一条引擎事件最多产生一条本 op(节点相位、派生的 actor 状态、用量、水位一起落地,原子)。
|
|
@@ -143,5 +189,15 @@ export const conversationDeltaSchema = z.discriminatedUnion("op", [
|
|
|
143
189
|
}),
|
|
144
190
|
]);
|
|
145
191
|
export type ConversationDelta = z.infer<typeof conversationDeltaSchema>;
|
|
192
|
+
export type PluginUiResourceDelta = Extract<
|
|
193
|
+
ConversationDelta,
|
|
194
|
+
{ op: "pluginUi.resourceUpdated" | "pluginUi.resourceListChanged" }
|
|
195
|
+
>;
|
|
196
|
+
export type PluginUiAppToolCallDelta = Extract<ConversationDelta, { op: "pluginUi.appToolCall" }>;
|
|
197
|
+
/** 按沙箱实例投递的全部 live-only 增量。 */
|
|
198
|
+
export type PluginUiInstanceDelta =
|
|
199
|
+
| Extract<ConversationDelta, { op: "pluginUi.instanceClosed" }>
|
|
200
|
+
| PluginUiResourceDelta
|
|
201
|
+
| PluginUiAppToolCallDelta;
|
|
146
202
|
export type WorkflowRunUpdatedDelta = Extract<ConversationDelta, { op: "workflowRun.updated" }>;
|
|
147
203
|
export type WorkflowRunRemovedDelta = Extract<ConversationDelta, { op: "workflowRun.removed" }>;
|
|
@@ -1,12 +1,38 @@
|
|
|
1
|
+
import { conversationQuotesSchema } from "../conversationSelection.js";
|
|
2
|
+
import { botGroupInputSourceSchema } from "../bots.js";
|
|
1
3
|
// CLI admission 后的自包含输入事实。
|
|
2
4
|
// queue / guide / runtime / transcript 只能携带同一个 intent,不允许各层重建字段。
|
|
3
5
|
import { z } from "zod";
|
|
4
6
|
import { timestampSchema } from "./core.js";
|
|
5
7
|
import { attachmentRefSchema } from "./attachment-ref.js";
|
|
8
|
+
import { highspeedMessageMetaSchema } from "../highspeed.js";
|
|
6
9
|
import { modelSelectionSchema } from "../model-selection.js";
|
|
7
10
|
import { submissionModeSchema } from "./submission.js";
|
|
8
11
|
import { sharedContextRefSchema } from "./shared-context-ref.js";
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* 用户输入的结构化来源:插件 UI 经 `ui/message`
|
|
15
|
+
* 代用户发送时带上,落库后卡片显示"来自插件 X"。缺省即用户亲自输入。
|
|
16
|
+
*/
|
|
17
|
+
const pluginUiInputSourceSchema = z
|
|
18
|
+
.object({
|
|
19
|
+
kind: z.literal("pluginUi"),
|
|
20
|
+
pluginId: z.string().min(1),
|
|
21
|
+
toolCallId: z.string().min(1),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
export const conversationInputSourceSchema = z.discriminatedUnion("kind", [
|
|
25
|
+
pluginUiInputSourceSchema,
|
|
26
|
+
z
|
|
27
|
+
.object({
|
|
28
|
+
kind: z.literal("genUi"),
|
|
29
|
+
path: z.string().min(1).max(4096),
|
|
30
|
+
title: z.string().max(250).optional(),
|
|
31
|
+
})
|
|
32
|
+
.strict(),
|
|
33
|
+
]);
|
|
34
|
+
export type ConversationInputSource = z.infer<typeof conversationInputSourceSchema>;
|
|
35
|
+
|
|
10
36
|
export const conversationInputDeliverySchema = z
|
|
11
37
|
.object({
|
|
12
38
|
requested: z.enum(["auto", "startNow", "queue", "guide"]),
|
|
@@ -38,6 +64,9 @@ export const conversationInputDispatchSchema = z
|
|
|
38
64
|
|
|
39
65
|
export const conversationInputIntentSchema = z
|
|
40
66
|
.object({
|
|
67
|
+
inputOrigin: z.enum(["desktop", "mobile"]).optional(),
|
|
68
|
+
botGroupSource: botGroupInputSourceSchema.optional(),
|
|
69
|
+
conversationQuotes: conversationQuotesSchema.optional(),
|
|
41
70
|
sourceCommandId: z.string().min(1),
|
|
42
71
|
queueItemId: z.string().min(1),
|
|
43
72
|
clientId: z.string().min(1),
|
|
@@ -55,6 +84,7 @@ export const conversationInputIntentSchema = z
|
|
|
55
84
|
steer: conversationInputSteerSchema,
|
|
56
85
|
dispatch: conversationInputDispatchSchema,
|
|
57
86
|
admittedAt: timestampSchema,
|
|
87
|
+
highspeed: highspeedMessageMetaSchema.optional(),
|
|
58
88
|
provenance: z
|
|
59
89
|
.object({
|
|
60
90
|
sourceCommandId: z.string().min(1),
|
|
@@ -63,6 +93,7 @@ export const conversationInputIntentSchema = z
|
|
|
63
93
|
})
|
|
64
94
|
.strict()
|
|
65
95
|
.optional(),
|
|
96
|
+
source: conversationInputSourceSchema.optional(),
|
|
66
97
|
})
|
|
67
98
|
.strict();
|
|
68
99
|
|