licos-platform-cli 0.4.4__tar.gz → 0.4.6__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.

Potentially problematic release.


This version of licos-platform-cli might be problematic. Click here for more details.

@@ -1,7 +1,6 @@
1
1
  # Rust
2
2
  /target/
3
3
  **/*.rs.bk
4
- Cargo.lock
5
4
 
6
5
  # Node
7
6
  node_modules/
@@ -61,3 +60,4 @@ logs
61
60
  source
62
61
 
63
62
  平台API
63
+ 云端环境
@@ -0,0 +1,6 @@
1
+ Metadata-Version: 2.5
2
+ Name: licos-platform-cli
3
+ Version: 0.4.6
4
+ Summary: LICOS platform CLI
5
+ Requires-Python: >=3.10
6
+ Requires-Dist: licos-platform-sdk>=0.5.4
@@ -4,11 +4,11 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "licos-platform-cli"
7
- version = "0.4.4"
7
+ version = "0.4.6"
8
8
  description = "LICOS platform CLI"
9
9
  requires-python = ">=3.10"
10
10
  dependencies = [
11
- "licos-platform-sdk>=0.5.2",
11
+ "licos-platform-sdk>=0.5.4",
12
12
  ]
13
13
 
14
14
  [project.scripts]
@@ -806,127 +806,42 @@ PROJECT_CONFIG_HELP = {
806
806
  }
807
807
 
808
808
 
809
- UNS_HELP = {
810
- "topic": "uns",
811
- "description": "Tenant-isolated UNS directory modeling, provisioning, and runtime access.",
812
- "runtime": RUNTIME_ENV,
809
+ ONTOLOGY_HELP = {
810
+ "topic": "ontology",
811
+ "description": "Authorized ontology and Data Factory tools discovered from the external AI tool catalog.",
812
+ "runtime": RUNTIME_ENV + [
813
+ {"name": "LICOS_PLATFORM_PUBLIC_BASE_URL", "required": True, "description": "Public AIOS Web Gateway base URL; ontology requests use its /ontology-api route."},
814
+ ],
813
815
  "rules": [
814
- "Isolation follows the tenant UNS directory hierarchy; projectId and workspaceId are not UNS isolation keys.",
815
- "Fetch schema and capabilities before generating a provisioning document; capabilities are the source of truth for supported protocols, data types, video options, and limits.",
816
- "Use the standard sequence: schema -> capabilities -> validate -> plan -> submit -> wait -> operations.",
817
- "validate and plan inspect the request. submit creates an asynchronous job; the terminal job status contains the result.",
818
- "Use nodes, templates, and labels for direct tenant directory maintenance. Delete commands require explicit --confirm.",
819
- "IoT source queries provide collectors, points, latest values, and video stream options.",
820
- "Realtime returns a platform WebSocket URL containing a short-lived ticket.",
816
+ "Search the catalog before invoking a tool; the catalog is filtered by the current user's permissions.",
817
+ "Resolve elements by stable IDs before querying context, model checks, or mapped data.",
818
+ "READ tools query state, PREPARE tools validate a change draft, and PERSIST tools apply an explicitly confirmed draft.",
819
+ "PERSIST commands require --confirm. Never reuse a catalog result after its catalogVersion changes.",
821
820
  ],
822
821
  "sdk": {
823
- "python": "from licos_platform_sdk import uns\ndoc = {...}\nuns.validate(doc)\nuns.plan(doc)\ncreated = uns.submit(doc)\nresult = uns.wait_job(created['jobId'])",
824
- "node": "import { uns } from '@kmlckj/licos-platform-sdk';\nconst created = await uns.submit(document);\nconst result = await uns.waitJob(created.jobId);",
822
+ "python": "from licos_platform_sdk import ontology\ncatalog = ontology.search_tools('查询设备实时数据')\nselected = catalog['items'][0]\n# 按 selected['definition']['function']['parameters'] 构造 arguments 后调用 selected 中的精确函数名。",
823
+ "node": "import { ontology } from '@kmlckj/licos-platform-sdk';\nconst catalog = await ontology.searchTools('查询设备实时数据');\nconst selected = catalog.items[0];\n// 按 selected.definition.function.parameters 构造 arguments 后调用 selected 中的精确函数名。",
825
824
  },
826
825
  "commands": {
827
- "schema": {"description": "Get the provisioning JSON Schema.", "parameters": [], "example": "licos-platform uns schema"},
828
- "capabilities": {"description": "Get supported IoT/video capabilities and tenant limits.", "parameters": [], "example": "licos-platform uns capabilities"},
829
- "validate": {"description": "Validate and normalize a provisioning document without writes.", "parameters": [{"name": "--file", "required": True, "description": "AIOS_IOT_UNS_PROVISIONING JSON file."}], "example": "licos-platform uns validate --file UNS.provisioning.json"},
830
- "plan": {"description": "Build a read-only provisioning plan.", "parameters": [{"name": "--file", "required": True, "description": "Validated provisioning JSON file."}], "example": "licos-platform uns plan --file UNS.provisioning.json"},
831
- "submit": {"description": "Submit an asynchronous provisioning job.", "parameters": [{"name": "--file", "required": True, "description": "The exact planned provisioning JSON file."}, {"name": "--idempotency-key", "required": False, "description": "Stable caller-generated key used to safely retry the same submission."}], "example": "licos-platform uns submit --file UNS.provisioning.json --idempotency-key <stable-key>"},
832
- "job": {"description": "Get one provisioning job status.", "parameters": [{"name": "job_id", "required": True, "description": "Job ID returned by submit."}], "example": "licos-platform uns job <jobId>"},
833
- "operations": {"description": "List all operations and errors for a provisioning job.", "parameters": [{"name": "job_id", "required": True, "description": "Provisioning job ID."}], "example": "licos-platform uns operations <jobId>"},
834
- "wait": {"description": "Wait for a provisioning job terminal status.", "parameters": [{"name": "job_id", "required": True, "description": "Provisioning job ID."}, {"name": "--timeout", "required": False, "description": "Maximum seconds, default 600."}, {"name": "--interval", "required": False, "description": "Poll interval seconds, default 1.5."}], "example": "licos-platform uns wait <jobId>"},
835
- "nodes": {"description": "List the tenant UNS directory tree.", "parameters": [], "example": "licos-platform uns nodes"},
836
- "node-get": {"description": "Get one UNS node by its exact ID.", "parameters": [{"name": "node_id", "type": "string", "required": True, "description": "UNS node ID."}], "example": "licos-platform uns node-get <nodeId>"},
837
- "node-children": {"description": "List direct or recursive children of one UNS directory.", "parameters": [{"name": "node_id", "type": "string", "required": True, "description": "Parent UNS node ID."}, {"name": "--recursive", "type": "flag", "required": False, "description": "Include all descendants instead of direct children only."}, {"name": "--kind", "type": "enum", "required": False, "values": ["FOLDER", "FILE"], "description": "Optionally return only folders or files."}], "example": "licos-platform uns node-children <nodeId> --recursive --kind FILE"},
838
- "node-create": {"description": "Create one directory or file node.", "parameters": [{"name": "--json", "required": True, "description": "Node request JSON object."}], "example": "licos-platform uns node-create --json <node-json>"},
839
- "node-batch-create": {"description": "Batch create directory/file nodes.", "parameters": [{"name": "--file", "required": True, "description": "JSON array or {nodes:[...]} file."}], "example": "licos-platform uns node-batch-create --file nodes.json"},
840
- "node-copy": {"description": "Copy one node under an optional target directory.", "parameters": [{"name": "node_id", "required": True, "description": "Source node ID."}, {"name": "--parent-id", "required": False, "description": "Target parent node ID; omit for root."}], "example": "licos-platform uns node-copy <nodeId> --parent-id <parentId>"},
841
- "node-update": {"description": "Update one node with a structured request.", "parameters": [{"name": "node_id", "required": True, "description": "Node ID."}, {"name": "--json", "required": True, "description": "Node update JSON object."}], "example": "licos-platform uns node-update <nodeId> --json <node-json>"},
842
- "node-delete": {"description": "Delete one node after explicit confirmation.", "parameters": [{"name": "node_id", "required": True, "description": "Node ID."}, {"name": "--confirm", "required": True, "description": "Confirm deletion."}], "example": "licos-platform uns node-delete <nodeId> --confirm"},
843
- "templates": {"description": "List UNS templates.", "parameters": [], "example": "licos-platform uns templates"},
844
- "template-get": {"description": "Get one UNS template by its exact ID.", "parameters": [{"name": "template_id", "type": "string", "required": True, "description": "UNS template ID."}], "example": "licos-platform uns template-get <templateId>"},
845
- "template-nodes": {"description": "List UNS nodes that use one template.", "parameters": [{"name": "template_id", "type": "string", "required": True, "description": "UNS template ID."}], "example": "licos-platform uns template-nodes <templateId>"},
846
- "template-create": {"description": "Create an UNS template.", "parameters": [{"name": "--json", "required": True, "description": "Template JSON object."}], "example": "licos-platform uns template-create --json '{...}'"},
847
- "template-update": {"description": "Update an UNS template.", "parameters": [{"name": "template_id", "required": True, "description": "Template ID."}, {"name": "--json", "required": True, "description": "Template JSON object."}], "example": "licos-platform uns template-update <id> --json '{...}'"},
848
- "template-delete": {"description": "Delete an UNS template after confirmation.", "parameters": [{"name": "template_id", "required": True, "description": "Template ID."}, {"name": "--confirm", "required": True, "description": "Confirm deletion."}], "example": "licos-platform uns template-delete <id> --confirm"},
849
- "labels": {"description": "List UNS labels.", "parameters": [], "example": "licos-platform uns labels"},
850
- "label-get": {"description": "Get one UNS label by its exact ID.", "parameters": [{"name": "label_id", "type": "string", "required": True, "description": "UNS label ID."}], "example": "licos-platform uns label-get <labelId>"},
851
- "label-node-list": {"description": "List UNS nodes assigned to one label.", "parameters": [{"name": "label_id", "type": "string", "required": True, "description": "UNS label ID."}], "example": "licos-platform uns label-node-list <labelId>"},
852
- "label-create": {"description": "Create an UNS label.", "parameters": [{"name": "--json", "required": True, "description": "Label JSON object."}], "example": "licos-platform uns label-create --json '{...}'"},
853
- "label-update": {"description": "Update an UNS label.", "parameters": [{"name": "label_id", "required": True, "description": "Label ID."}, {"name": "--json", "required": True, "description": "Label JSON object."}], "example": "licos-platform uns label-update <id> --json '{...}'"},
854
- "label-nodes": {"description": "Replace all nodes assigned to one label.", "parameters": [{"name": "label_id", "required": True, "description": "Label ID."}, {"name": "--node-ids-json", "required": True, "description": "JSON string array of node IDs."}], "example": "licos-platform uns label-nodes <id> --node-ids-json <node-id-array>"},
855
- "label-delete": {"description": "Delete an UNS label after confirmation.", "parameters": [{"name": "label_id", "required": True, "description": "Label ID."}, {"name": "--confirm", "required": True, "description": "Confirm deletion."}], "example": "licos-platform uns label-delete <id> --confirm"},
856
- "node-schema": {"description": "Get the JSON Schema for a folder, file, template, or label.", "parameters": [{"name": "schema_type", "required": True, "description": "folder, file, template, or label."}], "example": "licos-platform uns node-schema file"},
857
- "infer-definition": {"description": "Infer UNS definition fields from a JSON sample.", "parameters": [{"name": "--sample / --file", "required": True, "description": "Inline JSON sample text or a UTF-8 JSON sample file."}], "example": "licos-platform uns infer-definition --file sample.json"},
858
- "reverse-datasources": {"description": "List data sources available for reverse modeling.", "parameters": [], "example": "licos-platform uns reverse-datasources"},
859
- "reverse-schemas": {"description": "List database schemas available for reverse modeling.", "parameters": [], "example": "licos-platform uns reverse-schemas"},
860
- "reverse-tables": {"description": "List reverse-modeling tables in one schema.", "parameters": [{"name": "schema", "required": True, "description": "Database schema name."}], "example": "licos-platform uns reverse-tables public"},
861
- "reverse-fields": {"description": "List reverse-modeling field metadata for one table.", "parameters": [{"name": "schema", "required": True, "description": "Database schema name."}, {"name": "table", "required": True, "description": "Database table name."}], "example": "licos-platform uns reverse-fields public equipment"},
862
- "attachments": {"description": "List attachments on one UNS node.", "parameters": [{"name": "node_id", "required": True, "description": "UNS node ID."}], "example": "licos-platform uns attachments <nodeId>"},
863
- "attachment-upload": {"description": "Upload one or more local files to a UNS node.", "parameters": [{"name": "node_id", "required": True, "description": "UNS node ID."}, {"name": "files", "required": True, "description": "One or more local file paths."}], "example": "licos-platform uns attachment-upload <nodeId> report.pdf image.png"},
864
- "attachment-download": {"description": "Download one UNS node attachment to a local file.", "parameters": [{"name": "node_id", "required": True, "description": "UNS node ID."}, {"name": "attachment_id", "required": True, "description": "Attachment ID."}, {"name": "--output", "required": True, "description": "Local output path."}], "example": "licos-platform uns attachment-download <nodeId> <attachmentId> --output report.pdf"},
865
- "attachment-delete": {"description": "Delete one UNS node attachment after confirmation.", "parameters": [{"name": "node_id", "required": True, "description": "UNS node ID."}, {"name": "attachment_id", "required": True, "description": "Attachment ID."}, {"name": "--confirm", "required": True, "description": "Confirm deletion."}], "example": "licos-platform uns attachment-delete <nodeId> <attachmentId> --confirm"},
866
- "latest": {"description": "Read one UNS node latest runtime value.", "parameters": [{"name": "node_id", "required": True, "description": "UNS node ID."}], "example": "licos-platform uns latest <nodeId>"},
867
- "history": {"description": "Read one UNS node runtime history.", "parameters": [{"name": "node_id", "required": True, "description": "UNS node ID."}, {"name": "--limit", "required": False, "description": "Maximum records, default 100."}], "example": "licos-platform uns history <nodeId> --limit 100"},
868
- "realtime-config": {"description": "Issue a one-time ticket and return the platform WebSocket URL.", "parameters": [], "example": "licos-platform uns realtime-config"},
869
- "collectors": {"description": "List point collectors or video devices.", "parameters": [{"name": "--source-type", "required": True, "description": "IOT_POINT_COLLECTOR or IOT_VIDEO_DEVICE_COLLECTOR."}, {"name": "--page / --page-size", "required": False, "description": "Pagination."}], "example": "licos-platform uns collectors --source-type IOT_POINT_COLLECTOR"},
870
- "points": {"description": "List collection points or video channels.", "parameters": [{"name": "task_id", "required": True, "description": "Collector task or video device ID."}, {"name": "--source-type", "required": True, "description": "Source type."}], "example": "licos-platform uns points <taskId> --source-type IOT_POINT_COLLECTOR"},
871
- "source-latest": {"description": "Read one upstream collection point latest value.", "parameters": [{"name": "task_id", "required": True, "description": "Collector task ID."}, {"name": "point_id", "required": True, "description": "Point ID."}, {"name": "--tag-code / --node-id", "required": False, "description": "Optional business correlation."}], "example": "licos-platform uns source-latest <taskId> <pointId>"},
872
- "video-stream": {"description": "Get supported playback options for one video channel.", "parameters": [{"name": "channel_id", "required": True, "description": "Video channel ID."}], "example": "licos-platform uns video-stream <channelId>"},
873
- },
874
- }
875
-
876
-
877
- INDUSTRIAL_HELP = {
878
- "topic": "industrial",
879
- "description": (
880
- "Maintain collection tasks, points, values, video devices and channels through the "
881
- "platform UNS industrial runtime gateway."
882
- ),
883
- "runtime": RUNTIME_ENV,
884
- "rules": [
885
- "Use uns schema/capabilities/validate/plan/submit for first-time connection, task, point, video, and UNS provisioning.",
886
- "Use industrial commands after provisioning to inspect or modify an existing resource and to read/write/control runtime data.",
887
- "Before an update, read the current resource and preserve fields that are not intentionally changed.",
888
- "Point write and PTZ commands are side effects: identify the exact target, verify access/capabilities, execute once, and read back the result.",
889
- "Use --payload or --payload-file for request bodies and --query for platform-supported query filters; every value is a JSON object.",
890
- "Delete commands require --confirm.",
891
- ],
892
- "commands": {
893
- "collectors": {"description": "List point collectors or video devices.", "parameters": [{"name": "--source-type", "required": True, "description": "IOT_POINT_COLLECTOR or IOT_VIDEO_DEVICE_COLLECTOR."}], "example": "licos-platform industrial collectors --source-type IOT_POINT_COLLECTOR"},
894
- "points": {"description": "List task points or device video channels.", "parameters": [{"name": "task_id", "required": True, "description": "Task or device ID."}, {"name": "--source-type", "required": True, "description": "Source type."}], "example": "licos-platform industrial points <taskId> --source-type IOT_POINT_COLLECTOR"},
895
- "latest": {"description": "Read one upstream point latest value.", "parameters": [{"name": "task_id", "required": True, "description": "Collector task ID."}, {"name": "point_id", "required": True, "description": "Point ID."}, {"name": "--tag-code / --node-id", "required": False, "description": "Optional business correlation."}], "example": "licos-platform industrial latest <taskId> <pointId>"},
896
- "video-stream": {"description": "Get playback options for one video channel.", "parameters": [{"name": "channel_id", "required": True, "description": "Video channel ID."}], "example": "licos-platform industrial video-stream <channelId>"},
897
- "connections": {"description": "List saved protocol connections.", "parameters": [{"name": "--query", "type": "JSON object", "required": False, "description": "Platform-supported filters such as keyword, protocol, enabled, page, and pageSize."}], "example": "licos-platform industrial connections --query '{\"protocol\":\"modbus-tcp\"}'"},
898
- "connection": {"description": "Get one saved protocol connection.", "parameters": [{"name": "connection_id", "type": "string", "required": True, "description": "Existing connection ID."}], "example": "licos-platform industrial connection <connectionId>"},
899
- "connection-update": {"description": "Update one saved protocol connection.", "parameters": [{"name": "connection_id", "type": "string", "required": True, "description": "Existing connection ID."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": True, "description": "Complete connection object after merging intended changes into the current resource; protocol-specific config follows the current platform schema."}], "example": "licos-platform industrial connection-update <connectionId> --payload-file connection.json"},
900
- "connection-test": {"description": "Test one saved protocol connection.", "parameters": [{"name": "connection_id", "type": "string", "required": True, "description": "Existing connection ID."}], "example": "licos-platform industrial connection-test <connectionId>"},
901
- "connection-delete": {"description": "Delete one saved protocol connection.", "parameters": [{"name": "connection_id", "type": "string", "required": True, "description": "Existing connection ID."}, {"name": "--confirm", "type": "flag", "required": True, "description": "Explicit destructive-operation confirmation after checking dependent tasks."}], "example": "licos-platform industrial connection-delete <connectionId> --confirm"},
902
- "tasks": {"description": "List collection tasks.", "parameters": [{"name": "--query", "type": "JSON object", "required": False, "description": "Filters such as keyword, protocol, desiredState, runtimeState, page, and pageSize."}], "example": "licos-platform industrial tasks --query '{\"runtimeState\":\"running\"}'"},
903
- "task": {"description": "Get one collection task.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Existing task ID."}], "example": "licos-platform industrial task <taskId>"},
904
- "task-status": {"description": "Get one task desired/runtime status.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Existing task ID."}], "example": "licos-platform industrial task-status <taskId>"},
905
- "task-update": {"description": "Update one existing collection task.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Existing task ID."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": True, "description": "Task fields such as name, protocol, connectionId, desiredState, schedule, and config."}], "example": "licos-platform industrial task-update <taskId> --payload-file task.json"},
906
- "task-action": {"description": "Start, stop, restart, or run one task once.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Existing task ID."}, {"name": "action", "type": "enum", "required": True, "values": ["start", "stop", "restart", "run-once"], "description": "Lifecycle action."}], "example": "licos-platform industrial task-action <taskId> restart"},
907
- "task-delete": {"description": "Delete one collection task.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Existing task ID."}, {"name": "--confirm", "type": "flag", "required": True, "description": "Explicit destructive-operation confirmation."}], "example": "licos-platform industrial task-delete <taskId> --confirm"},
908
- "task-points": {"description": "List points belonging to one task.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Existing task ID."}, {"name": "--query", "type": "JSON object", "required": False, "description": "Filters such as keyword, tagCode, dataType, enabled, page, and pageSize."}], "example": "licos-platform industrial task-points <taskId> --query '{\"enabled\":true}'"},
909
- "point": {"description": "Get one collection point.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Parent task ID."}, {"name": "point_id", "type": "string", "required": True, "description": "Existing point ID."}], "example": "licos-platform industrial point <taskId> <pointId>"},
910
- "point-update": {"description": "Update one existing collection point.", "parameters": [{"name": "task_id / point_id", "type": "string", "required": True, "description": "Parent task ID and point ID."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": True, "description": "Point fields including tagCode, name, protocolAddress, dataType, accessMode, pollIntervalMs, unit, enabled, and metadata."}], "example": "licos-platform industrial point-update <taskId> <pointId> --payload-file point.json"},
911
- "point-validate": {"description": "Validate point definitions without saving.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Parent task ID."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": True, "description": "Platform validation request."}], "example": "licos-platform industrial point-validate <taskId> --payload-file points.json"},
912
- "point-test-read": {"description": "Read selected point definitions once without changing the task.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Parent task ID."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": True, "description": "Platform test-read request."}], "example": "licos-platform industrial point-test-read <taskId> --payload-file points.json"},
913
- "point-write": {"description": "Write explicitly selected writable points.", "parameters": [{"name": "task_id", "type": "string", "required": True, "description": "Parent task ID."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": True, "description": "Platform point write request; only target points with write access."}], "example": "licos-platform industrial point-write <taskId> --payload-file write.json"},
914
- "point-delete": {"description": "Delete one collection point.", "parameters": [{"name": "task_id / point_id", "type": "string", "required": True, "description": "Parent task ID and point ID."}, {"name": "--confirm", "type": "flag", "required": True, "description": "Explicit destructive-operation confirmation."}], "example": "licos-platform industrial point-delete <taskId> <pointId> --confirm"},
915
- "values-latest": {"description": "Read the cloud-side latest sample snapshot.", "parameters": [{"name": "--task-id / --point-id / --tag-code", "type": "string", "required": False, "description": "Optional selectors; combine only identifiers for the same target."}], "example": "licos-platform industrial values-latest --point-id <pointId>"},
916
- "values-history": {"description": "Read persisted point history.", "parameters": [{"name": "--task-id / --point-id / --tag-code", "type": "string", "required": False, "description": "Optional target selectors."}, {"name": "--start-time / --end-time", "type": "RFC3339 string", "required": False, "description": "History time range."}, {"name": "--page / --page-size", "type": "integer", "required": False, "description": "Pagination; defaults to 1 and 100."}], "example": "licos-platform industrial values-history --point-id <pointId> --start-time 2026-07-24T00:00:00Z"},
917
- "values-direct-read": {"description": "Read a current point value through its online edge channel.", "parameters": [{"name": "--payload / --payload-file", "type": "JSON object", "required": True, "description": "taskId and pointId are required; agentId and tagCode are optional consistency checks."}], "example": "licos-platform industrial values-direct-read --payload '{\"taskId\":\"task\",\"pointId\":\"point\"}'"},
918
- "video-devices": {"description": "List video devices.", "parameters": [{"name": "--query", "type": "JSON object", "required": False, "description": "Filters such as keyword, ingestProtocol, onlineStatus, page, and pageSize."}], "example": "licos-platform industrial video-devices --query '{\"onlineStatus\":\"online\"}'"},
919
- "video-device": {"description": "Get one video device.", "parameters": [{"name": "device_id", "type": "string", "required": True, "description": "Existing video device ID."}], "example": "licos-platform industrial video-device <deviceId>"},
920
- "video-device-update": {"description": "Update one existing video device.", "parameters": [{"name": "device_id", "type": "string", "required": True, "description": "Existing device ID."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": True, "description": "Device fields defined by the current platform contract."}], "example": "licos-platform industrial video-device-update <deviceId> --payload-file device.json"},
921
- "video-device-action": {"description": "Test, enable/disable, or synchronize one video device.", "parameters": [{"name": "device_id", "type": "string", "required": True, "description": "Existing device ID."}, {"name": "action", "type": "enum", "required": True, "values": ["test-connection", "toggle-enabled", "sync-channels"], "description": "Device action."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": False, "description": "Action-specific request body."}], "example": "licos-platform industrial video-device-action <deviceId> test-connection"},
922
- "video-device-delete": {"description": "Delete one video device.", "parameters": [{"name": "device_id", "type": "string", "required": True, "description": "Existing device ID."}, {"name": "--confirm", "type": "flag", "required": True, "description": "Explicit destructive-operation confirmation."}], "example": "licos-platform industrial video-device-delete <deviceId> --confirm"},
923
- "video-channels": {"description": "List video channels.", "parameters": [{"name": "--query", "type": "JSON object", "required": False, "description": "Filters such as deviceId, streamType, ptzSupported, enabled, page, and pageSize."}], "example": "licos-platform industrial video-channels --query '{\"deviceId\":\"device\"}'"},
924
- "video-channel": {"description": "Get one video channel.", "parameters": [{"name": "channel_id", "type": "string", "required": True, "description": "Existing video channel ID."}], "example": "licos-platform industrial video-channel <channelId>"},
925
- "video-channel-update": {"description": "Update one existing video channel.", "parameters": [{"name": "channel_id", "type": "string", "required": True, "description": "Existing channel ID."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": True, "description": "Channel fields defined by the current platform contract."}], "example": "licos-platform industrial video-channel-update <channelId> --payload-file channel.json"},
926
- "video-channel-delete": {"description": "Delete one video channel.", "parameters": [{"name": "channel_id", "type": "string", "required": True, "description": "Existing channel ID."}, {"name": "--confirm", "type": "flag", "required": True, "description": "Explicit destructive-operation confirmation."}], "example": "licos-platform industrial video-channel-delete <channelId> --confirm"},
927
- "video-capabilities": {"description": "Get playback, PTZ, and preset capabilities.", "parameters": [{"name": "channel_id", "type": "string", "required": True, "description": "Existing channel ID."}], "example": "licos-platform industrial video-capabilities <channelId>"},
928
- "video-snapshot": {"description": "Create one video snapshot.", "parameters": [{"name": "channel_id", "type": "string", "required": True, "description": "Existing channel ID."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": False, "description": "Optional snapshot options."}], "example": "licos-platform industrial video-snapshot <channelId>"},
929
- "video-ptz": {"description": "Move/stop PTZ or set/go to a preset.", "parameters": [{"name": "channel_id", "type": "string", "required": True, "description": "Existing channel ID."}, {"name": "action", "type": "enum", "required": True, "values": ["move", "stop", "preset/set", "preset/goto"], "description": "PTZ action."}, {"name": "--payload / --payload-file", "type": "JSON object", "required": False, "description": "Action payload, for example direction/speed/durationMs or presetId/presetName."}], "example": "licos-platform industrial video-ptz <channelId> move --payload '{\"direction\":\"left\",\"speed\":30,\"durationMs\":1000}'"},
826
+ "search": {
827
+ "description": "Search the current user's ontology AI tool catalog.",
828
+ "parameters": [
829
+ {"name": "query", "required": True, "description": "Natural-language capability query."},
830
+ {"name": "--limit", "required": False, "description": "Result count from 1 to 10; default 5."},
831
+ {"name": "--offset", "required": False, "description": "Catalog result offset."},
832
+ ],
833
+ "example": "licos-platform ontology search '查询设备实时数据' --limit 5",
834
+ },
835
+ "invoke": {
836
+ "description": "Resolve an exact catalog function name and invoke it with structured arguments.",
837
+ "parameters": [
838
+ {"name": "name", "required": True, "description": "Exact function name returned by search."},
839
+ {"name": "--arguments / --arguments-file", "required": True, "description": "Tool arguments as a JSON object."},
840
+ {"name": "--catalog-version", "required": False, "description": "catalogVersion returned by the search that supplied the function schema."},
841
+ {"name": "--confirm", "required": False, "description": "Required for PERSIST tools."},
842
+ ],
843
+ "example": "licos-platform ontology invoke <精确函数名> --catalog-version <版本> --arguments '{\"参数名\":\"参数值\"}'",
844
+ },
930
845
  },
931
846
  }
932
847
 
@@ -936,9 +851,8 @@ HELP_TOPICS = {
936
851
  "database": DATABASE_HELP,
937
852
  "knowledge": KNOWLEDGE_HELP,
938
853
  "oauth": OAUTH_HELP,
939
- "project-config": PROJECT_CONFIG_HELP,
940
- "industrial": INDUSTRIAL_HELP,
941
- "uns": UNS_HELP,
854
+ "project-config": PROJECT_CONFIG_HELP,
855
+ "ontology": ONTOLOGY_HELP,
942
856
  }
943
857
 
944
858
 
@@ -962,8 +876,8 @@ def _cmd_help(args: argparse.Namespace) -> dict[str, Any]:
962
876
  "licos-platform help oauth",
963
877
  "licos-platform help oauth configure-project",
964
878
  "licos-platform help project-config set-database",
965
- "licos-platform help uns",
966
- "licos-platform help uns capabilities",
879
+ "licos-platform help ontology",
880
+ "licos-platform help ontology search",
967
881
  ],
968
882
  "topics": sorted(HELP_TOPICS),
969
883
  }
@@ -9,12 +9,11 @@ from licos_platform_sdk import PlatformSdkError
9
9
 
10
10
  from .database_commands import add_database_parser
11
11
  from .help_commands import add_help_parser
12
- from .industrial_commands import add_industrial_parser
13
12
  from .knowledge_commands import add_knowledge_parser
14
13
  from .oauth_commands import add_oauth_parser
14
+ from .ontology_commands import add_ontology_parser
15
15
  from .project_config_commands import add_project_config_parser
16
16
  from .storage_commands import add_storage_parser
17
- from .uns_commands import add_uns_parser
18
17
 
19
18
 
20
19
  def _print_json(value: Any) -> None:
@@ -38,8 +37,7 @@ def _build_parser() -> argparse.ArgumentParser:
38
37
  add_knowledge_parser(subparsers)
39
38
  add_oauth_parser(subparsers)
40
39
  add_project_config_parser(subparsers)
41
- add_uns_parser(subparsers)
42
- add_industrial_parser(subparsers)
40
+ add_ontology_parser(subparsers)
43
41
  return parser
44
42
 
45
43
 
@@ -0,0 +1,77 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import json
5
+ from pathlib import Path
6
+ from typing import Any, Callable
7
+
8
+ from licos_platform_sdk import ontology
9
+
10
+
11
+ Handler = Callable[[argparse.Namespace], Any]
12
+
13
+
14
+ def _set_handler(parser: argparse.ArgumentParser, handler: Handler) -> None:
15
+ parser.set_defaults(handler=handler)
16
+
17
+
18
+ def _arguments(args: argparse.Namespace) -> dict[str, Any]:
19
+ raw = args.arguments
20
+ if args.arguments_file:
21
+ raw = Path(args.arguments_file).read_text(encoding="utf-8")
22
+ try:
23
+ value = json.loads(raw)
24
+ except json.JSONDecodeError as exc:
25
+ raise argparse.ArgumentTypeError(f"arguments must be valid JSON: {exc.msg}") from exc
26
+ if not isinstance(value, dict):
27
+ raise argparse.ArgumentTypeError("arguments must be a JSON object")
28
+ return value
29
+
30
+
31
+ def _cmd_search(args: argparse.Namespace) -> Any:
32
+ return ontology.search_tools(args.query, limit=args.limit, offset=args.offset)
33
+
34
+
35
+ def _cmd_invoke(args: argparse.Namespace) -> Any:
36
+ catalog_version, item = ontology.resolve_tool(args.name)
37
+ if args.catalog_version and args.catalog_version != catalog_version:
38
+ raise argparse.ArgumentTypeError(
39
+ "ontology tool catalog changed; search again before invoking the tool"
40
+ )
41
+ if item["mode"] == "PERSIST" and not args.confirm:
42
+ raise argparse.ArgumentTypeError(
43
+ f"ontology tool {args.name!r} persists changes; invoke it again with --confirm"
44
+ )
45
+ return ontology.invoke_tool(
46
+ args.name,
47
+ _arguments(args),
48
+ catalog_version=catalog_version,
49
+ )
50
+
51
+
52
+ def add_ontology_parser(
53
+ subparsers: argparse._SubParsersAction[argparse.ArgumentParser],
54
+ ) -> None:
55
+ parser = subparsers.add_parser(
56
+ "ontology",
57
+ help="Discover and invoke authorized ontology and Data Factory AI tools",
58
+ )
59
+ commands = parser.add_subparsers(dest="ontology_command", required=True)
60
+
61
+ search = commands.add_parser("search", help="Search the authorized AI tool catalog")
62
+ search.add_argument("query")
63
+ search.add_argument("--limit", type=int, default=5, choices=range(1, 11))
64
+ search.add_argument("--offset", type=int, default=0)
65
+ _set_handler(search, _cmd_search)
66
+
67
+ invoke = commands.add_parser("invoke", help="Resolve and invoke one catalog tool")
68
+ invoke.add_argument("name")
69
+ source = invoke.add_mutually_exclusive_group(required=True)
70
+ source.add_argument("--arguments", help="Inline JSON object with tool arguments")
71
+ source.add_argument("--arguments-file", help="UTF-8 JSON object file")
72
+ invoke.add_argument(
73
+ "--catalog-version",
74
+ help="catalogVersion returned by the search that supplied the function schema",
75
+ )
76
+ invoke.add_argument("--confirm", action="store_true")
77
+ _set_handler(invoke, _cmd_invoke)