@zax360/openapi-skills 1.0.0
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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zhianxin-openapi",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "面向 AI Agent 的职安心开放能力说明:HTTP 签名校验、线索与岗位查询等 Skills(每能力一份 SKILL.md)。",
|
|
5
|
+
"keywords": ["zhianxin", "openapi", "职安心", "leads", "signing"],
|
|
6
|
+
"skills": "./skills/",
|
|
7
|
+
"interface": {
|
|
8
|
+
"displayName": "职安心开放平台",
|
|
9
|
+
"shortDescription": "开放 API 签约与调用的 Agent Skills",
|
|
10
|
+
"longDescription": "为本仓库开放网关与 /openapi 业务接口提供可复用的 SKILL.md。Agent 在取得商户授权的 AccessKey / SecretKey 后,按文档生成 Cw-Signature 并调用 HTTP 接口。详细 HTTP 契约与模型参见 Apifox。",
|
|
11
|
+
"developerName": "职安心",
|
|
12
|
+
"category": "Developer Tools",
|
|
13
|
+
"capabilities": ["Interactive", "Write"],
|
|
14
|
+
"defaultPrompt": ["根据职安心开放平台文档代用户构造签名并调用 API(密钥由用户配置,勿写入仓库)"]
|
|
15
|
+
}
|
|
16
|
+
}
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* 将本包目录作为 Skill 源安装到各 Agent(封装 npx skills add … -y -g)
|
|
4
|
+
*/
|
|
5
|
+
const { execFileSync } = require('child_process')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
|
|
8
|
+
const pkgRoot = path.resolve(__dirname, '..')
|
|
9
|
+
const passThrough = process.argv.slice(2)
|
|
10
|
+
const args = ['skills', 'add', pkgRoot, '-y', '-g', ...passThrough]
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
execFileSync('npx', args, { stdio: 'inherit', env: process.env })
|
|
14
|
+
} catch {
|
|
15
|
+
process.exit(1)
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zax360/openapi-skills",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "职安心开放平台 Agent Skills(签名、只读查询、线索 ingest),供 npx skills / Cursor / Codex 等加载",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"zhianxin",
|
|
8
|
+
"zax360",
|
|
9
|
+
"openapi",
|
|
10
|
+
"skills",
|
|
11
|
+
"职安心",
|
|
12
|
+
"cursor",
|
|
13
|
+
"codex"
|
|
14
|
+
],
|
|
15
|
+
"bin": {
|
|
16
|
+
"zax360-openapi-skills": "bin/install.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"bin",
|
|
20
|
+
"skills",
|
|
21
|
+
".codex-plugin"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zhianxin-openapi-leads
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "职安心开放平台线索写入与查询:POST /v1/leads/ingest、GET /v1/leads/staging/:id。当用户要通过 Agent 提交报名线索或查询暂存状态时使用。"
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["curl", "openssl"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 线索 API(Agent)
|
|
11
|
+
|
|
12
|
+
> **前置条件:** 先阅读 [`../zhianxin-openapi-shared/SKILL.md`](../zhianxin-openapi-shared/SKILL.md)(签名与环境变量)。
|
|
13
|
+
|
|
14
|
+
## 写入暂存 · POST /v1/leads/ingest
|
|
15
|
+
|
|
16
|
+
Body 为 JSON,至少包含业务约定的 `content`;可选 `campaign` 等字段以实际上线为准。
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# 设置 BASE、ACCESS_KEY、SECRET_KEY 后:
|
|
20
|
+
TS=$(date +%s)
|
|
21
|
+
BODY='{"content":"用户意向描述","campaign":"渠道活动名"}'
|
|
22
|
+
SIGN_STRING="${ACCESS_KEY}"$'\n'"${SECRET_KEY}"$'\n'"${TS}"$'\n'"${BODY}"
|
|
23
|
+
SIG=$(printf '%s' "$SIGN_STRING" | openssl dgst -sha1 -hmac "$SECRET_KEY" -binary | openssl base64)
|
|
24
|
+
curl -sS -X POST "$BASE/v1/leads/ingest" \
|
|
25
|
+
-H "Content-Type: application/json; charset=utf-8" \
|
|
26
|
+
-H "Cw-Access-Key: $ACCESS_KEY" \
|
|
27
|
+
-H "Cw-Timestamp: $TS" \
|
|
28
|
+
-H "Cw-Signature: $SIG" \
|
|
29
|
+
--data-binary "$BODY"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
成功时响应体通常包含 `code`、`msg`、记录 `id` 等(与历史契约一致)。
|
|
33
|
+
|
|
34
|
+
## 查询暂存 · GET /v1/leads/staging/:id
|
|
35
|
+
|
|
36
|
+
将 `:id` 换为上一步返回的 id;签名为 **GET 三行串**(无 body)。
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
TS=$(date +%s)
|
|
40
|
+
SIGN_STRING="${ACCESS_KEY}"$'\n'"${SECRET_KEY}"$'\n'"${TS}"
|
|
41
|
+
SIG=$(printf '%s' "$SIGN_STRING" | openssl dgst -sha1 -hmac "$SECRET_KEY" -binary | openssl base64)
|
|
42
|
+
curl -sS "$BASE/v1/leads/staging/线索记录ID" \
|
|
43
|
+
-H "Cw-Access-Key: $ACCESS_KEY" \
|
|
44
|
+
-H "Cw-Timestamp: $TS" \
|
|
45
|
+
-H "Cw-Signature: $SIG"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 原则
|
|
49
|
+
|
|
50
|
+
- 写入前向用户确认内容与合规要求;避免重复提交同一线索 unless 用户明确要求。
|
|
51
|
+
- 密钥仅通过环境变量或用户本地配置注入,不出现在仓库与截图中。
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zhianxin-openapi-readonly
|
|
3
|
+
version: 1.1.0
|
|
4
|
+
description: "职安心开放平台只读:CLI zax360 openapi(company-list、company-find-by-name、job-info、job-types、info、dict-degree)与 GET /v1/jobs、/v1/jobs/:id、/v1/companies、/v1/account/*、/v1/catalog/services。用户要拉企业列表、岗位详情、目录、用量或让 Agent 用 openapi 子命令时触发。"
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["curl", "openssl"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 只读查询(v1,Agent)
|
|
11
|
+
|
|
12
|
+
> **前置条件:** [`../zhianxin-openapi-shared/SKILL.md`](../zhianxin-openapi-shared/SKILL.md)。
|
|
13
|
+
|
|
14
|
+
## CLI `zax360 openapi` 与 HTTP 一一对照
|
|
15
|
+
|
|
16
|
+
Base URL = Rust 开放网关(与 `auth login` 一致)。签名头:`Cw-Access-Key`、`Cw-Timestamp`、`Cw-Signature`。
|
|
17
|
+
|
|
18
|
+
| 能力说明 | CLI | 实际请求 |
|
|
19
|
+
|----------|-----|----------|
|
|
20
|
+
| **企业列表** | `zax360 openapi company-list` | `GET /v1/companies?page=1&page_size=100` |
|
|
21
|
+
| **企业按名称**(全字匹配,无单独接口) | `zax360 openapi company-find-by-name --name "<名称>"` | 循环 `GET /v1/companies?page=1…30&page_size=100`,在 `data.list` 中找 `company_name === 参数` |
|
|
22
|
+
| **岗位详情** | `zax360 openapi job-info --id "<岗位ID>"` | `GET /v1/jobs/{id}` |
|
|
23
|
+
| **快照:企业 + 在招岗位 + 能力目录** | `zax360 openapi info` | **并行** `GET /v1/companies?page=1&page_size=50`、`GET /v1/jobs?page=1&page_size=20`、`GET /v1/catalog/services` |
|
|
24
|
+
| **工种标签**(首屏去重,非字典表) | `zax360 openapi job-types` | `GET /v1/jobs?page=1&page_size=100`,对 `job_type` 去重输出 |
|
|
25
|
+
| **学历字典** | `zax360 openapi dict-degree` | **不请求 Rust**;需 Java `GET /openapi/dict/degree` 或 Apifox |
|
|
26
|
+
|
|
27
|
+
**汇总(非 openapi 子命令)**:`zax360 account info` 并行调用 `GET /v1/account/quota`、`/v1/account/usage`、`/v1/catalog/services`、`/v1/companies?page=1&page_size=10`、`/v1/jobs?page=1&page_size=10`。
|
|
28
|
+
|
|
29
|
+
**任意路径**:`zax360 request get /v1/...`(path 以 `/` 开头)。
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## REST 路径速查(自建客户端 / cURL)
|
|
34
|
+
|
|
35
|
+
以下为 **GET**,签名字符串均为三行:`accessKey\nsecretKey\ntimestamp`。
|
|
36
|
+
|
|
37
|
+
### 岗位列表
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
GET $BASE/v1/jobs?page=1&page_size=20
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 岗位详情
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
GET $BASE/v1/jobs/{id}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 企业列表 / 详情
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
GET $BASE/v1/companies?page=1&page_size=20
|
|
53
|
+
GET $BASE/v1/companies/{id}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 用量与配额
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
GET $BASE/v1/account/usage
|
|
60
|
+
GET $BASE/v1/account/quota
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 能力目录
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
GET $BASE/v1/catalog/services
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## cURL 示例(岗位列表)
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
TS=$(date +%s)
|
|
73
|
+
SIGN_STRING="${ACCESS_KEY}"$'\n'"${SECRET_KEY}"$'\n'"${TS}"
|
|
74
|
+
SIG=$(printf '%s' "$SIGN_STRING" | openssl dgst -sha1 -hmac "$SECRET_KEY" -binary | openssl base64)
|
|
75
|
+
curl -sS "$BASE/v1/jobs?page=1&page_size=20" \
|
|
76
|
+
-H "Cw-Access-Key: $ACCESS_KEY" \
|
|
77
|
+
-H "Cw-Timestamp: $TS" \
|
|
78
|
+
-H "Cw-Signature: $SIG"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
查询参数 **必须** 参与 URL;若网关要求固定查询顺序,按实际上线文档拼接(与 `curl` 发出的完整 path+query 一致即可)。
|
|
82
|
+
|
|
83
|
+
## Apifox 业务接口
|
|
84
|
+
|
|
85
|
+
企业维护、岗位发布、字典等 **`/openapi/...`** 路径的请求体与示例见 [Apifox](https://alwrbsqeg9.apifox.cn/),签名规则与本 Skill 相同(POST 时追加 body)。
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zhianxin-openapi-shared
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "职安心开放平台通用约定:签名字符串、cURL 模板、环境与安全。当用户要用 Agent 调用职安心开放 HTTP API(任意路径)时应先读本 Skill。"
|
|
5
|
+
metadata:
|
|
6
|
+
requires:
|
|
7
|
+
bins: ["curl", "openssl"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 职安心开放平台 · 共享约定(Agent)
|
|
11
|
+
|
|
12
|
+
> 每个能力对应一份 `SKILL.md`,由 frontmatter 的 `description` 供 Agent 触发匹配;具体 HTTP 路径与 body 模型以 **Apifox** 及仓库根目录 **README /docs** 为准。
|
|
13
|
+
|
|
14
|
+
## 前置条件
|
|
15
|
+
|
|
16
|
+
1. **Base URL**:运营提供的网关根地址(可与开放控制台同源,也可能单独域名)。下文记为 `BASE`(无尾部 `/`)。
|
|
17
|
+
2. **密钥**:`ACCESS_KEY`、`SECRET_KEY` 由商户在 **开放控制台 → API 密钥** 获取。**禁止**写入仓库、日志或提交到模型训练可见的明文库;由用户在环境变量或密钥管理中配置。
|
|
18
|
+
3. **时间戳**:`TIMESTAMP` 为 Unix 秒(字符串)。
|
|
19
|
+
|
|
20
|
+
## 签名(与控制台文档一致)
|
|
21
|
+
|
|
22
|
+
请求头固定包含:
|
|
23
|
+
|
|
24
|
+
- `Cw-Access-Key`: ACCESS_KEY
|
|
25
|
+
- `Cw-Timestamp`: TIMESTAMP
|
|
26
|
+
- `Cw-Signature`: Base64( HMAC-SHA1(SECRET_KEY, signString) )
|
|
27
|
+
|
|
28
|
+
**签名字符串 `signString`:**
|
|
29
|
+
|
|
30
|
+
- **GET**(或无 body 的 DELETE 等):
|
|
31
|
+
`ACCESS_KEY + "\n" + SECRET_KEY + "\n" + TIMESTAMP`
|
|
32
|
+
- **POST / PUT**(有 body):
|
|
33
|
+
在上述末尾追加 `+ "\n" + rawBody`,`rawBody` 为实际发送的 **UTF-8 原始字节**对应的字符串(与 `curl --data-binary` 一致)。
|
|
34
|
+
|
|
35
|
+
## 用 OpenSSL 计算签名(便于 Agent 单步脚本)
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# signString 写入文件 sign.txt,SECRET_KEY 作 HMAC key
|
|
39
|
+
printf '%s' "$SIGN_STRING" > /tmp/zx-sign.txt
|
|
40
|
+
openssl dgst -sha1 -hmac "$SECRET_KEY" -binary /tmp/zx-sign.txt | openssl base64
|
|
41
|
+
# 输出即为 Cw-Signature(无换行)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## cURL 模板 · GET
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
TS=$(date +%s)
|
|
48
|
+
SIGN_STRING="${ACCESS_KEY}"$'\n'"${SECRET_KEY}"$'\n'"${TS}"
|
|
49
|
+
SIG=$(printf '%s' "$SIGN_STRING" | openssl dgst -sha1 -hmac "$SECRET_KEY" -binary | openssl base64)
|
|
50
|
+
curl -sS "$BASE/v1/account/usage" \
|
|
51
|
+
-H "Cw-Access-Key: $ACCESS_KEY" \
|
|
52
|
+
-H "Cw-Timestamp: $TS" \
|
|
53
|
+
-H "Cw-Signature: $SIG"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## cURL 模板 · POST(JSON)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
TS=$(date +%s)
|
|
60
|
+
BODY='{"content":"示例线索","campaign":"活动A"}'
|
|
61
|
+
SIGN_STRING="${ACCESS_KEY}"$'\n'"${SECRET_KEY}"$'\n'"${TS}"$'\n'"${BODY}"
|
|
62
|
+
SIG=$(printf '%s' "$SIGN_STRING" | openssl dgst -sha1 -hmac "$SECRET_KEY" -binary | openssl base64)
|
|
63
|
+
curl -sS -X POST "$BASE/v1/leads/ingest" \
|
|
64
|
+
-H "Content-Type: application/json; charset=utf-8" \
|
|
65
|
+
-H "Cw-Access-Key: $ACCESS_KEY" \
|
|
66
|
+
-H "Cw-Timestamp: $TS" \
|
|
67
|
+
-H "Cw-Signature: $SIG" \
|
|
68
|
+
--data-binary "$BODY"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 路由前缀
|
|
72
|
+
|
|
73
|
+
| 前缀 | 说明 |
|
|
74
|
+
|------|------|
|
|
75
|
+
| `/openapi` | 企业、岗位、字典等,见 Apifox |
|
|
76
|
+
| `/v1` | 扩展能力(线索、只读岗位/企业、用量等),README 表格 |
|
|
77
|
+
|
|
78
|
+
两套接口 **共用同一套** AK/SK 与签名规则。
|
|
79
|
+
|
|
80
|
+
## 官方 CLI(Node 18+)
|
|
81
|
+
|
|
82
|
+
npm 包 **`@zax360/openapi-cli`**:例如 `npx @zax360/openapi-cli lead push --base-url ... --access-key ... --secret-key ... --content "..."`。详见 README「命令行」一节。
|
|
83
|
+
|
|
84
|
+
## 进一步阅读
|
|
85
|
+
|
|
86
|
+
- 人类可读完整说明:开放控制台 **接口文档**,或仓库根目录 `README.md`。
|
|
87
|
+
- 在线调试与模型定义:[职安心开放平台 Apifox](https://alwrbsqeg9.apifox.cn/)。
|