zai-org / zai-org/feedback

[建议 / Feature] app-server 协议支持结构化输出(JSON schema 强制)

Open
#485 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: P2
Dominant language
No language data
Stars
22
Forks
1
PR merge metrics
No merged PRs in 30d

Description

问题类别 · Category

其他 / 不确定 · Other / Not sure(app-server 编程协议层)

涉及的 Agent 框架 · Agent framework

不涉及框架 · Not framework-specific(外部程序通过 app-server 无头驱动 ZCode)

使用场景 · Use case

我通过 ZCode 的 app-server 协议(无头模式,JSON-RPC over stdio)驱动外部智能体编排器——编排器给 ZCode 会话发任务,要求最终回复是符合预定义 JSON schema 的结构化对象(评审裁决、计划输出等机器可读产物)。

现状问题:app-server 协议没有输出格式控制能力——

  • `session/create` 与 `session/send` 的参数都是消息投递类字段(content / attachments / model / effort 等),没有 responseFormat / outputSchema 类参数;
  • 只能靠提示词约束("最终输出必须恰好是一个 JSON 对象"),高推理努力下模型经常输出 markdown 报告而非裸 JSON,导致解析失败、重试耗尽(实测 GLM-5.3 高努力下连续三次输出散文报告)。

ZCode 内部其实已有这个能力:AI SDK 层存在 `responseFormat`(type: "json" + schema)和 `structuredOutputMode`(outputFormat / jsonTool / auto)——只是没有通过 app-server 协议暴露给外部调用者。

建议方案 · Proposal

在 app-server 协议层(`session/send` 或等价的 turn 级参数)暴露结构化输出控制,例如接受 `responseFormat: { type: "json", schema: {...} }`,由现有内部能力强制执行。

环境
  • ZCode 0.16.5(macOS,应用包内 zcode.cjs)
  • 外部驱动方:Roc(开源智能体编排器,github.com/devos-ing/Roc)的 zcode 后端适配器
补充

如已在路线图上,麻烦告知预期;需要更详细的协议调用样例(我们有无头驱动的完整工作链路)随时可以提供。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the app-server session/create and session/send protocol definitions and their turn handling. Compare those entry points with the existing AI SDK responseFormat and structuredOutputMode capabilities mentioned in the issue. Done means external callers can provide a JSON schema through the protocol and receive schema-constrained structured output.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.