paseo-plugin-zcode-provider 0.4.4 → 0.5.0
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 +14 -12
- package/client/account.tsx +13 -22
- package/index.server.ts +1 -3
- package/package.json +4 -4
- package/paseo-plugin.json +1 -1
- package/server/build-info.ts +1 -1
- package/server/diagnostics.ts +4 -1
- package/server/discovery/manifest.ts +2 -2
- package/server/errors.ts +1 -0
- package/server/host/bridge.ts +3 -0
- package/server/mapping.ts +23 -6
- package/server/provider-status.ts +3 -3
- package/server/provider.ts +16 -1
- package/server/runtime/pins.ts +3 -3
- package/server/session.ts +49 -13
- package/server/turn-failure.ts +6 -1
- package/server/usage.ts +1 -3
- package/server/vendor/zcode/NOTICE.md +1 -1
- package/server/vendor/zcode/packages/rpc/src/channelClient.ts +18 -3
- package/server/vendor/zcode/packages/rpc/src/channelServer.ts +32 -12
- package/server/vendor/zcode/packages/rpc/src/channels.shared.ts +8 -1
- package/server/vendor/zcode/packages/rpc/src/serialization.ts +9 -3
- package/server/vendor/zcode/packages/shared/src/browser-use/command-metadata.ts +2 -0
- package/server/vendor/zcode/packages/shared/src/browser-use/commands.ts +2 -0
- package/server/vendor/zcode/packages/shared/src/browser-use/result.ts +4 -0
- package/server/vendor/zcode/packages/shared/src/gen-ui/contract.ts +246 -0
- package/server/vendor/zcode/packages/shared/src/gen-ui/tweakProtocol.ts +143 -0
- package/server/vendor/zcode/packages/shared/src/{localTtft.ts → local-ttft/contract.ts} +56 -1
- package/server/vendor/zcode/packages/shared/src/mcp-apps/contract.ts +8 -0
- package/server/vendor/zcode/packages/shared/src/official-mcp-auth.ts +8 -0
- package/server/vendor/zcode/packages/shared/src/protocol.ts +2 -0
- package/server/vendor/zcode/packages/shared/src/request-security-edition/verification-policy.ts +9 -1
- package/server/vendor/zcode/packages/shared/src/runtimeEnv.ts +10 -0
- package/server/vendor/zcode/packages/shared/src/server-remote.ts +2 -0
- package/server/vendor/zcode/packages/shared/src/source-server/compatibility.ts +11 -0
- package/server/vendor/zcode/packages/shared/src/source-server/contracts.ts +21 -1
- package/server/vendor/zcode/packages/shared/src/source-server/errorCodes.ts +27 -9
- package/server/vendor/zcode/packages/shared/src/subagent-profile.ts +5 -0
- package/server/vendor/zcode/packages/shared/src/validationAppSettings.ts +1 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol/index.ts +164 -11
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-legacy-types.ts +1 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/apply.ts +4 -2
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/command.ts +11 -7
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/delta.ts +2 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/input-intent.ts +2 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/rows.ts +19 -1
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/snapshot.ts +11 -0
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/transport.ts +20 -1
- package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-row-meta.ts +8 -0
- package/server/vendor/zcode/provenance.json +71 -63
|
@@ -85,7 +85,10 @@ import { browserCommandResultSchema } from "../browser-use/result.js";
|
|
|
85
85
|
import { appToolSearchModeSchema } from "../app-runtime-preferences.js";
|
|
86
86
|
import { integratedTerminalShellSelectionSchema } from "../validationAppSettings.js";
|
|
87
87
|
import { zcodeTaskModeSchema } from "../zcode-task-mode-schema.js";
|
|
88
|
-
import {
|
|
88
|
+
import {
|
|
89
|
+
OFFICIAL_AUTH_CONSUMER_KINDS,
|
|
90
|
+
OFFICIAL_MCP_AUTH_PORT_FAILURE_REASONS,
|
|
91
|
+
} from "../official-mcp-auth.js";
|
|
89
92
|
import {
|
|
90
93
|
zcodeSyntheticUserMessageSourceSchema as legacyZcodeSyntheticUserMessageSourceSchema,
|
|
91
94
|
zcodeDeliveryKindSchema,
|
|
@@ -110,7 +113,7 @@ import {
|
|
|
110
113
|
zcodeWorkspaceRefSchema,
|
|
111
114
|
} from "../zcode-protocol-legacy-types.js";
|
|
112
115
|
|
|
113
|
-
export * from "../
|
|
116
|
+
export * from "../local-ttft/contract.js";
|
|
114
117
|
export {
|
|
115
118
|
hookExecutionProjectionSchema,
|
|
116
119
|
hookInvocationRowSchema,
|
|
@@ -130,9 +133,26 @@ export const ZCODE_PROTOCOL_VERSION = 1 as const;
|
|
|
130
133
|
// V4 wire 与 legacy 主协议并存;禁止为了 V4 physical framing 改写 legacy 版本。
|
|
131
134
|
export const ZCODE_PROTOCOL_V4_WIRE_VERSION = 3 as const;
|
|
132
135
|
export const zcodeRuntimeCapabilitiesSchema = z.object({
|
|
136
|
+
sessionLifecycleWorkspace: z.boolean().optional(),
|
|
137
|
+
sessionDirectorySource: z.boolean().optional(),
|
|
138
|
+
sessionWorkspaceRouting: z.boolean().optional(),
|
|
139
|
+
genUiContext: z.boolean().optional(),
|
|
133
140
|
historyFirst: z.boolean().optional(),
|
|
134
141
|
independentPlanState: z.boolean().optional(),
|
|
142
|
+
/** CLI 认识 rowsRange 的 residency 参数;旧 CLI 会剥掉它并冷恢复,Host 据此拒绝转发。 */
|
|
143
|
+
residentRowsRange: z.boolean().optional(),
|
|
135
144
|
});
|
|
145
|
+
export const zcodeRuntimeCapabilitiesParamsSchema = z
|
|
146
|
+
.object({
|
|
147
|
+
hostCapabilities: z
|
|
148
|
+
.object({
|
|
149
|
+
sessionDirectorySource: z.boolean().optional(),
|
|
150
|
+
sessionWorkspaceRouting: z.boolean().optional(),
|
|
151
|
+
})
|
|
152
|
+
.strict()
|
|
153
|
+
.optional(),
|
|
154
|
+
})
|
|
155
|
+
.strict();
|
|
136
156
|
export const zcodeProtocolErrorCodes = {
|
|
137
157
|
sessionUnavailable: -32004,
|
|
138
158
|
} as const;
|
|
@@ -753,7 +773,9 @@ export const zcodeProtocolMcpServerSchema = z.union([
|
|
|
753
773
|
z
|
|
754
774
|
.object({
|
|
755
775
|
name: nonEmptyString,
|
|
776
|
+
scope: z.enum(["user", "workspace"]).optional(),
|
|
756
777
|
command: nonEmptyString,
|
|
778
|
+
cwd: nonEmptyString.optional(),
|
|
757
779
|
args: z.array(z.string()),
|
|
758
780
|
env: z.array(zcodeProtocolMcpEntrySchema),
|
|
759
781
|
isolation: z.enum(["session", "workspace"]).optional(),
|
|
@@ -765,6 +787,7 @@ export const zcodeProtocolMcpServerSchema = z.union([
|
|
|
765
787
|
z
|
|
766
788
|
.object({
|
|
767
789
|
name: nonEmptyString,
|
|
790
|
+
scope: z.enum(["user", "workspace"]).optional(),
|
|
768
791
|
type: z.enum(["http", "sse"]),
|
|
769
792
|
url: nonEmptyString,
|
|
770
793
|
headers: z.array(zcodeProtocolMcpEntrySchema),
|
|
@@ -809,9 +832,38 @@ export const MCP_SERVER_FAILURE_KINDS = [
|
|
|
809
832
|
] as const;
|
|
810
833
|
export const mcpServerFailureKindSchema = z.enum(MCP_SERVER_FAILURE_KINDS);
|
|
811
834
|
export type McpServerFailureKind = z.infer<typeof mcpServerFailureKindSchema>;
|
|
835
|
+
export const workspaceMcpTrustReviewSchema = z
|
|
836
|
+
.object({
|
|
837
|
+
declarationDigest: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
838
|
+
sourcePaths: z.array(nonEmptyString),
|
|
839
|
+
display: z.string(),
|
|
840
|
+
trusted: z.boolean(),
|
|
841
|
+
configuredEnabled: z.boolean(),
|
|
842
|
+
transport: z.enum(["stdio", "http", "sse"]),
|
|
843
|
+
})
|
|
844
|
+
.strict();
|
|
845
|
+
export type WorkspaceMcpTrustReview = z.infer<typeof workspaceMcpTrustReviewSchema>;
|
|
846
|
+
export const zcodeWorkspaceMcpTrustParamsSchema = z
|
|
847
|
+
.object({
|
|
848
|
+
workspace: zcodeWorkspaceRefSchema,
|
|
849
|
+
serverName: nonEmptyString,
|
|
850
|
+
declarationDigest: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
851
|
+
trusted: z.boolean(),
|
|
852
|
+
})
|
|
853
|
+
.strict();
|
|
854
|
+
export const zcodeWorkspaceMcpTrustResultSchema = z
|
|
855
|
+
.object({
|
|
856
|
+
accepted: z.boolean(),
|
|
857
|
+
reasonCode: z
|
|
858
|
+
.enum(["workspace_mcp_declaration_changed", "workspace_mcp_trust_unavailable"])
|
|
859
|
+
.optional(),
|
|
860
|
+
})
|
|
861
|
+
.strict();
|
|
862
|
+
export type ZCodeWorkspaceMcpTrustResult = z.infer<typeof zcodeWorkspaceMcpTrustResultSchema>;
|
|
812
863
|
export const zcodeMcpServerStatusSnapshotSchema = z
|
|
813
864
|
.object({
|
|
814
865
|
status: zcodeMcpServerStatusKindSchema,
|
|
866
|
+
workspaceTrust: workspaceMcpTrustReviewSchema.optional(),
|
|
815
867
|
transport: z.enum(["stdio", "http", "sse"]),
|
|
816
868
|
toolCount: z.number().int().nonnegative(),
|
|
817
869
|
updatedAt: nonEmptyString,
|
|
@@ -1532,6 +1584,11 @@ export const zcodeTurnStartedEventPayloadSchema = z
|
|
|
1532
1584
|
input: z.string(),
|
|
1533
1585
|
inputId: nonEmptyString.optional(),
|
|
1534
1586
|
queryId: nonEmptyString.optional(),
|
|
1587
|
+
// Bugfix:CLI 会把 Host 准入的后台执行归因写入 turn.started。这里漏声明时,
|
|
1588
|
+
// strict 校验会丢弃整条开始事件,复用中的 Bot 私聊订阅就无法切换到新轮次。
|
|
1589
|
+
automationId: nonEmptyString.optional(),
|
|
1590
|
+
offPeakTaskId: nonEmptyString.optional(),
|
|
1591
|
+
offPeakRunType: z.enum(["init", "resume"]).optional(),
|
|
1535
1592
|
inputSource: zcodeTurnInputSourceSchema.optional(),
|
|
1536
1593
|
inputVisibility: zcodeMessageVisibilitySchema.optional(),
|
|
1537
1594
|
executionKind: z.enum(["agent", "controlOnly"]).optional(),
|
|
@@ -2059,7 +2116,7 @@ export {
|
|
|
2059
2116
|
type SubagentRuntimeConfig,
|
|
2060
2117
|
} from "../subagent-runtime-config.js";
|
|
2061
2118
|
export const zcodeSubagentsReadRuntimeConfigParamsSchema = z
|
|
2062
|
-
.object({ sessionId: nonEmptyString })
|
|
2119
|
+
.object({ sessionId: nonEmptyString, workspace: zcodeWorkspaceRefSchema.optional() })
|
|
2063
2120
|
.strict();
|
|
2064
2121
|
|
|
2065
2122
|
export const ZCODE_SESSION_RUNTIME_PREFERENCES_REQUEST_TIMEOUT_MS = 15_000;
|
|
@@ -2068,6 +2125,9 @@ export const zcodeSessionRequestRuntimePreferencesParamsSchema = z
|
|
|
2068
2125
|
.object({
|
|
2069
2126
|
sessionId: nonEmptyString,
|
|
2070
2127
|
scope: zcodeSessionRuntimePreferencesScopeSchema,
|
|
2128
|
+
workspace: zcodeWorkspaceRefSchema.optional(),
|
|
2129
|
+
// CLI 依据持久化父链给出目录来源;目标 sessionId 仍保留 child 身份。
|
|
2130
|
+
directorySessionId: nonEmptyString.optional(),
|
|
2071
2131
|
})
|
|
2072
2132
|
.strict();
|
|
2073
2133
|
export type ZCodeSessionRequestRuntimePreferencesParams = z.infer<
|
|
@@ -2716,6 +2776,7 @@ export type ZCodeBrowserListResult = z.infer<typeof zcodeBrowserListResultSchema
|
|
|
2716
2776
|
/** Agent 把一条 browser-use 命令发送给 app 执行。 */
|
|
2717
2777
|
export const zcodeBrowserExecuteParamsSchema = z
|
|
2718
2778
|
.object({
|
|
2779
|
+
controlScopeId: nonEmptyString.optional(),
|
|
2719
2780
|
requestId: nonEmptyString,
|
|
2720
2781
|
sessionId: nonEmptyString,
|
|
2721
2782
|
turnId: nonEmptyString.optional(),
|
|
@@ -2817,6 +2878,14 @@ export type ZCodeProviderRuntimeHeadersCancelled = z.infer<
|
|
|
2817
2878
|
typeof zcodeProviderRuntimeHeadersCancelledSchema
|
|
2818
2879
|
>;
|
|
2819
2880
|
|
|
2881
|
+
// 标准 JSON-RPC error 保留旧版 schema 兼容,不向严格校验的 response 增加字段。
|
|
2882
|
+
export const ZCODE_PROVIDER_CONFIG_NETWORK_ERROR = -32032;
|
|
2883
|
+
|
|
2884
|
+
export const zcodeProviderRuntimeHeadersErrorCode = {
|
|
2885
|
+
configNetwork: "request_verification_config_network",
|
|
2886
|
+
configInvalid: "request_verification_config_invalid",
|
|
2887
|
+
} as const;
|
|
2888
|
+
|
|
2820
2889
|
export const zcodeProviderRuntimeHeadersResponseSchema = z.discriminatedUnion("headersApplied", [
|
|
2821
2890
|
z
|
|
2822
2891
|
.object({
|
|
@@ -2851,15 +2920,37 @@ export type ZCodeProviderRuntimeHeadersResponse = z.infer<
|
|
|
2851
2920
|
// Agent 进程不是用户身份权威:它把 (pluginId, mcpKey, targetOrigin) 报给 host,由 host
|
|
2852
2921
|
// 解析当前 Coding Plan 凭证并回传本次请求的身份头。请求侧不含任何秘密。
|
|
2853
2922
|
// 与 interaction/requestProviderRuntimeHeaders 同类:Agent 发起、host 自动响应、零 UI。
|
|
2923
|
+
//
|
|
2924
|
+
// `consumer` 缺省为 `mcp-server`(旧版 agent 不带该字段),此时必须带 `mcpKey`;
|
|
2925
|
+
// `plugin-command` 是官方插件命令进程经 agent 代理端点发起的请求,没有 MCP,不带 `mcpKey`,
|
|
2926
|
+
// host 按「套餐可选」解析:没有套餐时只给 ZCode 登录身份(技术方案 5.8)。
|
|
2854
2927
|
export const zcodeOfficialMcpAuthHeadersRequestParamsSchema = z
|
|
2855
2928
|
.object({
|
|
2856
2929
|
requestId: nonEmptyString,
|
|
2857
2930
|
workspace: zcodeWorkspaceRefSchema,
|
|
2858
2931
|
pluginId: nonEmptyString,
|
|
2859
|
-
|
|
2932
|
+
consumer: z.enum(OFFICIAL_AUTH_CONSUMER_KINDS).optional(),
|
|
2933
|
+
mcpKey: nonEmptyString.optional(),
|
|
2860
2934
|
targetOrigin: nonEmptyString,
|
|
2861
2935
|
})
|
|
2862
|
-
.strict()
|
|
2936
|
+
.strict()
|
|
2937
|
+
.superRefine((params, ctx) => {
|
|
2938
|
+
const isCommand = params.consumer === "plugin-command";
|
|
2939
|
+
if (isCommand && params.mcpKey !== undefined) {
|
|
2940
|
+
ctx.addIssue({
|
|
2941
|
+
code: "custom",
|
|
2942
|
+
message: "plugin-command must not carry mcpKey",
|
|
2943
|
+
path: ["mcpKey"],
|
|
2944
|
+
});
|
|
2945
|
+
}
|
|
2946
|
+
if (!isCommand && params.mcpKey === undefined) {
|
|
2947
|
+
ctx.addIssue({
|
|
2948
|
+
code: "custom",
|
|
2949
|
+
message: "mcpKey is required for mcp-server",
|
|
2950
|
+
path: ["mcpKey"],
|
|
2951
|
+
});
|
|
2952
|
+
}
|
|
2953
|
+
});
|
|
2863
2954
|
export type ZCodeOfficialMcpAuthHeadersRequestParams = z.infer<
|
|
2864
2955
|
typeof zcodeOfficialMcpAuthHeadersRequestParamsSchema
|
|
2865
2956
|
>;
|
|
@@ -3911,6 +4002,7 @@ export type ZCodeAutomationProtocol = z.infer<typeof zcodeAutomationProtocolSche
|
|
|
3911
4002
|
|
|
3912
4003
|
export const zcodeAutomationCreateParamsSchema = z
|
|
3913
4004
|
.object({
|
|
4005
|
+
workspace: zcodeWorkspaceRefSchema.optional(),
|
|
3914
4006
|
title: z.string().optional(),
|
|
3915
4007
|
cronExpr: nonEmptyString,
|
|
3916
4008
|
relativeDelayMinutes: z.number().int().positive().max(525_600).optional(),
|
|
@@ -3954,6 +4046,7 @@ export type ZCodeAutomationCreateProtocolResult = z.infer<typeof zcodeAutomation
|
|
|
3954
4046
|
|
|
3955
4047
|
export const zcodeAutomationUpdateParamsSchema = z
|
|
3956
4048
|
.object({
|
|
4049
|
+
workspace: zcodeWorkspaceRefSchema.optional(),
|
|
3957
4050
|
automationId: nonEmptyString,
|
|
3958
4051
|
title: nonEmptyString.optional(),
|
|
3959
4052
|
cronExpr: nonEmptyString.optional(),
|
|
@@ -4009,7 +4102,9 @@ export const zcodeAutomationUpdateResultSchema = z
|
|
|
4009
4102
|
.strict();
|
|
4010
4103
|
export type ZCodeAutomationUpdateProtocolResult = z.infer<typeof zcodeAutomationUpdateResultSchema>;
|
|
4011
4104
|
|
|
4012
|
-
export const zcodeAutomationListParamsSchema = z
|
|
4105
|
+
export const zcodeAutomationListParamsSchema = z
|
|
4106
|
+
.object({ workspace: zcodeWorkspaceRefSchema.optional() })
|
|
4107
|
+
.strict();
|
|
4013
4108
|
export type ZCodeAutomationListProtocolParams = z.infer<typeof zcodeAutomationListParamsSchema>;
|
|
4014
4109
|
export const zcodeAutomationListResultSchema = z
|
|
4015
4110
|
.object({ automations: z.array(zcodeAutomationProtocolSchema) })
|
|
@@ -4017,7 +4112,7 @@ export const zcodeAutomationListResultSchema = z
|
|
|
4017
4112
|
export type ZCodeAutomationListProtocolResult = z.infer<typeof zcodeAutomationListResultSchema>;
|
|
4018
4113
|
|
|
4019
4114
|
export const zcodeAutomationCheckTaskBindingParamsSchema = z
|
|
4020
|
-
.object({ targetTaskId: nonEmptyString })
|
|
4115
|
+
.object({ workspace: zcodeWorkspaceRefSchema.optional(), targetTaskId: nonEmptyString })
|
|
4021
4116
|
.strict();
|
|
4022
4117
|
export type ZCodeAutomationCheckTaskBindingProtocolParams = z.infer<
|
|
4023
4118
|
typeof zcodeAutomationCheckTaskBindingParamsSchema
|
|
@@ -4030,15 +4125,24 @@ export type ZCodeAutomationCheckTaskBindingProtocolResult = z.infer<
|
|
|
4030
4125
|
>;
|
|
4031
4126
|
|
|
4032
4127
|
export const zcodeAutomationDeleteParamsSchema = z
|
|
4033
|
-
.object({ automationId: nonEmptyString })
|
|
4128
|
+
.object({ workspace: zcodeWorkspaceRefSchema.optional(), automationId: nonEmptyString })
|
|
4034
4129
|
.strict();
|
|
4035
4130
|
export type ZCodeAutomationDeleteProtocolParams = z.infer<typeof zcodeAutomationDeleteParamsSchema>;
|
|
4036
4131
|
export const zcodeAutomationDeleteResultSchema = z.object({ deleted: z.boolean() }).strict();
|
|
4037
4132
|
export type ZCodeAutomationDeleteProtocolResult = z.infer<typeof zcodeAutomationDeleteResultSchema>;
|
|
4038
4133
|
|
|
4134
|
+
// 执行轮自暂停(CronPauseSelf):automationId 来自 CLI loop state,Host 只在当前 workspace
|
|
4135
|
+
// 内做条件暂停(active 且 enabled 才转 paused)并回报是否生效。
|
|
4136
|
+
export const zcodeAutomationPauseParamsSchema = z
|
|
4137
|
+
.object({ workspace: zcodeWorkspaceRefSchema.optional(), automationId: nonEmptyString })
|
|
4138
|
+
.strict();
|
|
4139
|
+
export type ZCodeAutomationPauseProtocolParams = z.infer<typeof zcodeAutomationPauseParamsSchema>;
|
|
4140
|
+
export const zcodeAutomationPauseResultSchema = z.object({ paused: z.boolean() }).strict();
|
|
4141
|
+
export type ZCodeAutomationPauseProtocolResult = z.infer<typeof zcodeAutomationPauseResultSchema>;
|
|
4142
|
+
|
|
4039
4143
|
// ---- Off-Peak(闲时任务)会话内创建协议----
|
|
4040
4144
|
// 与 automation 兄弟并列(独立域,禁止互相复用标记/表)。workspace 由 host 端从
|
|
4041
|
-
// 当前 session
|
|
4145
|
+
// 当前 session 的已协商 workspace 注入。permissionMode 只开放产品
|
|
4042
4146
|
// 四档词表(D29-4);缺省解析在 host 端(D49-4:yolo / allowed_models 末位 / 最高推理档)。
|
|
4043
4147
|
export const zcodeOffPeakPermissionModeSchema = z.enum([
|
|
4044
4148
|
"build",
|
|
@@ -4051,6 +4155,7 @@ export type ZCodeOffPeakProtocolPermissionMode = z.infer<typeof zcodeOffPeakPerm
|
|
|
4051
4155
|
|
|
4052
4156
|
export const zcodeOffPeakCreateParamsSchema = z
|
|
4053
4157
|
.object({
|
|
4158
|
+
workspace: zcodeWorkspaceRefSchema.optional(),
|
|
4054
4159
|
title: nonEmptyString,
|
|
4055
4160
|
prompt: nonEmptyString,
|
|
4056
4161
|
permissionMode: zcodeOffPeakPermissionModeSchema.optional(),
|
|
@@ -4099,14 +4204,56 @@ export const zcodeOffPeakCreateResultSchema = z.discriminatedUnion("ok", [
|
|
|
4099
4204
|
]);
|
|
4100
4205
|
export type ZCodeOffPeakCreateProtocolResult = z.infer<typeof zcodeOffPeakCreateResultSchema>;
|
|
4101
4206
|
|
|
4102
|
-
export const zcodeOffPeakListParamsSchema = z
|
|
4207
|
+
export const zcodeOffPeakListParamsSchema = z
|
|
4208
|
+
.object({ workspace: zcodeWorkspaceRefSchema.optional() })
|
|
4209
|
+
.strict();
|
|
4103
4210
|
export type ZCodeOffPeakListProtocolParams = z.infer<typeof zcodeOffPeakListParamsSchema>;
|
|
4104
4211
|
export const zcodeOffPeakListResultSchema = z
|
|
4105
4212
|
.object({ tasks: z.array(zcodeOffPeakTaskSnapshotSchema) })
|
|
4106
4213
|
.strict();
|
|
4107
4214
|
export type ZCodeOffPeakListProtocolResult = z.infer<typeof zcodeOffPeakListResultSchema>;
|
|
4108
4215
|
|
|
4216
|
+
// Session 运行实例生命周期;不同于 session/stop(停止生成)。
|
|
4217
|
+
export const sessionLifecycleParamsSchema = z.object({ sessionId: z.string().min(1) }).strict();
|
|
4218
|
+
export const sessionLifecycleActivationParamsSchema = sessionLifecycleParamsSchema.extend({
|
|
4219
|
+
workspace: zcodeWorkspaceRefSchema.optional(),
|
|
4220
|
+
});
|
|
4221
|
+
export const sessionLifecycleStateSchema = z.enum([
|
|
4222
|
+
"unloaded",
|
|
4223
|
+
"starting",
|
|
4224
|
+
"ready",
|
|
4225
|
+
"stopping",
|
|
4226
|
+
"faulted",
|
|
4227
|
+
]);
|
|
4228
|
+
export const sessionLifecycleOperationSchema = z.enum(["ensureReady", "stop", "restart"]);
|
|
4229
|
+
export const sessionLifecycleFailureSchema = z
|
|
4230
|
+
.object({
|
|
4231
|
+
operation: sessionLifecycleOperationSchema,
|
|
4232
|
+
code: z.string(),
|
|
4233
|
+
message: z.string(),
|
|
4234
|
+
})
|
|
4235
|
+
.strict();
|
|
4236
|
+
export const sessionLifecycleSnapshotSchema = z
|
|
4237
|
+
.object({
|
|
4238
|
+
sessionId: z.string().min(1),
|
|
4239
|
+
state: sessionLifecycleStateSchema,
|
|
4240
|
+
generation: z.number().int().nonnegative().default(0),
|
|
4241
|
+
revision: z.number().int().nonnegative().default(0),
|
|
4242
|
+
lastError: sessionLifecycleFailureSchema.nullable(),
|
|
4243
|
+
})
|
|
4244
|
+
.strict();
|
|
4245
|
+
export const sessionLifecycleResultSchema = z.object({ completed: z.literal(true) }).strict();
|
|
4246
|
+
export type SessionLifecycleState = z.infer<typeof sessionLifecycleStateSchema>;
|
|
4247
|
+
export type SessionLifecycleOperation = z.infer<typeof sessionLifecycleOperationSchema>;
|
|
4248
|
+
export type SessionLifecycleFailure = z.infer<typeof sessionLifecycleFailureSchema>;
|
|
4249
|
+
export type SessionLifecycleSnapshot = z.infer<typeof sessionLifecycleSnapshotSchema>;
|
|
4250
|
+
|
|
4109
4251
|
export const zcodeProtocolMethods = {
|
|
4252
|
+
sessionLifecycleChanged: "session/lifecycle/changed",
|
|
4253
|
+
sessionLifecycleGetState: "session/lifecycle/getState",
|
|
4254
|
+
sessionLifecycleEnsureReady: "session/lifecycle/ensureReady",
|
|
4255
|
+
sessionLifecycleStop: "session/lifecycle/stop",
|
|
4256
|
+
sessionLifecycleRestart: "session/lifecycle/restart",
|
|
4110
4257
|
runtimeCapabilities: "runtime/capabilities",
|
|
4111
4258
|
computerUseOperationEvent: "computer-use/operation-event",
|
|
4112
4259
|
sessionCreate: "session/create",
|
|
@@ -4162,6 +4309,7 @@ export const zcodeProtocolMethods = {
|
|
|
4162
4309
|
workspaceCancelGenerateText: "workspace/cancelGenerateText",
|
|
4163
4310
|
providerTestModelConnectivity: "provider/testModelConnectivity",
|
|
4164
4311
|
mcpList: "mcp/list",
|
|
4312
|
+
workspaceMcpTrust: "workspace/mcp/trust",
|
|
4165
4313
|
mcpReadResource: "mcp/readResource",
|
|
4166
4314
|
mcpUiOpenInstance: "mcp/uiOpenInstance",
|
|
4167
4315
|
mcpUiCloseInstance: "mcp/uiCloseInstance",
|
|
@@ -4220,6 +4368,7 @@ export const zcodeProtocolMethods = {
|
|
|
4220
4368
|
automationCheckTaskBinding: "automation/checkTaskBinding",
|
|
4221
4369
|
automationList: "automation/list",
|
|
4222
4370
|
automationDelete: "automation/delete",
|
|
4371
|
+
automationPause: "automation/pause",
|
|
4223
4372
|
// Off-Peak 会话内创建:与 automation 兄弟并列的独立方法族。
|
|
4224
4373
|
offPeakCreate: "offPeak/create",
|
|
4225
4374
|
offPeakList: "offPeak/list",
|
|
@@ -4264,6 +4413,10 @@ export const zcodeProtocolSessionMethodContracts = {
|
|
|
4264
4413
|
params: zcodeWorkspaceHookTrustGrantParamsSchema,
|
|
4265
4414
|
result: zcodeWorkspaceHookTrustGrantResultSchema,
|
|
4266
4415
|
},
|
|
4416
|
+
[zcodeProtocolMethods.workspaceMcpTrust]: {
|
|
4417
|
+
params: zcodeWorkspaceMcpTrustParamsSchema,
|
|
4418
|
+
result: zcodeWorkspaceMcpTrustResultSchema,
|
|
4419
|
+
},
|
|
4267
4420
|
[zcodeProtocolMethods.mcpList]: {
|
|
4268
4421
|
params: zcodeMcpListParamsSchema,
|
|
4269
4422
|
result: zcodeMcpListResultSchema,
|
|
@@ -4365,7 +4518,7 @@ export const zcodeStoragePathReadySchema = z
|
|
|
4365
4518
|
.strict();
|
|
4366
4519
|
|
|
4367
4520
|
// 桌面本地 TTFT 的严格事实合同;检查点不能替代实际内容帧。
|
|
4368
|
-
export { localTtftFactsSchema } from "../
|
|
4521
|
+
export { localTtftFactsSchema } from "../local-ttft/contract.js";
|
|
4369
4522
|
// 群来源由可信 Host 注入,V4 命令与持久化输入使用相同运行时校验。
|
|
4370
4523
|
export {
|
|
4371
4524
|
botIdentitySchema,
|
|
@@ -148,6 +148,7 @@ export const zcodeSessionGoalVerificationTimelineSchema = z
|
|
|
148
148
|
export const zcodeSessionInfoSchema = z
|
|
149
149
|
.object({
|
|
150
150
|
sessionId: nonEmptyString,
|
|
151
|
+
directorySessionId: nonEmptyString.optional(),
|
|
151
152
|
workspace: zcodeWorkspaceRefSchema,
|
|
152
153
|
parentSessionId: nonEmptyString.optional(),
|
|
153
154
|
traceId: nonEmptyString.optional(),
|
|
@@ -85,7 +85,9 @@ export function applyConversationDelta(
|
|
|
85
85
|
},
|
|
86
86
|
};
|
|
87
87
|
case "row.upserted": {
|
|
88
|
-
|
|
88
|
+
// 窗口内 rowId 唯一(rows.ts:session 内单调、永不复用),从尾部查找与从头查找结果相同。
|
|
89
|
+
// upsert/delta 的目标几乎总是尾部的流式行;从头 findIndex 会让每条 delta 都扫描整段历史。
|
|
90
|
+
const index = snapshot.rows.window.findLastIndex(
|
|
89
91
|
(row) => row.rowId === delta.row.rowId,
|
|
90
92
|
);
|
|
91
93
|
// §4.3:未加载 rowId = no-op(被逐出的行只能经 rows/range 取回)。
|
|
@@ -117,7 +119,7 @@ export function applyConversationDelta(
|
|
|
117
119
|
};
|
|
118
120
|
}
|
|
119
121
|
case "row.delta": {
|
|
120
|
-
const index = snapshot.rows.window.
|
|
122
|
+
const index = snapshot.rows.window.findLastIndex(
|
|
121
123
|
(row) => row.rowId === delta.rowId,
|
|
122
124
|
);
|
|
123
125
|
const target = snapshot.rows.window[index];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { genUiModelContextSchema } from "../gen-ui/contract.js";
|
|
1
2
|
import { createSessionRequestedConfigSchema } from "./create-session-config.js";
|
|
2
|
-
import { localTtftContextSchema, localTtftClockSchema } from "../
|
|
3
|
+
import { localTtftContextSchema, localTtftClockSchema } from "../local-ttft/contract.js";
|
|
3
4
|
import { conversationQuotesSchema } from "../conversationSelection.js";
|
|
4
5
|
// Command 层:信封 / ACK / 命令全集 payload。
|
|
5
6
|
// conversation rewind 无独立命令(裁决:= editUserQuery 的 UI 入口);
|
|
@@ -99,6 +100,7 @@ export const commandPayloadSchemas = {
|
|
|
99
100
|
// Desktop Cmd/Ctrl+Enter 只覆盖本次 busy input,不改 session followupMode。
|
|
100
101
|
// startNow 由 CLI 原子抢占当前 turn,不经过 queue admission。
|
|
101
102
|
requestedDelivery: z.enum(["startNow", "queue", "guide"]).optional(),
|
|
103
|
+
genUiContext: genUiModelContextSchema.optional(),
|
|
102
104
|
browserAmbientContext: zcodeBrowserAmbientContextSchema.optional(),
|
|
103
105
|
// Share handover 只允许当前 session 的一个已导入上下文;完整正文由 runtime 从
|
|
104
106
|
// 持久化 provenance 解析,不能随 command 从 renderer 传入。
|
|
@@ -164,23 +166,23 @@ export const commandPayloadSchemas = {
|
|
|
164
166
|
}),
|
|
165
167
|
// compact 是输入型维护命令:idle 时立即执行,busy/held 时进入 FIFO。
|
|
166
168
|
// 因为 admission 与当前 revision 无关,不走 CAS;sourceCommandId 提供幂等边界。
|
|
167
|
-
compact: z.object({}),
|
|
169
|
+
compact: z.object({ modelSelection: modelSelectionSchema.optional() }),
|
|
168
170
|
// running 时对稳定 assistant row 可用。
|
|
169
171
|
forkAssistant: z.object({ target: conversationRowTargetSchema }),
|
|
170
172
|
applyFileRewind: z.object({ target: conversationRowTargetSchema }),
|
|
171
173
|
editUserQuery: z
|
|
172
174
|
.object({
|
|
173
|
-
|
|
174
|
-
|
|
175
|
+
target: conversationRowTargetSchema,
|
|
176
|
+
newText: z.string(),
|
|
175
177
|
conversationQuotes: conversationQuotesSchema.optional(),
|
|
176
|
-
|
|
178
|
+
attachments: z.array(attachmentRefSchema).optional(),
|
|
177
179
|
// 编辑重发按新的主动发送处理:只接受本次重新 prepare 得到的卡与执行材料,
|
|
178
180
|
// 不从被 rewind 的历史消息复用旧凭据。
|
|
179
181
|
modelSelection: modelSelectionSchema.optional(),
|
|
180
182
|
modelExecution: modelExecutionSchema.optional(),
|
|
181
183
|
highspeedMeta: highspeedMessageMetaSchema.optional(),
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
// 缺省 preserve:仅切 conversation branch;rewind 会先安全恢复该轮文件。
|
|
185
|
+
workspaceMode: z.enum(["preserve", "rewind"]).optional(),
|
|
184
186
|
})
|
|
185
187
|
.superRefine(requireModelSelectionForExecution),
|
|
186
188
|
retryTurn: z.object({ target: conversationRowTargetSchema }),
|
|
@@ -341,6 +343,8 @@ export const ROW_TARGETING_COMMANDS: ReadonlySet<CommandType> = new Set([
|
|
|
341
343
|
|
|
342
344
|
// ── 信封 ──
|
|
343
345
|
export const commandEnvelopeSchema = z.object({
|
|
346
|
+
/** Host 可信 attachment 注入;CLI 保留到原 input intent。 */
|
|
347
|
+
inputOrigin: z.enum(["desktop", "mobile"]).optional(),
|
|
344
348
|
ttft: localTtftContextSchema.optional(),
|
|
345
349
|
// uuid v7,客户端生成,重试不变。
|
|
346
350
|
commandId: z.string(),
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
sessionUsageStateSchema,
|
|
29
29
|
subagentProjectionStateSchema,
|
|
30
30
|
workspaceHookAdmissionStateSchema,
|
|
31
|
+
workspaceMcpAdmissionStateSchema,
|
|
31
32
|
} from "./snapshot.js";
|
|
32
33
|
import {
|
|
33
34
|
WORKFLOW_RUNS_LIMITS,
|
|
@@ -61,6 +62,7 @@ export const statePatchSchema = z.object({
|
|
|
61
62
|
plan: planStateSchema.nullable().optional(),
|
|
62
63
|
// 软门禁:null = pending 清零(提示条消失);对象 = 待审核状态更新。
|
|
63
64
|
workspaceHookAdmission: workspaceHookAdmissionStateSchema.nullable().optional(),
|
|
65
|
+
workspaceMcpAdmission: workspaceMcpAdmissionStateSchema.nullable().optional(),
|
|
64
66
|
});
|
|
65
67
|
export type StatePatch = z.infer<typeof statePatchSchema>;
|
|
66
68
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { genUiModelContextSchema } from "../gen-ui/contract.js";
|
|
1
2
|
import { conversationQuotesSchema } from "../conversationSelection.js";
|
|
2
3
|
import { botGroupInputSourceSchema } from "../bots.js";
|
|
3
4
|
// CLI admission 后的自包含输入事实。
|
|
@@ -78,6 +79,7 @@ export const conversationInputIntentSchema = z
|
|
|
78
79
|
modelSelection: modelSelectionSchema.optional(),
|
|
79
80
|
mode: submissionModeSchema.optional(),
|
|
80
81
|
planEnabled: z.boolean().optional(),
|
|
82
|
+
genUiContext: genUiModelContextSchema.optional(),
|
|
81
83
|
sharedContextRefs: z.array(sharedContextRefSchema).max(1).optional(),
|
|
82
84
|
delivery: conversationInputDeliverySchema,
|
|
83
85
|
order: conversationInputOrderSchema,
|
|
@@ -43,6 +43,7 @@ export type RowActions = NonNullable<z.infer<typeof rowActionsSchema>>;
|
|
|
43
43
|
// workflow 轮的行级元数据拆到了 workflow-row-meta.ts(max-lines);名字在此原样再导出。
|
|
44
44
|
export {
|
|
45
45
|
backgroundResultOriginMetaSchema,
|
|
46
|
+
subagentResultMetaSchema,
|
|
46
47
|
workflowBlockedMetaSchema,
|
|
47
48
|
workflowLaunchMetaSchema,
|
|
48
49
|
workflowNotificationMetaSchema,
|
|
@@ -95,7 +96,7 @@ export const turnHeaderRowSchema = z.object({
|
|
|
95
96
|
modelDurationMs: z.number().nonnegative().optional(),
|
|
96
97
|
toolDurationMs: z.number().nonnegative().optional(),
|
|
97
98
|
otherDurationMs: z.number().nonnegative().optional(),
|
|
98
|
-
// guide 不切 product turn
|
|
99
|
+
// guide 不切 product turn;一个 drain 边界按 FIFO 取出全部已等待的 guide,它们共用首条开启的视觉工作段。
|
|
99
100
|
// 普通 turn 缺省以保持旧 snapshot 兼容;一旦出现 guide,CLI 负责完整投影首段与后续段。
|
|
100
101
|
workSegments: z.array(turnWorkSegmentSchema).optional(),
|
|
101
102
|
originMeta: backgroundResultOriginMetaSchema.optional(),
|
|
@@ -445,3 +446,20 @@ export const conversationRowSchema = z.discriminatedUnion("kind", [
|
|
|
445
446
|
]);
|
|
446
447
|
export type ConversationRow = z.infer<typeof conversationRowSchema>;
|
|
447
448
|
export type ConversationRowKind = ConversationRow["kind"];
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* rows.window 的「冻结历史 + 尾轮」分区(spec:docs/ui/chat-virtual-scroll.md「每帧派生成本」)。
|
|
452
|
+
*
|
|
453
|
+
* 只是行数组的视图类型,不上 wire,没有 schema;构造与缓存在 renderer 的 conversationProjectionStore。
|
|
454
|
+
* 放在这里是为了让插件 UI 等 domain 层只依赖协议类型,不依赖 v4 store。
|
|
455
|
+
* history 与 tail 拼接后逐项等于 rows。
|
|
456
|
+
*/
|
|
457
|
+
export interface ConversationRowsPartition {
|
|
458
|
+
/** tail 之前的行;只在历史段变化时更换引用。 */
|
|
459
|
+
readonly history: readonly ConversationRow[];
|
|
460
|
+
/**
|
|
461
|
+
* window 的后缀:包含最后一行所在轮的全部行,可能包含多轮(旧轮追加了行、或尾轮内部截断后),
|
|
462
|
+
* 与 history 的轮次不相交。消费方不能假设 tail 只有一轮。
|
|
463
|
+
*/
|
|
464
|
+
readonly tail: readonly ConversationRow[];
|
|
465
|
+
}
|
|
@@ -215,6 +215,8 @@ export const queueItemSchema = conversationInputIntentSchema.extend({
|
|
|
215
215
|
dispatch: conversationInputDispatchSchema.extend({
|
|
216
216
|
state: z.enum(["queued", "reserved", "promoting"]),
|
|
217
217
|
}),
|
|
218
|
+
/** Host 准入注入的可信 automation 身份;只允许队列提升原样回放。 */
|
|
219
|
+
automationId: z.string().min(1).optional(),
|
|
218
220
|
toolDisallowlist: z.array(z.string().min(1)).optional(),
|
|
219
221
|
});
|
|
220
222
|
export type QueueItem = z.infer<typeof queueItemSchema>;
|
|
@@ -472,6 +474,13 @@ export const workspaceHookAdmissionStateSchema = z.object({
|
|
|
472
474
|
});
|
|
473
475
|
export type WorkspaceHookAdmissionSnapshotState = z.infer<typeof workspaceHookAdmissionStateSchema>;
|
|
474
476
|
|
|
477
|
+
export const workspaceMcpAdmissionStateSchema = z.object({
|
|
478
|
+
pendingCount: z.number().int().nonnegative(),
|
|
479
|
+
bundleDigest: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
480
|
+
workspaceIdentity: z.string().min(1).optional(),
|
|
481
|
+
});
|
|
482
|
+
export type WorkspaceMcpAdmissionSnapshotState = z.infer<typeof workspaceMcpAdmissionStateSchema>;
|
|
483
|
+
|
|
475
484
|
// 冷历史可读不代表 runtime 已可执行;缺席兼容旧发送端。
|
|
476
485
|
export const runtimeInitializationSchema = z.discriminatedUnion("status", [
|
|
477
486
|
z.object({ status: z.literal("initializing"), attemptId: z.string().min(1) }),
|
|
@@ -522,6 +531,8 @@ export const conversationSnapshotSchema = z.object({
|
|
|
522
531
|
// 旧快照/旧发送端不携带此字段 → 解析得 null,不破坏兼容性(遵守冻结规则)。
|
|
523
532
|
// pendingCount === 0 时投影层置 null(提示条消失)。
|
|
524
533
|
workspaceHookAdmission: workspaceHookAdmissionStateSchema.nullable().default(null),
|
|
534
|
+
// 旧发送端可缺席;null 或缺席均无 MCP 待审核提示。
|
|
535
|
+
workspaceMcpAdmission: workspaceMcpAdmissionStateSchema.nullable().optional(),
|
|
525
536
|
// (2026-09-12):原 additive 字段 pluginUiSurfaces 已删除,插件面板 widgetState 只留在
|
|
526
537
|
// 宿主 renderer 内存。
|
|
527
538
|
// B 区
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { localTtftFactsSchema } from "../
|
|
1
|
+
import { localTtftFactsSchema } from "../local-ttft/contract.js";
|
|
2
2
|
/* eslint-disable max-lines -- 三个 topic 的 logical/physical/candidate schema 必须共享同一通用传输声明,避免跨文件分叉。 */
|
|
3
3
|
// 传输外壳:连接握手 / 订阅 / 帧信封。
|
|
4
4
|
// 阶段为类型占位(后半接通道层时启用),数据形状已按规范定稿。
|
|
@@ -29,6 +29,7 @@ export const hostCapabilitiesSchema = z.object({
|
|
|
29
29
|
// Wire-compatible:旧 Host 缺失等价于 false;调用方必须用 === true 判断。
|
|
30
30
|
workspaceHookReview: z.boolean().optional(),
|
|
31
31
|
independentPlanState: z.boolean().optional(),
|
|
32
|
+
genUiContext: z.boolean().optional(),
|
|
32
33
|
/**
|
|
33
34
|
* 本 Host 会发 `workflowRun.*` 键级增量(delta.ts 的两条 op),因而 `workflowRuns` 的
|
|
34
35
|
* actors / nodes 可以到 1024 而不是旧界的 256。没有这个位的消费者收到的仍是整键
|
|
@@ -36,6 +37,13 @@ export const hostCapabilitiesSchema = z.object({
|
|
|
36
37
|
*/
|
|
37
38
|
workflowRunDeltas: z.boolean().optional(),
|
|
38
39
|
historyFirst: z.boolean().optional(),
|
|
40
|
+
/**
|
|
41
|
+
* 本 Host 开启并转发 `v4/conversation/inputPrediction`。旧 Host 缺失等价于 false,
|
|
42
|
+
* 手机必须用 === true 判断,否则不发预测请求。
|
|
43
|
+
*/
|
|
44
|
+
inputPrediction: z.boolean().optional(),
|
|
45
|
+
/** 本 Host 支持 rowsRange 的 `residency: "resident-only"`;缺失等价于 false,手机不得预加载。 */
|
|
46
|
+
residentRowsRange: z.boolean().optional(),
|
|
39
47
|
});
|
|
40
48
|
export type HostCapabilities = z.infer<typeof hostCapabilitiesSchema>;
|
|
41
49
|
|
|
@@ -345,6 +353,8 @@ export const V4_METHODS = {
|
|
|
345
353
|
conversationUnsubscribe: "v4/conversation/unsubscribe",
|
|
346
354
|
// 行分页 query(rows/range):只读、无状态、超时重发安全。
|
|
347
355
|
conversationRowsRange: "v4/conversation/rowsRange",
|
|
356
|
+
// 手机输入预测(input-prediction.ts):只读查询;旧 CLI 不认识时手机静默无 hint。
|
|
357
|
+
conversationInputPrediction: "v4/conversation/inputPrediction",
|
|
348
358
|
// 当前有效分支的终态 ExitPlanMode 目录;只读、无状态、超时重发安全。
|
|
349
359
|
conversationPlans: "v4/conversation/plans",
|
|
350
360
|
conversationFileChanges: "v4/conversation/fileChanges",
|
|
@@ -372,6 +382,10 @@ export const V4_METHODS = {
|
|
|
372
382
|
// 故收敛为 v4 query 而非 host 直连;旧词 usage/stats、session/usage 就此消费清零。
|
|
373
383
|
usageStats: "v4/usage/stats",
|
|
374
384
|
conversationUsage: "v4/conversation/usage",
|
|
385
|
+
// 项目数据彻底删除(schema 在 session-data.ts):measure 只读;purge 幂等,已不存在的会话按 0 字节成功。
|
|
386
|
+
// 新方法偏斜安全:旧 CLI 返回 method-not-found,Host 据此不显示「删除数据」选项。
|
|
387
|
+
sessionDataMeasure: "v4/storage/sessionData/measure",
|
|
388
|
+
sessionDataPurge: "v4/storage/sessionData/purge",
|
|
375
389
|
// 附件事务:禁止 full-data RPC。每个 chunk 的 decoded bytes <=512KiB,
|
|
376
390
|
// renderer->host Channel 与 host->CLI NDJSON 都必须逐 request 证明 <=1MiB。
|
|
377
391
|
attachmentBegin: "v4/attachment/begin",
|
|
@@ -526,6 +540,11 @@ export const v4ConversationRowsRangeParamsSchema = z.object({
|
|
|
526
540
|
// 取 rowId < beforeRowId 的行;缺省 = 从当前尾部向前。
|
|
527
541
|
beforeRowId: z.number().optional(),
|
|
528
542
|
limit: z.number().min(1).max(PROTOCOL_V4_LIMITS.rowsRangeMaxLimit),
|
|
543
|
+
/**
|
|
544
|
+
* 手机预加载只读热会话:会话不在内存就报 proto.sessionNotResident,不冷恢复、不重建投影;
|
|
545
|
+
* Host 同时只复用已运行的工作区 CLI,不为它拉起进程。缺省 = 现有行为(按需冷恢复)。
|
|
546
|
+
*/
|
|
547
|
+
residency: z.literal("resident-only").optional(),
|
|
529
548
|
});
|
|
530
549
|
export type V4ConversationRowsRangeParams = z.infer<typeof v4ConversationRowsRangeParamsSchema>;
|
|
531
550
|
|
|
@@ -106,6 +106,12 @@ export const workflowBlockedMetaSchema = z.object({
|
|
|
106
106
|
});
|
|
107
107
|
export type WorkflowBlockedMeta = z.infer<typeof workflowBlockedMetaSchema>;
|
|
108
108
|
|
|
109
|
+
// 后台 Agent 的终态与失败原文(contracts 的 SubagentResultMeta);产品状态读它,不解析通知文本。
|
|
110
|
+
export const subagentResultMetaSchema = z.object({
|
|
111
|
+
status: z.enum(["completed", "failed", "killed"]),
|
|
112
|
+
error: z.string().optional(),
|
|
113
|
+
});
|
|
114
|
+
|
|
109
115
|
export const backgroundResultOriginMetaSchema = z.object({
|
|
110
116
|
// 三个取值与 contracts 的 BackgroundResultOriginMeta 保持同步。
|
|
111
117
|
// "workflow" 是 dynamic-workflow run(workId ≡ runId),复用整条后台通知管线。
|
|
@@ -118,6 +124,8 @@ export const backgroundResultOriginMetaSchema = z.object({
|
|
|
118
124
|
// 提醒载荷,与 workflowNotification 至多在场一个。`.catch(undefined)`:将来它的形状变了,认识这个
|
|
119
125
|
// 键的客户端把它当作缺席(裸标题行),而不是丢掉整帧。
|
|
120
126
|
workflowBlocked: workflowBlockedMetaSchema.optional().catch(undefined),
|
|
127
|
+
// 只在 subagent 的单条通知轮上在场;形状不认识时当作缺席,界面退回通知文本。
|
|
128
|
+
subagentResult: subagentResultMetaSchema.optional().catch(undefined),
|
|
121
129
|
});
|
|
122
130
|
export type BackgroundResultOriginMeta = z.infer<typeof backgroundResultOriginMetaSchema>;
|
|
123
131
|
|