Skip to main content

licos-platform-cli

LICOS 平台命令行工具。licos-platform help 返回结构化 JSON 帮助。

当前使用者(0.5.1 起)

licos-platform user me
licos-platform user me --workspace-id <执行工作空间ID>
licos-platform help user me

用户接口默认使用 LICOS_CURRENT_USER_ID 指定的容器执行用户换取 Token。它不代表网页登录者。平台地址、服务凭证和项目工作空间沿用运行时配置。 运行时使用 AGENT_CURRENT_USER_ID 注入当前用户时同样支持,不以项目负责人替代当前执行用户。企业和空间上下文沿用平台签发的认证结果。 多用户请求可将当前使用者 Token 通过标准输入传入,不将 Token 放在命令行参数中:

licos-platform user me --token-stdin

输入不含 Bearer 前缀的 Token 并结束标准输入。程序调用时可通过子进程的 input 参数传入。

输出为与低代码 sys_user 相同的 JSON:用户 ID、账号、姓名、头像、执行企业、 主部门、全部所属部门、组织任职、主岗位和主职务。部门含名称路径、ID 路径; 无部门/任职时保持 []/null。缺少当前使用者身份或 Token 失效时返回非零退出码, 不改用项目所有者。Token 和内部服务凭证不回显。

身份选择(0.6.0 起)

LICOS_CURRENT_USER_ID 表示容器启动时配置的执行用户,项目身份指运行时配置的项目所有者身份。不同命令的默认身份如下:

命令 默认身份 网页登录用户执行
user me 按 LICOS_CURRENT_USER_ID 换 Token 使用 --token-stdin
knowledge enterprise … 按 LICOS_CURRENT_USER_ID 换 Token 使用 --token-stdin,企业范围和权限由平台认证结果确定
所有 ontology 命令 按 LICOS_CURRENT_USER_ID 换 Token 使用 --token-stdin
普通 knowledge … 项目身份 需要用户权限时使用 --token-stdin
数据库、对象存储、OAuth 应用管理 项目身份 保持项目身份

用户操作未传 --token-stdin 时,用 LICOS_CURRENT_USER_ID 和运行时服务凭证换 Token;缺少执行用户配置则报错。--token-stdin 优先使用标准输入的 Token,空输入直接报错,不再换取其他身份。

HTTP 服务调用用户接口时,必须从本次认证会话取得 Token,并写入该子进程的标准输入;缺少 Token 时在业务入口返回登录错误。不能依赖容器默认用户,也不能把请求 Token 或用户 ID 写入共享环境变量。例如在 Python 服务中:

import subprocess

# token 来自本次请求的认证会话,不含 "Bearer " 前缀。
result = subprocess.run(
    ["licos-platform", "user", "me", "--token-stdin"],
    input=token,
    text=True,
    capture_output=True,
    check=True,
)

显式传入的 Token 鉴权失败时返回非零退出码,由调用方更新登录凭证,不切换到容器用户或项目所有者。项目所有者和工作空间等资源归属字段单独保留,不用它们冒充调用用户。

本体正式版本

0.8.0 起,ontology package/bind --root-object-id <id> 自动选择最新正式版;使用显式 release_id 固定版本。ontology resolve --configuration-file ontology.json 解析 {versionPolicy, rootObjectId, binding},省略策略保持固定版本。新运行开始解析并保存输出绑定,query/function 及恢复执行复用它,不在每次查询时重新解析。新版缺少已选对象、属性或函数时直接失败。

编程项目登录身份

  • 有内置登录时使用内置登录会话;没有内置登录时使用当前 LICOS 网页登录。内置登录未登录或过期时不能切换成平台用户。
  • Node 服务端使用 createProjectAuth({ mode: 'builtin', resolveBuiltinToken }) 或 createProjectAuth({ mode: 'platform' }),每次请求调用 await projectAuth.userToken(request)。内置解析器必须读取已有认证会话并返回用户已授权的 LICOS 凭证。
  • 无内置登录的浏览器用户接口使用 @kmlckj/licos-platform-sdk/browser 的 createProjectUserFetch:平台登录桥领取一次性票据,项目后端兑换 Token。不要直接读取跨域平台 localStorage,不在 URL 中传 Token,不修改全局 fetch。项目级 API 保持原有请求方法。
  • Python 使用 ProjectAuth;Agent/Workflow 通过 config/licos-auth.json 配置模式,内置登录设置 resolver: "模块:函数",业务代码使用 ctx.identity.user_token。
  • 当前用户、企业知识库、本体用户操作显式传 userToken/user_token。模型、积分和普通知识库按业务选择用户或项目身份。数据库、对象存储和可观测性继续使用项目身份。
  • 沿用现有 OAuth 授权范围与接口权限。凭证无权访问目标接口时返回现有鉴权错误,不扩大权限或换用其他身份。
  • 修改已有项目时先接它的现有登录机制,不能用新模板的默认平台模式覆盖。真实 Token 只存在于运行时请求/会话,不写入源代码、共享环境变量或 Agent 提示词。

Metadata

Release files for licos-platform-cli 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for licos-platform-cli 0.8.0
File Size Uploaded Provenance
licos_platform_cli-0.8.0.tar.gz 43.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for licos-platform-cli 0.8.0
File Interpreter ABI Platform
licos_platform_cli-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 85.2 kB

Release files / licos_platform_cli-0.8.0.tar.gz

Download URL licos_platform_cli-0.8.0.tar.gz
Size 43.5 kB
Tags Source
SHA-256 checksum
How to use checksums
20322ee62cf2ba7782a611e81e0578cdb6239aec0425e1e8b3e0d95ea2fdf133
BLAKE2b-256 checksum
How to use checksums
cda37acf5ab3c2dc9813e769d9131e47599eecf1c8004ff028e1786dcd0a96f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / licos_platform_cli-0.8.0-py3-none-any.whl

Download URL licos_platform_cli-0.8.0-py3-none-any.whl
Size 41.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36c700f287c20666df3da0e5a2a2a3bc15205de6fd1cf4039dbe77524f86d6a1
BLAKE2b-256 checksum
How to use checksums
beedfe369f1e642b277c01554d5a20535375679ef0b5e6d24c3c4135af3b253e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for licos-platform-cli 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page