📝 docs(tsl): align agent-facing guidance

This commit is contained in:
csh
2026-05-28 19:12:34 +08:00
parent c48354e0cb
commit d8eb418277
63 changed files with 1921 additions and 371 deletions
+49
View File
@@ -0,0 +1,49 @@
# Verified Core Reference Functions
文档类型:agent 参数事实表
是否可直接用于生成代码:是
遇到不确定时跳转到:[../catalog/index.md](../catalog/index.md)、[../../syntax/index.md](../../syntax/index.md)
本页只保留 agent 生成代码需要的函数事实:签名、接收类型、返回值和调用约束。
## 使用规则
- 只按“接收类型”传参。
- TSL 是弱类型语言,但函数参数不是任意类型。
- catalog 同名函数没有出现在 verified 页时,不要当作可调用事实。
## 函数参数
### `Abs(value)`
用途:返回数值绝对值。
| 参数 | 接收类型 | 返回 | 说明 |
| ------- | -------- | ---- | ---------- |
| `value` | 整数 | 数值 | 返回绝对值 |
| `value` | 实数 | 数值 | 返回绝对值 |
### `ifInt(value)`
用途:判断值当前是否按整数处理,返回 `1``0`
| 参数 | 接收类型 | 返回 | 说明 |
| ------- | --------------------------------------- | ---- | ---------------------- |
| `value` | 任意值;已记录整数、实数、字符串、`nil` | 整数 | 整数返回 `1`,否则 `0` |
### `DateToStr(value)`
用途:把日期时间值转成日期字符串。
| 参数 | 接收类型 | 返回 | 说明 |
| ------- | -------- | ------ | ------------------------------ |
| `value` | 日期时间 | 字符串 | 日期时间字面量可写 `20111231T` |
### `Length(value)`
用途:返回字符串或数组长度。
| 参数 | 接收类型 | 返回 | 说明 |
| ------- | -------- | ---- | ------------ |
| `value` | 字符串 | 整数 | 返回字符长度 |
| `value` | 数组 | 整数 | 返回元素个数 |
+19
View File
@@ -0,0 +1,19 @@
# Verified Reference Functions
文档类型:agent 参数事实索引
是否可直接用于生成代码:否
遇到不确定时跳转到:[../catalog/index.md](../catalog/index.md)、[../../syntax/index.md](../../syntax/index.md)
本页只负责定位已经整理成参数事实表的函数页。生成调用代码时,进入具体函数页读取签名、接收类型、返回值和调用约束。
## 使用规则
- 只从具体函数页读取接收类型和返回值。
- catalog 里的候选名没有出现在具体函数页时,不要当作可调用事实。
- 不根据函数名猜参数。
## 参数事实页
| 范围 | 页面 | 当前函数 |
| -------- | ------------------ | ------------------------------------- |
| 核心函数 | [core.md](core.md) | `Abs``ifInt``DateToStr``Length` |