licos-platform-cli 0.4.6__tar.gz → 0.4.7__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,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: licos-platform-cli
3
- Version: 0.4.6
3
+ Version: 0.4.7
4
4
  Summary: LICOS platform CLI
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: licos-platform-sdk>=0.5.4
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "licos-platform-cli"
7
- version = "0.4.6"
7
+ version = "0.4.7"
8
8
  description = "LICOS platform CLI"
9
9
  requires-python = ">=3.10"
10
10
  dependencies = [
@@ -819,8 +819,8 @@ ONTOLOGY_HELP = {
819
819
  "PERSIST commands require --confirm. Never reuse a catalog result after its catalogVersion changes.",
820
820
  ],
821
821
  "sdk": {
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 中的精确函数名。",
822
+ "python": "from licos_platform_sdk import ontology\ncatalog = ontology.search_tools('查询设备实时数据')\nselected = next((item for item in catalog['items'] if item['selection'] == 'MATCH' and item['mode'] == 'READ' and item['definition']['function']['name'] == requested_tool_name), None)\nif selected is None:\n raise RuntimeError('当前目录中没有匹配的只读本体工具')\n# 按 selected['definition']['function']['parameters'] 校验参数后调用精确函数名。",
823
+ "node": "import { ontology } from '@kmlckj/licos-platform-sdk';\nconst catalog = await ontology.searchTools('查询设备实时数据');\nconst selected = catalog.items.find((item) => item.selection === 'MATCH' && item.mode === 'READ' && item.definition.function.name === requestedToolName);\nif (!selected) throw new Error('当前目录中没有匹配的只读本体工具');\n// 按 selected.definition.function.parameters 校验参数后调用精确函数名。",
824
824
  },
825
825
  "commands": {
826
826
  "search": {
@@ -851,7 +851,7 @@ HELP_TOPICS = {
851
851
  "database": DATABASE_HELP,
852
852
  "knowledge": KNOWLEDGE_HELP,
853
853
  "oauth": OAUTH_HELP,
854
- "project-config": PROJECT_CONFIG_HELP,
854
+ "project-config": PROJECT_CONFIG_HELP,
855
855
  "ontology": ONTOLOGY_HELP,
856
856
  }
857
857
 
@@ -109,6 +109,11 @@ class PlatformCliTests(unittest.TestCase):
109
109
  self.assertEqual(payload["topic"], "ontology")
110
110
  self.assertEqual(set(payload["commands"]), {"search", "invoke"})
111
111
  self.assertTrue(any("catalogVersion" in rule for rule in payload["rules"]))
112
+ sdk_help = "\n".join(payload["sdk"].values())
113
+ self.assertNotIn("items[0]", sdk_help)
114
+ self.assertNotIn("items'][0]", sdk_help)
115
+ self.assertIn("selection", sdk_help)
116
+ self.assertIn("mode", sdk_help)
112
117
 
113
118
  def test_ontology_search_forwards_catalog_pagination(self) -> None:
114
119
  result = {"catalogVersion": "v1", "items": []}