Files
agent_admin/docs/agent/values-and-outputs.md

103 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 值与步骤输出
> [返回文档中心](README.md) · [任务协议](protocol.md)
## 1. 当前行为 **[已实现]**
- INPUT 的 `value` 是步骤内字符串。
- EXTRACT_TEXT 把文本追加到 `outputField`。
- 最终结果中的 `extracted` 类型是 `Map<String, List<String>>`。
- 当前没有任务输入区、跨步骤引用或类型化输出。
## 2. 任务输入 **[提案]**
变化频繁的值可以集中放在任务 `inputs`:
~~~json
{
"inputs": {
"keyword": "测试内容",
"quantity": 2
}
}
~~~
首版只支持 `TEXT`、`INTEGER`、`DECIMAL` 和 `BOOLEAN`。手机号、邮编和外部编号等需要保留格式的值使用 TEXT。
## 3. 值引用 **[提案]**
字面量:
~~~json
{
"value": {
"source": "LITERAL",
"value": "固定内容"
}
}
~~~
任务输入:
~~~json
{
"value": {
"source": "TASK_INPUT",
"key": "keyword"
}
}
~~~
步骤输出:
~~~json
{
"value": {
"source": "STEP_OUTPUT",
"stepId": "read-code",
"field": "code"
}
}
~~~
首版不提供模板语言或表达式执行。引用不存在时返回 `VALUE_NOT_FOUND`。
## 4. 步骤输出 **[提案]**
~~~json
{
"output": {
"code": {
"type": "TEXT",
"value": "A-100"
}
}
}
~~~
一个步骤可以输出多个命名值,但只有整个步骤成功时输出才生效。后续步骤只能引用已经完成的前置步骤。
复杂对象、列表合并和跨分支数据流等到实际需要时再设计。
## 5. 建议模型
~~~kotlin
enum class ValueType {
TEXT,
INTEGER,
DECIMAL,
BOOLEAN,
}
data class StepValue(
val type: ValueType,
val value: Any,
)
data class StepOutput(
val values: Map<String, StepValue>,
)
~~~
输入约束先支持必要的长度、数值范围和枚举即可,不提前加入复杂格式系统。