licos-dev-cli 0.6.4__tar.gz → 0.6.5__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.
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: licos-dev-cli
3
- Version: 0.6.4
3
+ Version: 0.6.5
4
4
  Summary: LICOS Dev CLI - generate files and call model capabilities
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: click>=8.1
7
- Requires-Dist: licos-dev-sdk>=0.6.4
7
+ Requires-Dist: licos-dev-sdk>=0.6.5
8
8
  Description-Content-Type: text/markdown
9
9
 
10
10
  # licos-dev CLI
@@ -13,6 +13,8 @@ Description-Content-Type: text/markdown
13
13
 
14
14
  `LICOS_CURRENT_USER_ID` 表示容器启动时配置的执行用户,不代表网页登录者。模型目录、LLM、视觉、图片生成、视频生成、语音识别和 `credit-check` 命令支持以下身份选项:
15
15
 
16
+ 运行时以 `AGENT_CURRENT_USER_ID` 注入执行用户时同样支持,不以项目负责人替代当前执行用户。企业和空间上下文沿用平台签发的认证结果。
17
+
16
18
  | 选项 | 调用身份 |
17
19
  | --- | --- |
18
20
  | `--identity user`(默认) | 用 `LICOS_CURRENT_USER_ID` 和运行时服务凭证换取执行用户 Token |
@@ -4,6 +4,8 @@
4
4
 
5
5
  `LICOS_CURRENT_USER_ID` 表示容器启动时配置的执行用户,不代表网页登录者。模型目录、LLM、视觉、图片生成、视频生成、语音识别和 `credit-check` 命令支持以下身份选项:
6
6
 
7
+ 运行时以 `AGENT_CURRENT_USER_ID` 注入执行用户时同样支持,不以项目负责人替代当前执行用户。企业和空间上下文沿用平台签发的认证结果。
8
+
7
9
  | 选项 | 调用身份 |
8
10
  | --- | --- |
9
11
  | `--identity user`(默认) | 用 `LICOS_CURRENT_USER_ID` 和运行时服务凭证换取执行用户 Token |
@@ -1,20 +1,20 @@
1
- [build-system]
2
- requires = ["hatchling>=1.27,<1.31"]
3
- build-backend = "hatchling.build"
4
-
5
- [project]
6
- name = "licos-dev-cli"
7
- version = "0.6.4"
8
- description = "LICOS Dev CLI - generate files and call model capabilities"
9
- readme = "README.md"
10
- requires-python = ">=3.10"
11
- dependencies = [
12
- "licos-dev-sdk>=0.6.4",
13
- "click>=8.1",
14
- ]
15
-
16
- [project.scripts]
17
- licos-dev = "licos_dev_cli.main:cli"
18
-
19
- [tool.hatch.build.targets.wheel]
20
- packages = ["src/licos_dev_cli"]
1
+ [build-system]
2
+ requires = ["hatchling>=1.27,<1.31"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "licos-dev-cli"
7
+ version = "0.6.5"
8
+ description = "LICOS Dev CLI - generate files and call model capabilities"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ dependencies = [
12
+ "licos-dev-sdk>=0.6.5",
13
+ "click>=8.1",
14
+ ]
15
+
16
+ [project.scripts]
17
+ licos-dev = "licos_dev_cli.main:cli"
18
+
19
+ [tool.hatch.build.targets.wheel]
20
+ packages = ["src/licos_dev_cli"]
@@ -13,7 +13,7 @@ def identity_options(command):
13
13
  type=click.Choice(["user", "project"]),
14
14
  default="user",
15
15
  show_default=True,
16
- help="User uses LICOS_CURRENT_USER_ID; project uses project runtime credentials",
16
+ help="User uses LICOS_CURRENT_USER_ID or AGENT_CURRENT_USER_ID; project uses project runtime credentials",
17
17
  )(command)
18
18
 
19
19
 
@@ -27,9 +27,9 @@ def user_token(identity: str, token_stdin: bool) -> str | None:
27
27
  return token
28
28
  if identity == "project":
29
29
  return None
30
- user_id = os.environ.get("LICOS_CURRENT_USER_ID", "").strip()
30
+ user_id = os.environ.get("LICOS_CURRENT_USER_ID", "").strip() or os.environ.get("AGENT_CURRENT_USER_ID", "").strip()
31
31
  if not user_id:
32
- raise click.UsageError("User identity requires LICOS_CURRENT_USER_ID or --token-stdin")
32
+ raise click.UsageError("User identity requires LICOS_CURRENT_USER_ID, AGENT_CURRENT_USER_ID or --token-stdin")
33
33
  try:
34
34
  return runtime_user_token(user_id)
35
35
  except PlatformSdkError as error:
@@ -26,6 +26,15 @@ def test_credit_check_accepts_web_token_from_stdin():
26
26
  exchange.assert_not_called()
27
27
 
28
28
 
29
+ def test_agent_current_user_alias_does_not_select_the_owner():
30
+ from licos_dev_cli.identity import user_token
31
+ with mock.patch.dict("os.environ", {"AGENT_CURRENT_USER_ID":"actor", "AGENT_USER_ID":"owner"}, clear=True), mock.patch(
32
+ "licos_dev_cli.identity.runtime_user_token", return_value="actor-token"
33
+ ) as exchange:
34
+ assert user_token("user", False) == "actor-token"
35
+ exchange.assert_called_once_with("actor")
36
+
37
+
29
38
  def test_missing_cli_user_does_not_fall_back_to_owner():
30
39
  with mock.patch.dict("os.environ", {"LICOS_USER_ID": "owner"}, clear=True), mock.patch(
31
40
  "licos_dev_sdk.fetch_model_catalogs"
File without changes