@xtalpi/agentic-lab-skills 0.0.1
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.
- package/README.md +1 -0
- package/package.json +14 -0
- package/skills/lab-flow-designer/SKILL.md +360 -0
- package/skills/lab-flow-designer/embedded-template/SKILL.md +84 -0
- package/skills/lab-flow-designer/embedded-template/pools//345/205/245/345/217/243/346/261/240.md +12 -0
- package/skills/lab-flow-designer/embedded-template/pools//345/207/272/345/217/243/346/261/240.md +12 -0
- package/skills/lab-flow-designer/embedded-template/scripts//347/244/272/344/276/213/346/225/260/346/215/256/344/270/216/346/240/241/351/252/214/351/227/250/346/216/247.js +149 -0
- package/skills/lab-flow-designer/embedded-template/valves//347/244/272/344/276/213/346/225/260/346/215/256/344/270/216/346/240/241/351/252/214/351/227/250/346/216/247.md +100 -0
- package/skills/lab-flow-designer/references/agentic-lab-processer.md +101 -0
- package/skills/lab-flow-designer/references/agentic-lab-sdk.md +440 -0
- package/skills/lab-flow-designer/references/rhea-api/README.md +7 -0
- package/skills/lab-flow-designer/references/rhea-api/execute_process_batch.md +58 -0
- package/skills/lab-flow-designer/references/skill-package-layout.md +199 -0
- package/skills/lab-flow-designer/references//344/270/232/345/212/241/346/265/201/347/250/213/346/226/207/346/241/243/346/240/207/345/207/206.md +208 -0
- package/skills/lab-orbit-component-builder/SKILL.md +305 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/.env.local.example +27 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/.eslintignore +7 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/.eslintrc.cjs +88 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/.nvmrc +1 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/AgenticAppAPI.md +268 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/Jenkinsfile +106 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/OrbitAPI.md +453 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/README.md +176 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/public/index.html +12 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/App.vue +151 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/components/DevOpenerLauncher.vue +143 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/global.d.ts +74 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/main.ts +305 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/mockXNBBitable.ts +119 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/shims-vue.d.ts +6 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/dev/src/utils/devOpenerHost.ts +75 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/index.html +13 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/package.json +57 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/api/agenticlabTickets.ts +110 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/entries/bitable.ts +4 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/entries/custom-page.ts +4 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/index.ts +1 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/styles/orbit-quasar-host.scss +19 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/types/context.ts +15 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/types/xnb-context.ts +70 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/use/useBitablePage.ts +180 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/use/useSuperCellDemo.ts +257 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/use/useSuperTableBitableLifecycle.ts +547 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/openerInitParams.ts +158 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/openerTicketIds.ts +32 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/orbitHttpClient.ts +110 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/utils/request.ts +92 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/views/bitable.vue +65 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/src/views/custom-page.vue +140 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/tsconfig.json +48 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/vite.config.ts +165 -0
- package/skills/lab-orbit-component-builder/examples/xnb-component-template/vite.dev.config.ts +51 -0
- package/skills/lab-orbit-component-builder/references/flow-document-human-ui.md +65 -0
- package/skills/lab-orbit-component-builder/references/pool-schema-to-columns.md +67 -0
- package/skills/lab-orbit-component-builder/references/vue-template-checklist.md +113 -0
- package/skills/lab-orbit-component-builder/references/xnb-context-vue-props.md +49 -0
- package/skills/lab-orbit-component-builder/references/xnbitable-vue-parity.md +32 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# 页面内调用 AgentLab / AgenticLab App 接口说明
|
|
2
|
+
|
|
3
|
+
本文档描述在 **AgentLab / AgenticLab APP 前端页面**(含嵌入 Orbit Book / 独立 Cell 页等)中调用后端 HTTP 的约定。
|
|
4
|
+
|
|
5
|
+
- **Base URL**:本地与 CI 通过 **`VITE_AGENTICLAB_API_URL`** 配置(见 `.env.local.example`);嵌入 Orbit 时优先走 **`window.xnb.http.client.request`**(见 **`OrbitAPI.md`** 与 `src/utils/orbitHttpClient.ts`),与 Book 代理、鉴权一致。
|
|
6
|
+
- **鉴权**:Orbit 内用 **`await window.xnb.choreo.getUserToken()`**(无参;与本仓库 `agenticlabTickets` 一致);本地可用 **`VITE_DEV_TOKEN`**(勿提交生产密钥)。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 与 opener 初始化联动(`ticket_ids` → `ticket_id__in`)
|
|
11
|
+
|
|
12
|
+
1. 页面挂载后调用 `fetchOpenerInitPayload`(见 `src/utils/openerInitParams.ts`),子页发送 `{ msg: 'get-data', trace }`;**流程页宿主**应回复 `{ msg: 'get-data-response', trace, ticket_ids, valve_id, ... }`(字段平铺在根上)。兼容 `{ msg: 'data', trace, payload }`。
|
|
13
|
+
2. 规范化后的 **`payload`** 中须能解析出 **`ticket_ids`**:`string[]` 或逗号分隔的 `string`(与列表项 `detail.ticket_id` 一致)。**`valve_id`**(`number`)供 **`POST /api/execution/complete`**;亦可使用 **`VITE_AGENTICLAB_VALVE_ID`**,缺省为 `0`。
|
|
14
|
+
3. 超级表格示例在拉表数据时:若已配置 `VITE_AGENTICLAB_API_URL` 且 `ticket_ids` 非空,会在 **`bootstrap` / `refreshTable`** 内请求 `GET /api/ticket/list`,并把 **`ticket_ids` 拼为 query 参数 `ticket_id__in`**(逗号分隔),将返回的 `data.list` 映射为表格行。
|
|
15
|
+
4. 解析工具:`src/utils/openerTicketIds.ts` → `extractTicketIdsFromPayload`;请求实现见 `src/api/agenticlabTickets.ts`(优先 **`orbitRequestJson`**,见 **`OrbitAPI.md`**)。
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 通用响应包络
|
|
20
|
+
|
|
21
|
+
| 字段 | 类型 | 说明 |
|
|
22
|
+
|------|------|------|
|
|
23
|
+
| `code` | number | 业务状态码,成功常见为 `200` |
|
|
24
|
+
| `msg` | string | 提示信息,成功时可为空字符串 |
|
|
25
|
+
| `data` | object | 载荷;列表接口内含 `list` 与 `total` 等 |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 查询工单列表
|
|
30
|
+
|
|
31
|
+
### 基本信息
|
|
32
|
+
|
|
33
|
+
| 项目 | 值 |
|
|
34
|
+
|------|-----|
|
|
35
|
+
| Path | `/api/ticket/list` |
|
|
36
|
+
| Method | `GET` |
|
|
37
|
+
| 说明 | 分页查询工单(ticket)列表,支持多条件筛选 |
|
|
38
|
+
|
|
39
|
+
### Query 参数(与 OpenAPI 一致)
|
|
40
|
+
|
|
41
|
+
| 名称 | 类型 | 位置 | 说明 |
|
|
42
|
+
|------|------|------|------|
|
|
43
|
+
| `limit` | number | query | 每页条数 |
|
|
44
|
+
| `offset` | number | query | 分页偏移(从 0 开始) |
|
|
45
|
+
| `fields` | string | query | 指定返回字段(可选) |
|
|
46
|
+
| `ordering` | string | query | 排序(可选) |
|
|
47
|
+
| `status__in` | string | query | 状态,**多选**(多值格式以后端为准,常见逗号分隔) |
|
|
48
|
+
| `ticket_id__in` | string | query | 按业务工单号 **`detail.ticket_id`** 匹配,**多选**(示例:`TKT-34-005,TKT-34-006`) |
|
|
49
|
+
| `flow_id__in` | string | query | 按 `flow_id` 匹配,**多选** |
|
|
50
|
+
| `order_id__in` | string | query | 按 `order_id` 匹配,**多选** |
|
|
51
|
+
| `pool_id__in` | string | query | 按 `pool_id` 匹配,**多选** |
|
|
52
|
+
| `parent_ticket_id` | number | query | 按父工单 `parent_ticket_id` **精确**匹配 |
|
|
53
|
+
| `uuid` | string | query | 按 `uuid` **精确**匹配 |
|
|
54
|
+
| `batch_id` | number | query | 按 `batch_id` **精确**匹配 |
|
|
55
|
+
| `id` | number | query | 按主键 `id` **精确**匹配 |
|
|
56
|
+
|
|
57
|
+
**分页建议**:首次请求可设 `limit=100`、`offset=0`;下一页将 `offset` 增加为上一页 `offset + limit`,直至累计条数达到 `data.total` 或 `list` 为空。全量拉取时可设较大 `limit`(示例工程内默认 `999999`),以业务与网关上限为准。
|
|
58
|
+
|
|
59
|
+
### 响应示例
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"data": {
|
|
64
|
+
"list": [
|
|
65
|
+
{
|
|
66
|
+
"id": 445,
|
|
67
|
+
"flow_id": 34,
|
|
68
|
+
"order_id": 19,
|
|
69
|
+
"pool_id": 124,
|
|
70
|
+
"parent_ticket_id": 73,
|
|
71
|
+
"uuid": "7798e1af-b47e-4d3b-aa7a-c359b1d65a68",
|
|
72
|
+
"detail": {
|
|
73
|
+
"fw": 100.09,
|
|
74
|
+
"mw": 78.11,
|
|
75
|
+
"cas": "71-43-2",
|
|
76
|
+
"smiles": "c1ccccc1",
|
|
77
|
+
"salt_form": "Na",
|
|
78
|
+
"salt_mole": 1,
|
|
79
|
+
"ticket_id": "TKT-34-005",
|
|
80
|
+
"compound_id": "CMP-E005",
|
|
81
|
+
"alo_order_id": "ALO-2026-04005",
|
|
82
|
+
"process_params": {
|
|
83
|
+
"@compound_id": "CMP-E005",
|
|
84
|
+
"@alo_order_id": "ALO-2026-04005",
|
|
85
|
+
"@tolerance_mg_1": 0.5,
|
|
86
|
+
"@tolerance_mg_2": 0.5,
|
|
87
|
+
"@tolerance_mg_3": 0.5,
|
|
88
|
+
"@target_amount_mg_1": 12,
|
|
89
|
+
"@target_amount_mg_2": 6,
|
|
90
|
+
"@target_amount_mg_3": 0,
|
|
91
|
+
"@target_vial_type_1": "2mL",
|
|
92
|
+
"@target_vial_type_2": "1mL",
|
|
93
|
+
"@target_vial_type_3": "",
|
|
94
|
+
"@requested_amount_mg": 18
|
|
95
|
+
},
|
|
96
|
+
"process_result": {
|
|
97
|
+
"error": true,
|
|
98
|
+
"message": "Request failed with status code 422"
|
|
99
|
+
},
|
|
100
|
+
"tolerance_1_mg": 0.5,
|
|
101
|
+
"tolerance_2_mg": 0.5,
|
|
102
|
+
"tolerance_3_mg": 0.5,
|
|
103
|
+
"submission_status": "提交失败",
|
|
104
|
+
"target_amount_1_mg": 12,
|
|
105
|
+
"target_amount_2_mg": 6,
|
|
106
|
+
"target_amount_3_mg": 0,
|
|
107
|
+
"target_vial_type_1": "2mL",
|
|
108
|
+
"target_vial_type_2": "1mL",
|
|
109
|
+
"target_vial_type_3": "",
|
|
110
|
+
"material_on_machine": false
|
|
111
|
+
},
|
|
112
|
+
"status": "created",
|
|
113
|
+
"batch_id": null,
|
|
114
|
+
"createdById": 1,
|
|
115
|
+
"updatedById": 1,
|
|
116
|
+
"createdAt": "2026-05-11T08:39:49.345Z",
|
|
117
|
+
"updatedAt": "2026-05-11T08:39:49.345Z"
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
"total": 442
|
|
121
|
+
},
|
|
122
|
+
"code": 200,
|
|
123
|
+
"msg": ""
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 响应字段说明(`data`)
|
|
128
|
+
|
|
129
|
+
| 字段 | 类型 | 说明 |
|
|
130
|
+
|------|------|------|
|
|
131
|
+
| `data.list` | array | 当前页的工单对象列表 |
|
|
132
|
+
| `data.total` | number | 满足筛选条件的总条数(用于分页) |
|
|
133
|
+
|
|
134
|
+
### 列表项 `list[]` 常用字段
|
|
135
|
+
|
|
136
|
+
| 字段 | 类型 | 说明 |
|
|
137
|
+
|------|------|------|
|
|
138
|
+
| `id` | number | 工单主键 |
|
|
139
|
+
| `flow_id` | number | 流程 ID |
|
|
140
|
+
| `order_id` | number | 订单 ID |
|
|
141
|
+
| `pool_id` | number | 池 ID |
|
|
142
|
+
| `parent_ticket_id` | number | 父工单 ID |
|
|
143
|
+
| `uuid` | string | 工单 UUID |
|
|
144
|
+
| `detail` | object | 业务详情(化合物、工艺参数、提交状态等) |
|
|
145
|
+
| `status` | string | 工单状态,如 `created` |
|
|
146
|
+
| `batch_id` | number \| null | 批次 ID |
|
|
147
|
+
| `createdById` / `updatedById` | number | 创建人 / 最近更新人 |
|
|
148
|
+
| `createdAt` / `updatedAt` | string | ISO 8601 时间 |
|
|
149
|
+
|
|
150
|
+
`detail` 内与表格映射相关的字段(非穷举):
|
|
151
|
+
|
|
152
|
+
- `ticket_id`:业务工单号,对应筛选参数 **`ticket_id__in`**。
|
|
153
|
+
- `compound_id`、`smiles`:示例映射为表格「名称」列。
|
|
154
|
+
- `process_params['@requested_amount_mg']`、`target_amount_*_mg`:示例映射为表格「数量」列。
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 完成执行(execution complete)
|
|
159
|
+
|
|
160
|
+
用于在页面侧将 **编辑后的工单数据** 一次性提交给后端,完成门控/执行闭环(**不**替代 Book 整书保存;与 **`OrbitAPI.md`** 中菜单保存事件无关)。
|
|
161
|
+
|
|
162
|
+
### 基本信息
|
|
163
|
+
|
|
164
|
+
| 项目 | 值 |
|
|
165
|
+
|------|-----|
|
|
166
|
+
| Path | `/api/execution/complete` |
|
|
167
|
+
| Method | `POST` |
|
|
168
|
+
| Query | 无 |
|
|
169
|
+
| Body | **必填**,JSON |
|
|
170
|
+
|
|
171
|
+
### 请求体
|
|
172
|
+
|
|
173
|
+
| 字段 | 类型 | 说明 |
|
|
174
|
+
|------|------|------|
|
|
175
|
+
| `valve_id` | number | 门控或执行实例标识,与后端约定一致;示例可为 `0` |
|
|
176
|
+
| `tickets` | array | 工单对象列表;**每一项的结构须与 `GET /api/ticket/list` 返回的 `data.list[]` 单项一致**(含 `id`、`flow_id`、`detail`、`status` 等),并把用户在表格中修改过的字段写回对应路径(例如示例表「数量」映射到 `detail.process_params['@requested_amount_mg']` 与 `detail.target_amount_1_mg`) |
|
|
177
|
+
|
|
178
|
+
### 请求体示例
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"valve_id": 0,
|
|
183
|
+
"tickets": [
|
|
184
|
+
{
|
|
185
|
+
"id": 445,
|
|
186
|
+
"flow_id": 34,
|
|
187
|
+
"order_id": 19,
|
|
188
|
+
"pool_id": 124,
|
|
189
|
+
"detail": {
|
|
190
|
+
"ticket_id": "TKT-34-005",
|
|
191
|
+
"process_params": {
|
|
192
|
+
"@requested_amount_mg": 18
|
|
193
|
+
},
|
|
194
|
+
"target_amount_1_mg": 18
|
|
195
|
+
},
|
|
196
|
+
"status": "created"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 响应
|
|
203
|
+
|
|
204
|
+
沿用本文 **「通用响应包络」**:成功时常见 `code === 200`;失败时读取 `msg` 与 HTTP 状态。
|
|
205
|
+
|
|
206
|
+
### 与本仓库示例的对应关系
|
|
207
|
+
|
|
208
|
+
- **接口调用**:`src/api/agenticlabTickets.ts` → **`postAgenticlabExecutionComplete`**(经 **`orbitRequestJson`**,与列表接口同一鉴权方式)。
|
|
209
|
+
- **提交流程**:`src/use/useSuperTableBitableLifecycle.ts` → **`submitRows`**:先 **`checkRows({ skipLoading: true })`** 校验表格「数量」等规则,再从当前子表 **`items`** 取最新单元格值,与内存中最近一次 **`GET /api/ticket/list`** 的原始行合并后组装 **`tickets`**,最后 **`POST`**;**不会**调用 `updateUserData` 模拟保存或 **`xnb.event.emit('xnb-book-menu', 'save', ...)`**。
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 环境变量(AgenticLab App)
|
|
214
|
+
|
|
215
|
+
| 变量 | 说明 |
|
|
216
|
+
|------|------|
|
|
217
|
+
| `VITE_AGENTICLAB_API_URL` | AgenticLab App API 根地址,如 `https://your-agenticlab-host`(不要尾部的 `/api`) |
|
|
218
|
+
| `VITE_DEV_TOKEN` | 可选;有则请求头 `Authorization: Bearer <token>` |
|
|
219
|
+
| `VITE_AGENTICLAB_VALVE_ID` | 可选;`POST /api/execution/complete` 的 **`valve_id`**,当 opener `payload` 未带 `valve_id` 时使用;缺省按 `0` |
|
|
220
|
+
|
|
221
|
+
### 与本仓库 HTTP 封装的关系
|
|
222
|
+
|
|
223
|
+
工单列表与 **`POST /api/execution/complete`** 均由 **`src/api/agenticlabTickets.ts`** 发起,内部经 **`src/utils/orbitHttpClient.ts`** → **`orbitRequestJson`**:在 Orbit 宿主内走 **`window.xnb.http.client.request`**(与 **`OrbitAPI.md`** §6.3 一致);无 `http.client` 时回退 **`fetch`**。Token 在 Orbit 内由 **`await window.xnb.choreo.getUserToken()`**(无参)或 **`VITE_DEV_TOKEN`** 提供。
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## 页面调用注意
|
|
228
|
+
|
|
229
|
+
1. **CORS**:浏览器直连跨域时需在网关或本地 devServer 配置代理。
|
|
230
|
+
2. **错误处理**:除 `code === 200` 外,应处理 HTTP 错误与业务 `msg`。
|
|
231
|
+
3. **`ticket_id__in` 多值**:本仓库示例使用英文逗号拼接多个 `ticket_id`。
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 请求示例
|
|
236
|
+
|
|
237
|
+
```http
|
|
238
|
+
GET /api/ticket/list?limit=100&offset=0&ticket_id__in=TKT-34-005,TKT-34-006 HTTP/1.1
|
|
239
|
+
Host: <VITE_AGENTICLAB_API_URL 主机>
|
|
240
|
+
Accept: application/json
|
|
241
|
+
Authorization: Bearer <token>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
```http
|
|
245
|
+
POST /api/execution/complete HTTP/1.1
|
|
246
|
+
Host: <VITE_AGENTICLAB_API_URL 主机>
|
|
247
|
+
Content-Type: application/json
|
|
248
|
+
Accept: application/json
|
|
249
|
+
Authorization: Bearer <token>
|
|
250
|
+
|
|
251
|
+
{"valve_id":0,"tickets":[{"id":445,"detail":{"ticket_id":"TKT-34-005"}}]}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
```javascript
|
|
255
|
+
// 与 src/api/agenticlabTickets.ts 思路一致
|
|
256
|
+
const ticketIdIn = ['TKT-34-005', 'TKT-34-006'].join(',')
|
|
257
|
+
const url = new URL('/api/ticket/list', baseUrl)
|
|
258
|
+
url.searchParams.set('limit', '100')
|
|
259
|
+
url.searchParams.set('offset', '0')
|
|
260
|
+
url.searchParams.set('ticket_id__in', ticketIdIn)
|
|
261
|
+
const res = await fetch(url.toString(), { headers: { Accept: 'application/json', Authorization: `Bearer ${token}` } })
|
|
262
|
+
const { data, code, msg } = await res.json()
|
|
263
|
+
const list = data?.list ?? []
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
后续若有更多 AgenticLab App 接口,可在本文件按「Path + Method + 参数表 + 响应示例」追加章节。
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// @Library('exar@2.0dev') _
|
|
2
|
+
// Version: 0.0.1
|
|
3
|
+
def FAILED_STAGE
|
|
4
|
+
|
|
5
|
+
pipeline {
|
|
6
|
+
agent {
|
|
7
|
+
docker {
|
|
8
|
+
label 'pro-spot'
|
|
9
|
+
image 'hub.xtalpi.cc/development/webb_ci:1.0.0'
|
|
10
|
+
registryUrl 'https://hub.xtalpi.cc'
|
|
11
|
+
registryCredentialsId 'hub_pass'
|
|
12
|
+
args '-u root:root -v /var/run/docker.sock:/var/run/docker.sock'
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
options {
|
|
16
|
+
skipDefaultCheckout(true)
|
|
17
|
+
timestamps()
|
|
18
|
+
}
|
|
19
|
+
stages {
|
|
20
|
+
stage ('Pull code') {
|
|
21
|
+
steps {
|
|
22
|
+
checkout scm
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
stage ('Prepare') {
|
|
26
|
+
steps {
|
|
27
|
+
echo 'Prepare env'
|
|
28
|
+
sh 'env'
|
|
29
|
+
sh "exar login -k $EXAR_APPKEY -s $EXAR_APPSECRET"
|
|
30
|
+
sh 'exar context init'
|
|
31
|
+
load "$WORKSPACE/.exar/env.groovy"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
stage ('Lint') {
|
|
35
|
+
steps {
|
|
36
|
+
script { FAILED_STAGE = env.STAGE_NAME }
|
|
37
|
+
echo 'Static check'
|
|
38
|
+
sh """ eslint --ext .js,.ts,.tsx,.vue src \
|
|
39
|
+
--resolve-plugins-relative-to /usr/local/node-v14.17.5-linux-x64/lib/node_modules \
|
|
40
|
+
--config /usr/local/node-v14.17.5-linux-x64/lib/.eslintrc.js \
|
|
41
|
+
--no-eslintrc
|
|
42
|
+
"""
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
stage ('Build') {
|
|
46
|
+
steps {
|
|
47
|
+
script { FAILED_STAGE = env.STAGE_NAME }
|
|
48
|
+
echo 'Build project'
|
|
49
|
+
// sh 'npm install'
|
|
50
|
+
// sh 'npm run build'
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
stage ('Publish') {
|
|
54
|
+
when {
|
|
55
|
+
expression {
|
|
56
|
+
env.EXAR_DEFAULT_COMMIT_MESSAGE =~ /<publish>|<publish-npm>|<publish-dist>/
|
|
57
|
+
}
|
|
58
|
+
anyOf {
|
|
59
|
+
branch 'master'
|
|
60
|
+
branch 'G2'
|
|
61
|
+
branch 'hotfix/*'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
steps {
|
|
65
|
+
script {
|
|
66
|
+
FAILED_STAGE = env.STAGE_NAME
|
|
67
|
+
if (env.EXAR_DEFAULT_COMMIT_MESSAGE =~ /<publish>/) {
|
|
68
|
+
echo 'Publish to webb'
|
|
69
|
+
sh """ webb publish dependency . \
|
|
70
|
+
--env=0 \
|
|
71
|
+
--user=$EXAR_DEFAULT_USER \
|
|
72
|
+
--link=$RUN_DISPLAY_URL \
|
|
73
|
+
--message='"$EXAR_DEFAULT_COMMIT_MESSAGE"' \
|
|
74
|
+
--branch="$BRANCH_NAME"
|
|
75
|
+
"""
|
|
76
|
+
}
|
|
77
|
+
if (env.EXAR_DEFAULT_COMMIT_MESSAGE =~ /<publish-dist>/) {
|
|
78
|
+
echo 'Publish to webb'
|
|
79
|
+
}
|
|
80
|
+
if (env.EXAR_DEFAULT_COMMIT_MESSAGE =~ /<publish-npm>/) {
|
|
81
|
+
echo 'Publish to npm'
|
|
82
|
+
sh 'npm publish'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
post {
|
|
90
|
+
always {
|
|
91
|
+
sh 'git clean -ffdx'
|
|
92
|
+
}
|
|
93
|
+
failure {
|
|
94
|
+
echo 'Failed...'
|
|
95
|
+
sh """ webb notify '[{ "key": "🧭 阶段", "value": "${FAILED_STAGE}" }]' \
|
|
96
|
+
--title="提交代码失败" \
|
|
97
|
+
--name="$JOB_NAME" \
|
|
98
|
+
--user="$EXAR_DEFAULT_USER" \
|
|
99
|
+
--link="$RUN_DISPLAY_URL" \
|
|
100
|
+
--message='"$EXAR_DEFAULT_COMMIT_MESSAGE"' \
|
|
101
|
+
--branch="$BRANCH_NAME" \
|
|
102
|
+
--type="error"
|
|
103
|
+
"""
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|