84 lines
2.2 KiB
Markdown
84 lines
2.2 KiB
Markdown
# MEMORY.md — 套件开发者长期记忆
|
||
|
||
## 平台关键信息
|
||
|
||
- **套件市场:** https://suites.mercator.cn(浏览和发现套件)
|
||
- **API 基础地址:** https://suites.mercator.cn
|
||
- **认证中心:** https://auth.mercator.cn(获取 API Key)
|
||
- **基础镜像:** `registry.mercator.cn/agentgis/gis-base:latest`
|
||
- **API 文档:** https://suites.mercator.cn/docs
|
||
|
||
## Workflow.yaml 核心规则
|
||
|
||
### 步骤定义
|
||
|
||
```yaml
|
||
steps:
|
||
- id: my-step # 步骤 ID
|
||
name: 我的步骤 # 步骤名称
|
||
script_id: run # ✅ 正确:script_id: run
|
||
# ❌ 错误:script: run.py
|
||
params:
|
||
input_path: "${{inputs.input_path}}" # ✅ 双花括号
|
||
# ❌ $inputs.input_path
|
||
```
|
||
|
||
### 参数引用
|
||
|
||
| 语法 | 说明 |
|
||
|------|------|
|
||
| `${{inputs.xxx}}` | 引用套件输入参数 |
|
||
| `${{steps.step_id.output_key}}` | 引用前序步骤的输出 |
|
||
|
||
### resovled_params
|
||
|
||
必须在 `resolved_params` 中提供参数默认值:
|
||
|
||
```yaml
|
||
resolved_params:
|
||
- step_index: 0
|
||
step_name: 我的步骤
|
||
params:
|
||
input_path: "/data/input.shp"
|
||
```
|
||
|
||
### 文件共享
|
||
|
||
所有 steps 共享 `/tmp/output` 目录。Step 1 写入的文件 Step 2 可以直接读取。
|
||
每个步骤也有独立的 `/tmp/step_output` 目录。
|
||
|
||
### 输出规范
|
||
|
||
脚本通过 stdout 输出 JSON,格式如下:
|
||
|
||
```python
|
||
result = {"status": "ok", "output_path": "/tmp/output/result.geojson"}
|
||
print(json.dumps(result))
|
||
```
|
||
|
||
## 执行环境
|
||
|
||
- 每个任务跑在独立 Docker 容器中,用完即销毁
|
||
- 容器使用 gis-base 镜像(含 GDAL / Shapely / GeoPandas)
|
||
- 脚本目录挂载到 `/tmp/scripts`(只读)
|
||
- 工作目录挂载到 `/tmp/output`(读写,步骤间共享)
|
||
- 参数通过 `/tmp/params.json` 文件传入
|
||
|
||
## 发布流程
|
||
|
||
推荐使用 `agc publish` 一键发布。内部流程:
|
||
1. 打包 workflow.yaml + scripts/ 为 tar.gz
|
||
2. 上传到平台包存储
|
||
3. 注册 Skill(可供执行)
|
||
4. (可选)注册 Suite(在市场中展示)
|
||
|
||
## 合规检测
|
||
|
||
发布时会自动检测:
|
||
- workflow.yaml 格式是否正确
|
||
- 引用的脚本是否存在
|
||
- 参数类型是否匹配
|
||
- 是否有循环依赖
|
||
|
||
不通过则发布失败,返回具体错误信息。
|