licos-platform-cli 0.6.0__tar.gz → 0.6.2__tar.gz
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.
- licos_platform_cli-0.6.2/PKG-INFO +75 -0
- licos_platform_cli-0.6.2/README.md +67 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/pyproject.toml +2 -2
- licos_platform_cli-0.6.0/PKG-INFO +0 -40
- licos_platform_cli-0.6.0/README.md +0 -32
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/.gitignore +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/__init__.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/database_commands.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/help_commands.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/identity.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/knowledge_commands.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/main.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/oauth_commands.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/ontology_commands.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/project_config_commands.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/storage_commands.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/user_commands.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/tests/test_cli.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/tests/test_identity.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/tests/test_project_config.py +0 -0
- {licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/tests/test_user.py +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: licos-platform-cli
|
|
3
|
+
Version: 0.6.2
|
|
4
|
+
Summary: LICOS platform CLI
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: licos-platform-sdk>=0.7.2
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
# licos-platform-cli
|
|
10
|
+
|
|
11
|
+
LICOS 平台命令行工具。`licos-platform help` 返回结构化 JSON 帮助。
|
|
12
|
+
|
|
13
|
+
## 当前使用者(0.5.1 起)
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
licos-platform user me
|
|
17
|
+
licos-platform user me --workspace-id <执行工作空间ID>
|
|
18
|
+
licos-platform help user me
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
用户接口默认使用 `LICOS_CURRENT_USER_ID` 指定的容器执行用户换取 Token。它不代表网页登录者。平台地址、服务凭证和项目工作空间沿用运行时配置。
|
|
22
|
+
多用户请求可将当前使用者 Token 通过标准输入传入,不将 Token 放在命令行参数中:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
licos-platform user me --token-stdin
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
输入不含 `Bearer ` 前缀的 Token 并结束标准输入。程序调用时可通过子进程的 `input` 参数传入。
|
|
29
|
+
|
|
30
|
+
输出为与低代码 `sys_user` 相同的 JSON:用户 ID、账号、姓名、头像、执行企业、
|
|
31
|
+
主部门、全部所属部门、组织任职、主岗位和主职务。部门含名称路径、ID 路径;
|
|
32
|
+
无部门/任职时保持 `[]`/`null`。缺少当前使用者身份或 Token 失效时返回非零退出码,
|
|
33
|
+
不改用项目所有者。Token 和内部服务凭证不回显。
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## 身份选择(0.6.0 起)
|
|
37
|
+
|
|
38
|
+
`LICOS_CURRENT_USER_ID` 表示容器启动时配置的执行用户,项目身份指运行时配置的项目所有者身份。不同命令的默认身份如下:
|
|
39
|
+
|
|
40
|
+
| 命令 | 默认身份 | 网页登录用户执行 |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| `user me` | 按 `LICOS_CURRENT_USER_ID` 换 Token | 使用 `--token-stdin` |
|
|
43
|
+
| `knowledge enterprise …` | 按 `LICOS_CURRENT_USER_ID` 换 Token | 使用 `--token-stdin`,企业范围和权限由平台认证结果确定 |
|
|
44
|
+
| `ontology search`、`ontology invoke` | 按 `LICOS_CURRENT_USER_ID` 换 Token | 使用 `--token-stdin` |
|
|
45
|
+
| 普通 `knowledge …` | 项目身份 | 需要用户权限时使用 `--token-stdin` |
|
|
46
|
+
| 数据库、对象存储、OAuth 应用管理 | 项目身份 | 保持项目身份 |
|
|
47
|
+
|
|
48
|
+
用户操作未传 `--token-stdin` 时,用 `LICOS_CURRENT_USER_ID` 和运行时服务凭证换 Token;缺少执行用户配置则报错。`--token-stdin` 优先使用标准输入的 Token,空输入直接报错,不再换取其他身份。
|
|
49
|
+
|
|
50
|
+
HTTP 服务调用用户接口时,必须从本次认证会话取得 Token,并写入该子进程的标准输入;缺少 Token 时在业务入口返回登录错误。不能依赖容器默认用户,也不能把请求 Token 或用户 ID 写入共享环境变量。例如在 Python 服务中:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
import subprocess
|
|
54
|
+
|
|
55
|
+
# token 来自本次请求的认证会话,不含 "Bearer " 前缀。
|
|
56
|
+
result = subprocess.run(
|
|
57
|
+
["licos-platform", "user", "me", "--token-stdin"],
|
|
58
|
+
input=token,
|
|
59
|
+
text=True,
|
|
60
|
+
capture_output=True,
|
|
61
|
+
check=True,
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
显式传入的 Token 鉴权失败时返回非零退出码,由调用方更新登录凭证,不切换到容器用户或项目所有者。项目所有者和工作空间等资源归属字段单独保留,不用它们冒充调用用户。
|
|
66
|
+
|
|
67
|
+
## 编程项目登录身份
|
|
68
|
+
|
|
69
|
+
- 有内置登录时使用内置登录会话;没有内置登录时使用当前 LICOS 网页登录。内置登录未登录或过期时不能切换成平台用户。
|
|
70
|
+
- Node 服务端使用 `createProjectAuth({ mode: 'builtin', resolveBuiltinToken })` 或 `createProjectAuth({ mode: 'platform' })`,每次请求调用 `await projectAuth.userToken(request)`。内置解析器必须读取已有认证会话并返回用户已授权的 LICOS 凭证。
|
|
71
|
+
- 无内置登录的浏览器用户接口使用 `@kmlckj/licos-platform-sdk/browser` 的 `createProjectUserFetch`:平台登录桥领取一次性票据,项目后端兑换 Token。不要直接读取跨域平台 localStorage,不在 URL 中传 Token,不修改全局 fetch。项目级 API 保持原有请求方法。
|
|
72
|
+
- Python 使用 `ProjectAuth`;Agent/Workflow 通过 `config/licos-auth.json` 配置模式,内置登录设置 `resolver: "模块:函数"`,业务代码使用 `ctx.identity.user_token`。
|
|
73
|
+
- 当前用户、企业知识库、本体用户操作显式传 `userToken`/`user_token`。模型、积分和普通知识库按业务选择用户或项目身份。数据库、对象存储和可观测性继续使用项目身份。
|
|
74
|
+
- OAuth 接入 SDK 的用户、知识库、模型能力分别申请 `project.user`、`project.knowledge`、`project.models`;新增范围需要用户重新授权。业务自签 JWT 不能直接充当 LICOS Token。
|
|
75
|
+
- 修改已有项目时先接它的现有登录机制,不能用新模板的默认平台模式覆盖。真实 Token 只存在于运行时请求/会话,不写入源代码、共享环境变量或 Agent 提示词。
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# licos-platform-cli
|
|
2
|
+
|
|
3
|
+
LICOS 平台命令行工具。`licos-platform help` 返回结构化 JSON 帮助。
|
|
4
|
+
|
|
5
|
+
## 当前使用者(0.5.1 起)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
licos-platform user me
|
|
9
|
+
licos-platform user me --workspace-id <执行工作空间ID>
|
|
10
|
+
licos-platform help user me
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
用户接口默认使用 `LICOS_CURRENT_USER_ID` 指定的容器执行用户换取 Token。它不代表网页登录者。平台地址、服务凭证和项目工作空间沿用运行时配置。
|
|
14
|
+
多用户请求可将当前使用者 Token 通过标准输入传入,不将 Token 放在命令行参数中:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
licos-platform user me --token-stdin
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
输入不含 `Bearer ` 前缀的 Token 并结束标准输入。程序调用时可通过子进程的 `input` 参数传入。
|
|
21
|
+
|
|
22
|
+
输出为与低代码 `sys_user` 相同的 JSON:用户 ID、账号、姓名、头像、执行企业、
|
|
23
|
+
主部门、全部所属部门、组织任职、主岗位和主职务。部门含名称路径、ID 路径;
|
|
24
|
+
无部门/任职时保持 `[]`/`null`。缺少当前使用者身份或 Token 失效时返回非零退出码,
|
|
25
|
+
不改用项目所有者。Token 和内部服务凭证不回显。
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## 身份选择(0.6.0 起)
|
|
29
|
+
|
|
30
|
+
`LICOS_CURRENT_USER_ID` 表示容器启动时配置的执行用户,项目身份指运行时配置的项目所有者身份。不同命令的默认身份如下:
|
|
31
|
+
|
|
32
|
+
| 命令 | 默认身份 | 网页登录用户执行 |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| `user me` | 按 `LICOS_CURRENT_USER_ID` 换 Token | 使用 `--token-stdin` |
|
|
35
|
+
| `knowledge enterprise …` | 按 `LICOS_CURRENT_USER_ID` 换 Token | 使用 `--token-stdin`,企业范围和权限由平台认证结果确定 |
|
|
36
|
+
| `ontology search`、`ontology invoke` | 按 `LICOS_CURRENT_USER_ID` 换 Token | 使用 `--token-stdin` |
|
|
37
|
+
| 普通 `knowledge …` | 项目身份 | 需要用户权限时使用 `--token-stdin` |
|
|
38
|
+
| 数据库、对象存储、OAuth 应用管理 | 项目身份 | 保持项目身份 |
|
|
39
|
+
|
|
40
|
+
用户操作未传 `--token-stdin` 时,用 `LICOS_CURRENT_USER_ID` 和运行时服务凭证换 Token;缺少执行用户配置则报错。`--token-stdin` 优先使用标准输入的 Token,空输入直接报错,不再换取其他身份。
|
|
41
|
+
|
|
42
|
+
HTTP 服务调用用户接口时,必须从本次认证会话取得 Token,并写入该子进程的标准输入;缺少 Token 时在业务入口返回登录错误。不能依赖容器默认用户,也不能把请求 Token 或用户 ID 写入共享环境变量。例如在 Python 服务中:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import subprocess
|
|
46
|
+
|
|
47
|
+
# token 来自本次请求的认证会话,不含 "Bearer " 前缀。
|
|
48
|
+
result = subprocess.run(
|
|
49
|
+
["licos-platform", "user", "me", "--token-stdin"],
|
|
50
|
+
input=token,
|
|
51
|
+
text=True,
|
|
52
|
+
capture_output=True,
|
|
53
|
+
check=True,
|
|
54
|
+
)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
显式传入的 Token 鉴权失败时返回非零退出码,由调用方更新登录凭证,不切换到容器用户或项目所有者。项目所有者和工作空间等资源归属字段单独保留,不用它们冒充调用用户。
|
|
58
|
+
|
|
59
|
+
## 编程项目登录身份
|
|
60
|
+
|
|
61
|
+
- 有内置登录时使用内置登录会话;没有内置登录时使用当前 LICOS 网页登录。内置登录未登录或过期时不能切换成平台用户。
|
|
62
|
+
- Node 服务端使用 `createProjectAuth({ mode: 'builtin', resolveBuiltinToken })` 或 `createProjectAuth({ mode: 'platform' })`,每次请求调用 `await projectAuth.userToken(request)`。内置解析器必须读取已有认证会话并返回用户已授权的 LICOS 凭证。
|
|
63
|
+
- 无内置登录的浏览器用户接口使用 `@kmlckj/licos-platform-sdk/browser` 的 `createProjectUserFetch`:平台登录桥领取一次性票据,项目后端兑换 Token。不要直接读取跨域平台 localStorage,不在 URL 中传 Token,不修改全局 fetch。项目级 API 保持原有请求方法。
|
|
64
|
+
- Python 使用 `ProjectAuth`;Agent/Workflow 通过 `config/licos-auth.json` 配置模式,内置登录设置 `resolver: "模块:函数"`,业务代码使用 `ctx.identity.user_token`。
|
|
65
|
+
- 当前用户、企业知识库、本体用户操作显式传 `userToken`/`user_token`。模型、积分和普通知识库按业务选择用户或项目身份。数据库、对象存储和可观测性继续使用项目身份。
|
|
66
|
+
- OAuth 接入 SDK 的用户、知识库、模型能力分别申请 `project.user`、`project.knowledge`、`project.models`;新增范围需要用户重新授权。业务自签 JWT 不能直接充当 LICOS Token。
|
|
67
|
+
- 修改已有项目时先接它的现有登录机制,不能用新模板的默认平台模式覆盖。真实 Token 只存在于运行时请求/会话,不写入源代码、共享环境变量或 Agent 提示词。
|
|
@@ -4,12 +4,12 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "licos-platform-cli"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.2"
|
|
8
8
|
description = "LICOS platform CLI"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"licos-platform-sdk>=0.7.
|
|
12
|
+
"licos-platform-sdk>=0.7.2",
|
|
13
13
|
]
|
|
14
14
|
|
|
15
15
|
[project.scripts]
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.5
|
|
2
|
-
Name: licos-platform-cli
|
|
3
|
-
Version: 0.6.0
|
|
4
|
-
Summary: LICOS platform CLI
|
|
5
|
-
Requires-Python: >=3.10
|
|
6
|
-
Requires-Dist: licos-platform-sdk>=0.7.0
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
|
|
9
|
-
# licos-platform-cli
|
|
10
|
-
|
|
11
|
-
LICOS 平台命令行工具。`licos-platform help` 返回结构化 JSON 帮助。
|
|
12
|
-
|
|
13
|
-
## 当前使用者(0.5.1 起)
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
licos-platform user me
|
|
17
|
-
licos-platform user me --workspace-id <执行工作空间ID>
|
|
18
|
-
licos-platform help user me
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
用户接口默认使用 `LICOS_CURRENT_USER_ID` 指定的容器执行用户换取 Token。它不代表网页登录者。平台地址、服务凭证和项目工作空间沿用运行时配置。
|
|
22
|
-
多用户请求可将当前使用者 Token 通过标准输入传入,不将 Token 放在命令行参数中:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
licos-platform user me --token-stdin
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
输入不含 `Bearer ` 前缀的 Token 并结束标准输入。程序调用时可通过子进程的 `input` 参数传入。
|
|
29
|
-
|
|
30
|
-
输出为与低代码 `sys_user` 相同的 JSON:用户 ID、账号、姓名、头像、执行企业、
|
|
31
|
-
主部门、全部所属部门、组织任职、主岗位和主职务。部门含名称路径、ID 路径;
|
|
32
|
-
无部门/任职时保持 `[]`/`null`。缺少当前使用者身份或 Token 失效时返回非零退出码,
|
|
33
|
-
不改用项目所有者。Token 和内部服务凭证不回显。
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
## 身份选择(0.6.0 起)
|
|
37
|
-
|
|
38
|
-
`user me`、`knowledge enterprise …`、`ontology …` 均支持 `--token-stdin`。HTTP 服务调用这些命令时必须从标准输入传本次网页登录 Token;独立 CLI 不传此选项时按 `LICOS_CURRENT_USER_ID` 换 Token,缺少该变量则报错。
|
|
39
|
-
|
|
40
|
-
普通 `knowledge …` 命令默认使用项目身份,`--token-stdin` 可显式按调用用户授权。数据库、存储和 OAuth 应用管理仍使用项目身份。空 Token、失效 Token 不切换身份。完整接口分类见仓库 `tools/IDENTITY.md`。
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# licos-platform-cli
|
|
2
|
-
|
|
3
|
-
LICOS 平台命令行工具。`licos-platform help` 返回结构化 JSON 帮助。
|
|
4
|
-
|
|
5
|
-
## 当前使用者(0.5.1 起)
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
licos-platform user me
|
|
9
|
-
licos-platform user me --workspace-id <执行工作空间ID>
|
|
10
|
-
licos-platform help user me
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
用户接口默认使用 `LICOS_CURRENT_USER_ID` 指定的容器执行用户换取 Token。它不代表网页登录者。平台地址、服务凭证和项目工作空间沿用运行时配置。
|
|
14
|
-
多用户请求可将当前使用者 Token 通过标准输入传入,不将 Token 放在命令行参数中:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
licos-platform user me --token-stdin
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
输入不含 `Bearer ` 前缀的 Token 并结束标准输入。程序调用时可通过子进程的 `input` 参数传入。
|
|
21
|
-
|
|
22
|
-
输出为与低代码 `sys_user` 相同的 JSON:用户 ID、账号、姓名、头像、执行企业、
|
|
23
|
-
主部门、全部所属部门、组织任职、主岗位和主职务。部门含名称路径、ID 路径;
|
|
24
|
-
无部门/任职时保持 `[]`/`null`。缺少当前使用者身份或 Token 失效时返回非零退出码,
|
|
25
|
-
不改用项目所有者。Token 和内部服务凭证不回显。
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
## 身份选择(0.6.0 起)
|
|
29
|
-
|
|
30
|
-
`user me`、`knowledge enterprise …`、`ontology …` 均支持 `--token-stdin`。HTTP 服务调用这些命令时必须从标准输入传本次网页登录 Token;独立 CLI 不传此选项时按 `LICOS_CURRENT_USER_ID` 换 Token,缺少该变量则报错。
|
|
31
|
-
|
|
32
|
-
普通 `knowledge …` 命令默认使用项目身份,`--token-stdin` 可显式按调用用户授权。数据库、存储和 OAuth 应用管理仍使用项目身份。空 Token、失效 Token 不切换身份。完整接口分类见仓库 `tools/IDENTITY.md`。
|
|
File without changes
|
|
File without changes
|
{licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/database_commands.py
RENAMED
|
File without changes
|
{licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/help_commands.py
RENAMED
|
File without changes
|
|
File without changes
|
{licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/knowledge_commands.py
RENAMED
|
File without changes
|
|
File without changes
|
{licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/oauth_commands.py
RENAMED
|
File without changes
|
{licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/ontology_commands.py
RENAMED
|
File without changes
|
|
File without changes
|
{licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/storage_commands.py
RENAMED
|
File without changes
|
{licos_platform_cli-0.6.0 → licos_platform_cli-0.6.2}/src/licos_platform_cli/user_commands.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|