openyida 2026.11.18-1 → 2026.11.19

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.
@@ -212,6 +212,9 @@ module.exports = {
212
212
  page_offline: 'Menu data cannot confirm page {0} is live. If its published URL opens, pass the full URL with --frontend.',
213
213
  },
214
214
  design_plan: {
215
+ confirmation_header: 'Build plan',
216
+ confirmation_build_description: 'Create the application, forms, workflows and pages from this plan.',
217
+ confirmation_edit_description: 'Refine this plan before confirming the build.',
215
218
  confirmation_required: 'Confirmation requires the current plan snapshot and revision. Materialize the plan first.',
216
219
  rebase_required: 'Before first materialization, repair the matching facts in business.json/visual.json and preserve the source baseline. If the source changed, add --rebase-parts to the original materialize command to reconcile against the saved baseline. Do not invent a digest, delete drafts, or run init again.',
217
220
  baseline_missing: 'No trusted baseline matches these parts. Preserve the plan and facts; restore .build-plan-base.json from the original workspace. If unavailable, report the blocker instead of inventing a digest or rebuilding.',
@@ -212,6 +212,9 @@ module.exports = {
212
212
  page_offline: '菜单数据无法确认前台页 {0} 已上线。如已发布且实测可访问,请用 --frontend 传完整地址。',
213
213
  },
214
214
  design_plan: {
215
+ confirmation_header: '搭建方案',
216
+ confirmation_build_description: '按当前方案创建应用、表单、流程和页面。',
217
+ confirmation_edit_description: '继续完善当前方案,确认后再开始搭建。',
215
218
  confirmation_required: '确认需要当前方案快照和版本,请先生成方案。',
216
219
  rebase_required: '首次物化前请修正 business.json/visual.json 中的对应 facts,保留主计划基线。如果主计划已改变,在原 materialize 命令加 --rebase-parts,CLI 会根据保存的基线核对差异;不要手填 digest、删除草稿或重新 init。',
217
220
  baseline_missing: '未找到与片段匹配的可信原始基线。保留当前计划与 facts;从原工作区恢复 .build-plan-base.json 后重试。无法恢复时明确告知用户阻塞,不伪造摘要或自动重建。',
@@ -7,10 +7,12 @@ const confirmationPolicy = {
7
7
  tool: 'ask_human',
8
8
  requiredBeforeExecution: true,
9
9
  payloadField: 'confirmation',
10
- policy: 'Actually invoke permitted structured ask_human with the current snapshot/revision and wait. Managed Local uses agent ask-human. Files, links, prose and self-written flags are not approval.',
11
- approval: 'Require confirm_build from this interaction and revision; record real ID/answer. Reject stale/cancelled/empty/timed-out replies. queued/pending is not consent; continue_editing only edits the draft.',
12
- unavailable: 'Keep awaiting_confirmation and explain the unavailable tool. Do not fall back to prose approval, switch to Fast or create/update/publish resources.',
10
+ policy: 'ask_human is a logical action: invoke an available permitted structured host tool and wait. QwenWork desktop may use AskUserQuestion after presenting the immutable snapshot; the agent binds the real interaction to snapshot/revision outside the tool input. Pass only supported schema fields. Managed Local uses agent ask-human only in a verified managed run. Files, links, prose and self-written flags alone are not approval.',
11
+ approval: 'Require confirm_build from this interaction and revision; map the host answer using the recorded options, and record real ID/answer. Before continuing CLI building, verify that the current revision and snapshot content still match the presented context. Reject stale/cancelled/empty/timed-out replies. queued/pending is not consent; continue_editing only edits the draft.',
12
+ unavailable: 'Use AskUserQuestion or another permitted host question tool before declaring confirmation unavailable; lack of attachments/revision parameters is not a blocker when the agent records the snapshot binding. If no structured tool is available or it fails, keep awaiting_confirmation. Do not fall back to prose approval, switch to Fast, create/update/publish resources, open a browser to find approval, or create another web build task.',
13
13
  reuse: 'Reuse verified same-plan approval after recovery or asset progress. Scope/visual changes require reconfirmation. Fast adds no Plan approval.',
14
+ hostAdapter: { tool: 'AskUserQuestion', payloadField: 'confirmationAdapters.AskUserQuestion.input',
15
+ bindingField: 'confirmationAdapters.AskUserQuestion.context', recordPath: 'meta.planState.confirmationContext' },
14
16
  };
15
17
 
16
18
  function confirmationPayload(outputs, revision) {
@@ -28,7 +30,32 @@ function confirmationPayload(outputs, revision) {
28
30
  }
29
31
 
30
32
  function confirmationHandoff(outputs, revision) {
31
- return { confirmation: confirmationPayload(outputs, revision), confirmationPolicy };
33
+ const confirmation = confirmationPayload(outputs, revision);
34
+ return {
35
+ confirmation,
36
+ confirmationPolicy,
37
+ confirmationAdapters: {
38
+ AskUserQuestion: {
39
+ input: {
40
+ questions: [{
41
+ question: confirmation.question,
42
+ header: t('design_plan.confirmation_header'),
43
+ options: [
44
+ { label: confirmation.options[0].label, description: t('design_plan.confirmation_build_description') },
45
+ { label: confirmation.options[1].label, description: t('design_plan.confirmation_edit_description') },
46
+ ],
47
+ multiSelect: false,
48
+ }],
49
+ },
50
+ context: {
51
+ revision,
52
+ snapshotPath: outputs.confirmationHtml,
53
+ question: confirmation.question,
54
+ answerMap: Object.fromEntries(confirmation.options.map(option => [option.label, option.value])),
55
+ },
56
+ },
57
+ },
58
+ };
32
59
  }
33
60
 
34
61
  module.exports = { confirmationPayload, confirmationPolicy, confirmationHandoff };
@@ -137,6 +137,7 @@ function invalidateConfirmation(plan, original) {
137
137
  plan.meta.planState.planConfirmed = false;
138
138
  plan.meta.planState.confirmationInteractionId = '';
139
139
  plan.meta.planState.confirmedAt = '';
140
+ delete plan.meta.planState.confirmationContext;
140
141
  return true;
141
142
  }
142
143
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openyida",
3
- "version": "2026.11.18-1",
3
+ "version": "2026.11.19",
4
4
  "description": "OpenYida CLI - AI 宜搭应用开发工具(安装即用,零配置)",
5
5
  "bin": {
6
6
  "openyida": "bin/yida.js",
@@ -38,6 +38,10 @@ Fast / Plan 选定的主题和主色属于整个应用:导航、原生页、
38
38
  `runId`、`runtimeId` 或日志文件。排障通常发生在另一个普通本地 Agent 会话中,
39
39
  不能只依据 `OPENYIDA_MANAGED_RUN` 判断是否属于云端关联本地 Agent 场景。
40
40
 
41
+ ## 普通客户端的 Plan 确认
42
+
43
+ 普通千问办公客户端使用宿主原生 `AskUserQuestion` 确认当前方案;`ask_human` 是逻辑动作,不要求存在同名 MCP 工具。按 [Plan 交付](skills/yida-app/workflow/plan/step-4-deliver.md) 展示不可变方案快照,再调用 CLI 返回的 `confirmationAdapters.AskUserQuestion.input`,由 Agent 关联版本、内容摘要与真实回答。工具无需 attachments/revision 参数;核对当前方案未变且用户选择确认后,继续通过 CLI 搭建。不转浏览器找确认入口,不另建网页任务,也不调用下方仅限受管任务的命令。
44
+
41
45
  ## 云端关联本地 Agent 的业务澄清
42
46
 
43
47
  只有当前工作区 `AGENTS.md` 明确声明这是 OpenYida managed local-agent Run 时,才可使用
@@ -40,7 +40,7 @@ Fast / Plan 确定主题后,Step 3 的应用主题同步和 Step 7 的页面
40
40
 
41
41
  千问办公按 [模式路由](../yida-design/references/design-mode.md) 判断 Fast / Plan 及是否 `ask_human`,不依据跨会话记忆或历史偏好代选。
42
42
 
43
- 需求确认不能替代当前 Plan revision 的批准或工具权限确认。`intake.designMode` 沿用用户最后一次明确选择,其他问题的回答只更新对应字段。Plan 必须实际调用 `ask_human` 或宿主允许的等价结构化工具,收到该次交互与当前 revision 匹配的 `confirm_build` 后进入资源实施;普通文字询问、展示文件或手写 confirmed 状态不能替代确认。无可用工具时停在待确认,不切换 Fast;同版有效确认复用,选择 `continue_editing` 时修改当前计划,生成新 revision 后再确认。素材进度更新不改变已有的需求确认和模式选择。
43
+ 需求确认不能替代当前 Plan revision 的批准或工具权限确认。`intake.designMode` 沿用用户最后一次明确选择,其他问题的回答只更新对应字段。Plan 必须实际调用 `ask_human` 或宿主允许的等价结构化工具;千问办公客户端可用 `AskUserQuestion`,先展示不可变方案,再由 Agent 记录版本、快照摘要和真实问答关联,工具无需 attachments/revision 参数,详见 [Plan 交付](workflow/plan/step-4-deliver.md)。收到该次交互与当前 revision、快照内容匹配的 `confirm_build` 后继续 CLI 资源实施;普通文字询问、展示文件或手写 confirmed 状态不能替代确认。无可用工具时停在待确认,不切换 Fast,不转浏览器找入口或另建网页任务;同版有效确认复用,选择 `continue_editing` 时修改当前计划,生成新 revision 后再确认。素材进度更新不改变已有的需求确认和模式选择。
44
44
 
45
45
  Plan 规划阶段的工作流入口只读取 `workflow/step-1-resource-context.md`、`workflow/step-2-design.md` 和精确路径 `workflow/plan/workflow.md`;后者已经包含完整 Plan 入口。禁止用 Glob 查找 Plan 文件,也不要额外读取 `workflow/plan/step-1-understand.md` 或 `workflow/plan/step-2-confirm.md`。此读取范围不限制确认后的实施、验收和交付,各阶段按需读取对应 workflow。Plan 确认恢复后,若 `explicitScope.allowInferredResources=false`,直接读取 `workflow/step-4-forms-processes.md` 实施范围内资源,不再重读 Step 1、调用 list-forms 或做应用设置预检。
46
46
 
@@ -35,10 +35,10 @@ HTML 四章与视觉展示遵守 [HTML 内容契约](../../../yida-design/sub_sk
35
35
  按 [用户交互契约](../../../yida-design/references/ask-human-interaction-contract.md) 执行:
36
36
 
37
37
  1. 展示“当前方案”和 3–7 条业务摘要;导航归属随整体确认,不另设技术选型题。
38
- 2. 云端实际调用 `ask_human` 创建结构化提问;managed Local 使用下述 CLI 封装。遵守交互契约的唯一 payload schema,绑定当前快照与 revision,选项为 `confirm_build` 和 `continue_editing`。调用成功只表示问题已创建,收到匹配回答后才获批。
39
- 优先原样传入本次 materialize 或 patch --materialize 返回的 `confirmation`;同级 `confirmationPolicy` 是执行规则,不放入工具 payload。不要用 `fields` 包装最终选择,也不自行拼接附件路径。生成 JSON、打开 HTML、文字问“是否执行”均不等于实际调用。工具不可用或失败时保留 `awaiting_confirmation`,说明阻塞,不能直接开始搭建或切换 Fast。
38
+ 2. 云端实际调用 `ask_human` 创建结构化提问;千问办公客户端直接使用 `AskUserQuestion`,仅已核实的 managed Local 使用下述 CLI 封装。按实际工具 schema 绑定当前快照与 revision,选项为 `confirm_build` 和 `continue_editing`。调用成功只表示问题已创建,收到匹配回答后才获批。
39
+ 支持附件与版本的工具原样使用 `confirmation`;千问办公客户端按交互契约的“客户端问答确认”路径,先在成果中展示 `outputs.confirmationHtml`,记录 revision、快照 SHA-256 和展示证据,再调用 `confirmationAdapters.AskUserQuestion.input`。`context` 写入 `meta.planState.confirmationContext`,不传给工具;工具无需新增 attachments/revision 参数。`confirmationPolicy` 是执行规则,不放入工具 payload。不要用 `fields` 包装最终选择,也不自行拼接附件路径。生成 JSON、打开 HTML、文字问“是否执行”均不等于实际调用。先核对宿主原生问答能力,不能仅凭 MCP 搜索为空判定不可用。工具不可用或失败时保留 `awaiting_confirmation`,说明阻塞,不能直接开始搭建或切换 Fast;不打开浏览器寻找确认入口,不另建网页搭建任务。
40
40
 
41
- 3. 交互创建成功后写回 `meta.planState.presentedRevision=meta.revision`,不重复物化;queued/pending 仅表示等待。收到该次交互的 `confirm_build` 且回传 revision 匹配当前方案,才记录真实交互 ID、回答和时间,设置 `meta.status=confirmed`、`meta.planState.planConfirmed=true`、`meta.revision=presentedRevision=confirmedRevision`。无回答、超时、取消、旧版本回调和自行写入的状态都不能授权实施。
41
+ 3. 交互创建成功后写回 `meta.planState.presentedRevision=meta.revision`,不重复物化;queued/pending 仅表示等待。收到该次交互的 `confirm_build`(客户端按 context.answerMap 映射真实选项)且回传或 Agent 关联的 revision 匹配当前方案、快照内容未变,才记录真实交互 ID、回答和时间,设置 `meta.status=confirmed`、`meta.planState.planConfirmed=true`、`meta.revision=presentedRevision=confirmedRevision`。元数据直接写回源 JSON,不通过受保护字段的 patch --set;确认后返回 yida-app 继续 CLI 创建与配置。无回答、超时、取消、旧版本回调和自行写入的状态都不能授权实施。
42
42
 
43
43
  恢复时核验真实问答与当前方案,同版已有效确认则复用。主题、需求确认和泛指“继续”均不替代执行批准。获批后派发 `assetTasks` 并实施;`explicitScope.allowInferredResources=false` 仅执行范围内资源。
44
44
 
@@ -46,7 +46,7 @@
46
46
 
47
47
  需要集中预检时,执行 init 返回的 `materialize.checkCommand`。已有 `--check` 会聚合字段、菜单、素材结构和字面主色不一致等独立问题,返回 `details.issues`,不写方案产物,也不返回确认附件。按每项路径修正源文件后正式生成;变量引用、复杂资源关系和后续渲染仍执行原有完整校验。预检不计入首版正式生成次数。
48
48
  8. **生成首版产物。** 直接执行 init 返回的 `materialize.command`。成功后进入展示步骤;`maxSuccessfulCalls: 1` 表示首版成功后不重复物化。失败按 `repairPolicy` 修复,不能重复提交未修改的输入,具体停止条件见[本地校验修复](../../../../references/source-repair.md)。标准首版不先试 `--from-preview`、`preview`、`--check` 或无参数 materialize。
49
- 9. **实际提问并等待。** 按返回的 `confirmationPolicy` 和 [Plan 交付](step-4-deliver.md) 实际调用 `ask_human`,传入 `confirmation`;managed Local 用 `agent ask-human` 封装。生成成功不代表用户同意。只有当前交互与 revision 匹配的 `confirm_build` 才能实施;queued/pending 时等待,无工具或失败时保留待确认,不能用普通对话、文件链接或状态标记代替。已有同版有效确认直接复用。
49
+ 9. **实际提问并等待。** 按返回的 `confirmationPolicy` 和 [Plan 交付](step-4-deliver.md) 使用宿主实际问答工具;千问办公客户端展示不可变方案后调用 `confirmationAdapters.AskUserQuestion.input`,由 Agent 记录快照、版本与真实问答的关联,工具无需 attachments/revision 参数。支持附件与版本的工具使用 `confirmation`;仅已核实的 managed Local 用 `agent ask-human` 封装。生成成功不代表用户同意。只有当前交互与 revision、快照内容匹配的 `confirm_build` 才能返回 yida-app 继续 CLI 搭建;queued/pending 时等待,无工具或失败时保留待确认,不能用普通对话、文件链接或状态标记代替。已有同版有效确认直接复用。不转浏览器找入口,不另建网页搭建任务。
50
50
 
51
51
  超大需求需要展示中间进展或用户明确要求边生成边查看时,使用[按模块更新方案](../incremental-preview.md)。普通首版按上述步骤完成,不逐模块预览和重复渲染。
52
52
 
@@ -116,9 +116,9 @@ Fast / Plan 是面向用户的模式名称,仅在首轮澄清后的模式路
116
116
 
117
117
  技能文档使用 `ask_human` 表示“向用户提问并等待回答”的逻辑动作。所有环境都用它收集风格选择;只有用户明确要求时才按[预览规则](theme-selection.md#选择时展示名称与效果图)展示卡片或图文,预览不提交答案。按[交互顺序](theme-selection.md#交互顺序)将已准备好的风格题与当前必要问题合并到同一次问答,同一任务最多一个待答交互:
118
118
 
119
- 1. 使用当前宿主实际可用、当前模式允许的结构化工具;同步工具受限时优先使用可用且允许的异步工具。不能因为工具存在就调用模式禁止的能力。
119
+ 1. 使用当前宿主实际可用、当前模式允许的结构化工具;千问办公客户端可直接使用 `AskUserQuestion`,其他宿主使用其等价工具,同步工具受限时优先使用允许的异步工具。先检查宿主原生工具;MCP 搜索不到名为 `ask_human` 的工具不代表没有问答能力。不能因为工具存在就调用模式禁止的能力。
120
120
  2. 一般需求澄清在无可用工具或工具失败时可按宿主规则在对话中补问;**方案执行确认不适用此降级**:必须实际调用 `ask_human` 或宿主允许的等价结构化工具。工具不可用或失败时保留 `awaiting_confirmation` 并说明阻塞,不用普通文字代替、不切换 Fast、不创建/更新/发布业务资源。
121
- 3. 工具名称与参数以实际 schema 为准。下面的逻辑字段用于表达意图,不强行传入宿主不支持的字段;多选能力不存在时使用用途清楚的功能组合或自由输入,不伪造 multi_choice。
121
+ 3. 工具名称与参数以实际 schema 为准。下面的逻辑字段用于表达意图,不强行传入宿主不支持的字段;缺少 `attachments` 或 `revision` 参数时按下方客户端确认路径关联方案,不将其判为工具不可用。多选能力不存在时使用用途清楚的功能组合或自由输入,不伪造 multi_choice。
122
122
  4. 异步返回、默认勾选、未回复和超时都不是答案。收到有效回答后才写回对应业务字段;用户委托时保留依据,AI 决定不记成用户选择。
123
123
  5. 一题一个决定,同一次调用可包含多个独立问题。风格候选已准备好时与需求、模式题同轮提交;只因真实答案依赖或宿主限制拆分,不机械追加风格轮次。工具已有自由输入时不另设“其他”,不为问题数量限制合并模式、功能、风格等无关决定。首轮通常 1–3 题,删去低价值扩展,不机械拆轮。
124
124
 
@@ -151,14 +151,14 @@ Fast / Plan 是面向用户的模式名称,仅在首轮澄清后的模式路
151
151
 
152
152
  下面的附件与版本约束用于搭建、美化方案等执行审批。用户主动索取的风格效果参考不属于执行审批,可先独立展示,再沿用同一轮风格问题收集选择。
153
153
 
154
- 需要让用户查看待批准的 workspace 产物后再回答时,同一次 `ask_human` 还必须携带:
154
+ 宿主支持附件和版本参数时,在同一次 `ask_human` 中携带:
155
155
 
156
156
  - `attachments`:待查看文件列表;workspace 文件使用 `{ "name": "搭建方案", "path": "prd/<项目名>/build-plan-<content-sha256>.html" }`。路径必须位于当前项目工作区,不能传运行时内部路径或外部绝对路径。
157
157
  - `revision`:本次问题绑定的事实版本。宿主提交回答时必须原样回传;版本已变化时拒绝旧回答并重新展示最新版本。
158
158
 
159
- 附件、问题与 `revision` 是一个原子交互。不得先发普通文本附件、再单独调用 `ask_human`,也不得只在问题文案中写文件路径;否则实时界面和历史回放无法可靠证明用户确认的是哪一版方案。
159
+ 这条路径中附件、问题与 `revision` 是一个原子交互。普通客户端使用下方“客户端问答确认”路径,由 Agent 将方案快照、版本与真实问答关联;无需为此扩展宿主工具参数。
160
160
 
161
- 已有资源美化使用 [ui-improve](../sub_skill/ui-improve/SKILL.md) 的视觉方案和验收流程,不使用下文首次搭建的固定两选项 payload。宿主缺少附件或 revision 能力时,仅按该流程的降级契约在同次问题提供不可变方案链接,并保存真实交互与版本关联;不得伪造附件、回答或版本字段,未取得明确同意不得写入。首次搭建的原子附件契约保持不变。
161
+ 已有资源美化使用 [ui-improve](../sub_skill/ui-improve/SKILL.md) 的视觉方案和验收流程,不使用下文首次搭建的固定两选项 payload。其缺少附件或 revision 能力时的处理仍按该流程执行,不得伪造附件、回答或版本字段,未取得明确同意不得写入。
162
162
 
163
163
  ## 首次搭建确认
164
164
 
@@ -173,15 +173,15 @@ Fast / Plan 是面向用户的模式名称,仅在首轮澄清后的模式路
173
173
  Plan Design 完成当前版本后必须实际发起结构化确认;明确风格、关闭主题预览、需求已确认均不免除方案确认。生成 HTML、展示链接、输出确认文案或 JSON、手写 confirmed 字段都不是调用证据。异步 queued/pending 后等待真实回答,不启动实施任务;仅已有同版有效确认时复用。按以下顺序执行:
174
174
 
175
175
  1. 在会话中使用“搭建方案”或“当前方案”,给出 3-7 条业务摘要。用户可见的 PRD / HTML 标题、摘要、附件名称和确认问题都不展示修订序号或原始 `meta.revision`;修订标识仅保留在内部元数据和确认字段中。
176
- 2. 在“最新搭建计划确认”的同一次 `ask_human` 中,通过 `attachments` 原样使用 CLI 返回的 `confirmation.attachments` 展示可打开的内容快照,并以 `revision` 绑定当前 `meta.revision`。
176
+ 2. 按实际工具能力选择确认路径:支持附件与版本时,在同一次 `ask_human` 中原样使用 `confirmation.attachments` 和 `revision`;千问办公客户端使用下方 `AskUserQuestion` 路径展示同一快照并记录关联。已有明确的搭建授权时只确认当前方案,不重问需求或平台选择。
177
177
  3. 结构化交互成功创建后将 `meta.planState.presentedRevision=meta.revision` 写回源 JSON,不再物化;awaiting_confirmation 在生成前写入。
178
178
  4. 提供“确认并开始搭建”和“继续调整”两个选择,并等待用户回答。
179
179
 
180
180
  `build-plan.html` 是可更新的编辑产物;确认附件必须使用 `materialize` 或 `patch --materialize` 返回的 `confirmation.attachments`(路径等于 `outputs.confirmationHtml`),不能自行拼接 canonical 路径或覆盖快照。快照包含最终合并后的 HTML,本地补充和素材变化也会产生新内容地址。HTML 不承载对话控件或确认按钮;用户在会话中完成确认。
181
181
 
182
- managed Local Agent 通过 `openyida agent ask-human` 提问时,必须将下方云端 payload 封装为本地 CLI 问题文件:`title/revision/attachments` 保留在顶层,`question/options` 放入 `questions` 数组中的一个 `single_select` 问题,并提供 `id: "plan_decision"`、`header`。问题文件不携带 `submitLabel`;完整示例见 [Plan 交付](../../yida-app/workflow/plan/step-4-deliver.md) 或 `openyida agent ask-human --help`。
182
+ 只有工作区明确声明为宜搭发起的 managed Local Run 时,才通过 `openyida agent ask-human` 提问:将下方云端 payload 封装为本地 CLI 问题文件,`title/revision/attachments` 保留在顶层,`question/options` 放入 `questions` 数组中的一个 `single_select` 问题,并提供 `id: "plan_decision"`、`header`。问题文件不携带 `submitLabel`;完整示例见 [Plan 交付](../../yida-app/workflow/plan/step-4-deliver.md) 或 `openyida agent ask-human --help`。普通千问办公客户端不调用该命令,不打开浏览器寻找确认入口或另建网页搭建任务。
183
183
 
184
- 最终确认是一个 `single_select` 语义问题。它只有下面这一份可调用 schema;顶层字段集合固定为 `question`、`title`、`options`、`attachments`、`revision`、`submitLabel`。将路径和 `{revision}` 替换为本次 materialize 返回的真实值:
184
+ 最终确认是一个 `single_select` 语义问题。下列 schema 用于支持附件与版本的工具,顶层字段集合固定为 `question`、`title`、`options`、`attachments`、`revision`、`submitLabel`。其他宿主按其实际 schema 调用,不照搬这些字段。将路径和 `{revision}` 替换为本次 materialize 返回的真实值:
185
185
 
186
186
  #### 最终确认 `ask_human` payload
187
187
 
@@ -214,6 +214,34 @@ managed Local Agent 通过 `openyida agent ask-human` 提问时,必须将下
214
214
 
215
215
  `options` 固定为 `confirm_build`、`continue_editing` 两项。最终确认只收集当前 revision 的去向;调整内容在下一次交互中收集。内部交互身份使用 `plan_confirm_r{revision}`,回答写入 `meta.planState`。
216
216
 
217
+ ### 客户端问答确认
218
+
219
+ 千问办公客户端已有 `AskUserQuestion` 时直接使用,不需要名为 `ask_human` 的 MCP 工具。`materialize` 与 `patch --materialize` 返回 `confirmationAdapters.AskUserQuestion`,其中只有 `input` 是工具参数,`context` 是 Agent 保存的版本关联,不传给工具。
220
+
221
+ 1. 通过当前会话的成果展示能力展示 `outputs.confirmationHtml` 的不可变快照,附 3–7 条业务摘要,并确认用户可打开该文件。只展示编辑稿、路径字符串或未成功展示的链接不能进入确认;没有成果工具时可使用宿主支持的可打开 workspace 附件或链接,不为确认启动浏览器。
222
+ 2. 读取当前 `meta.revision` 与快照内容,计算 SHA-256;将 `context`、`snapshotSha256` 和展示记录保存到 `meta.planState.confirmationContext`。同一任务只保留一个待答问题,待答期间不改方案。
223
+ 3. 实际调用 `AskUserQuestion`,只传 `confirmationAdapters.AskUserQuestion.input`。它的参数形状如下;其他等价工具按其 schema 适配:
224
+
225
+ ```json
226
+ {
227
+ "questions": [{
228
+ "question": "请确认当前搭建方案",
229
+ "header": "搭建方案",
230
+ "options": [
231
+ {"label": "确认并开始搭建", "description": "按当前方案创建应用、表单、流程和页面。"},
232
+ {"label": "继续调整", "description": "继续完善当前方案,确认后再开始搭建。"}
233
+ ],
234
+ "multiSelect": false
235
+ }]
236
+ }
237
+ ```
238
+
239
+ 4. 将真实工具调用 ID 写入 `confirmationInteractionId`,将 `presentedRevision=meta.revision` 写回源 JSON。工具支持异步时保存真实请求 ID 并等待;不自行编造 ID 或把 queued 当回答。
240
+ 5. 收到该次交互的答案后,按保存的 `answerMap` 将选项 label 映射为 `confirm_build` 或 `continue_editing`;不将任意自由输入、用户未回答、取消或超时推断为批准。核对回答属于记录的问题,再重新读取当前方案、版本和快照:`meta.revision` 必须等于记录版本,快照路径及 SHA-256 必须保持一致。不能只检查文件名,也不把当前版本补写到旧回答上。
241
+ 6. 匹配的 `confirm_build` 才按下方状态规则记录批准,在 `confirmationContext` 保存真实答案与展示、问答证据,并回到 `yida-app` 继续通过 CLI 搭建;不重新初始化方案或改用 Fast。`continue_editing` 只进入下一次交互修改方案。内容变化、旧版或无法恢复关联时保持待确认,展示最新方案后重新提问。
242
+
243
+ 宿主无需回传 `revision`:版本由 Agent 记录并核对。找不到任何允许的结构化问答工具、展示失败或调用失败时才报告具体阻塞,保留产物;不转浏览器寻找入口、不要求用户到网页新建任务。
244
+
217
245
  ## 版本与确认状态
218
246
 
219
247
  `build-plan.json` 使用 `meta.revision`、`meta.status` 和 `meta.planState` 共同记录当前计划状态:
@@ -237,7 +265,7 @@ managed Local Agent 通过 `openyida agent ask-human` 提问时,必须将下
237
265
  1. 首次生成计划时创建 `meta.revision`,设置 `meta.status=draft`、`meta.planState.planConfirmed=false`。
238
266
  2. 业务方案或视觉方案变化时生成新的 `meta.revision`,并清空旧确认信息。素材采集后的进度同步保留版本与已有确认,直接继续搭建。
239
267
  3. 计划展示成功后向源 JSON 写回 `meta.status=awaiting_confirmation` 和 `presentedRevision=meta.revision`。
240
- 4. 用户在最终确认交互中选择 `confirm_build`(确认并开始搭建)且回传 revision 等于展示 revision 时,设置 `meta.status=confirmed`、`planConfirmed=true`、`confirmedRevision=meta.revision`,同时记录交互 ID 和确认时间。
268
+ 4. 用户在最终确认交互中选择 `confirm_build`(确认并开始搭建),且工具回传或 Agent 关联核验的 revision 等于展示 revision、当前快照内容未变时,设置 `meta.status=confirmed`、`planConfirmed=true`、`confirmedRevision=meta.revision`,同时记录真实交互 ID、答案和确认时间。客户端还保留 `confirmationContext` 的快照、摘要、展示与问答证据。元数据写回源 JSON,不使用受保护字段的 `patch --set`,不重新 materialize 产生另一份待确认产物。
241
269
  5. 只有 `meta.status=confirmed`、`planConfirmed=true` 且 `meta.revision=presentedRevision=confirmedRevision` 时,Plan Design 才能返回 `yida-app` Step 3。
242
270
  6. 用户选择“继续调整”时保持在 Plan Design,本轮不创建应用资源;下一轮单独收集调整内容,生成新 revision 并重新确认。用户取消或关闭交互时停止执行,不创建应用资源。
243
271