cmdbox 0.6.3.2__py3-none-any.whl → 0.6.4.1__py3-none-any.whl

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 cmdbox might be problematic. Click here for more details.

Files changed (168) hide show
  1. cmdbox/app/app.py +22 -7
  2. cmdbox/app/common.py +9 -6
  3. cmdbox/app/commons/loghandler.py +101 -20
  4. cmdbox/app/commons/redis_client.py +1 -1
  5. cmdbox/app/edge.py +2 -4
  6. cmdbox/app/feature.py +1 -1
  7. cmdbox/app/features/cli/cmdbox_agent_mcp_client.py +175 -0
  8. cmdbox/app/features/cli/cmdbox_agent_mcp_proxy.py +96 -0
  9. cmdbox/app/features/cli/cmdbox_audit_createdb.py +224 -224
  10. cmdbox/app/features/cli/cmdbox_audit_delete.py +4 -4
  11. cmdbox/app/features/cli/cmdbox_audit_search.py +4 -4
  12. cmdbox/app/features/cli/cmdbox_audit_write.py +6 -8
  13. cmdbox/app/features/cli/cmdbox_client_file_copy.py +3 -3
  14. cmdbox/app/features/cli/cmdbox_client_file_download.py +3 -3
  15. cmdbox/app/features/cli/cmdbox_client_file_list.py +3 -3
  16. cmdbox/app/features/cli/cmdbox_client_file_mkdir.py +3 -3
  17. cmdbox/app/features/cli/cmdbox_client_file_move.py +3 -3
  18. cmdbox/app/features/cli/cmdbox_client_file_remove.py +3 -3
  19. cmdbox/app/features/cli/cmdbox_client_file_rmdir.py +3 -3
  20. cmdbox/app/features/cli/cmdbox_client_file_upload.py +3 -3
  21. cmdbox/app/features/cli/cmdbox_client_http.py +7 -6
  22. cmdbox/app/features/cli/cmdbox_client_server_info.py +4 -4
  23. cmdbox/app/features/cli/cmdbox_cmd_list.py +4 -4
  24. cmdbox/app/features/cli/cmdbox_cmd_load.py +5 -5
  25. cmdbox/app/features/cli/cmdbox_edge_config.py +1 -1
  26. cmdbox/app/features/cli/cmdbox_edge_start.py +3 -3
  27. cmdbox/app/features/cli/cmdbox_mcp_client.py +174 -174
  28. cmdbox/app/features/cli/cmdbox_mcp_proxy.py +96 -96
  29. cmdbox/app/features/cli/cmdbox_server_list.py +3 -3
  30. cmdbox/app/features/cli/cmdbox_server_start.py +103 -103
  31. cmdbox/app/features/cli/cmdbox_server_stop.py +6 -6
  32. cmdbox/app/features/cli/cmdbox_tts_install.py +317 -0
  33. cmdbox/app/features/cli/cmdbox_tts_say.py +179 -0
  34. cmdbox/app/features/cli/cmdbox_tts_start.py +329 -0
  35. cmdbox/app/features/cli/cmdbox_tts_stop.py +108 -0
  36. cmdbox/app/features/cli/cmdbox_web_apikey_add.py +91 -91
  37. cmdbox/app/features/cli/cmdbox_web_apikey_del.py +91 -91
  38. cmdbox/app/features/cli/cmdbox_web_gencert.py +7 -7
  39. cmdbox/app/features/cli/cmdbox_web_genpass.py +168 -168
  40. cmdbox/app/features/cli/cmdbox_web_group_add.py +94 -94
  41. cmdbox/app/features/cli/cmdbox_web_group_del.py +87 -87
  42. cmdbox/app/features/cli/cmdbox_web_group_edit.py +94 -94
  43. cmdbox/app/features/cli/cmdbox_web_group_list.py +87 -87
  44. cmdbox/app/features/cli/cmdbox_web_start.py +236 -235
  45. cmdbox/app/features/cli/cmdbox_web_stop.py +72 -72
  46. cmdbox/app/features/cli/cmdbox_web_user_add.py +104 -104
  47. cmdbox/app/features/cli/cmdbox_web_user_del.py +87 -87
  48. cmdbox/app/features/cli/cmdbox_web_user_edit.py +104 -104
  49. cmdbox/app/features/cli/cmdbox_web_user_list.py +87 -87
  50. cmdbox/app/features/web/cmdbox_web_agent.py +16 -4
  51. cmdbox/app/features/web/cmdbox_web_get_cmd_choices.py +10 -2
  52. cmdbox/app/features/web/cmdbox_web_save_cmd.py +1 -0
  53. cmdbox/app/features/web/cmdbox_web_versions_used.py +4 -0
  54. cmdbox/app/filer.py +9 -9
  55. cmdbox/app/mcp.py +19 -8
  56. cmdbox/app/options.py +52 -47
  57. cmdbox/app/server.py +224 -224
  58. cmdbox/app/web.py +39 -17
  59. cmdbox/extensions/features.yml +7 -1
  60. cmdbox/extensions/sample_project/sample/app/features/cli/sample_client_time.py +2 -2
  61. cmdbox/extensions/sample_project/sample/app/features/cli/sample_server_time.py +3 -3
  62. cmdbox/licenses/LICENSE_APScheduler_3_11_0_MIT_License.txt +19 -0
  63. cmdbox/licenses/LICENSE_SQLAlchemy_2_0_43_MIT.txt +19 -0
  64. cmdbox/licenses/LICENSE_Werkzeug_3_1_1_BSD_License.txt +28 -0
  65. cmdbox/licenses/LICENSE_absolufy-imports_0_3_1_MIT_License.txt +21 -0
  66. cmdbox/licenses/LICENSE_anyio_4_10_0_UNKNOWN.txt +20 -0
  67. cmdbox/licenses/{LICENSE_typer_0_16_0_MIT_License.txt → LICENSE_backoff_2_2_1_MIT_License.txt} +1 -1
  68. cmdbox/licenses/LICENSE_certifi_2025_8_3_Mozilla_Public_License_2_0-MPL_2_0.txt +20 -0
  69. cmdbox/licenses/LICENSE_charset-normalizer_3_4_3_MIT.txt +21 -0
  70. cmdbox/licenses/LICENSE_cryptography_45_0_6_Apache-2_0_OR_BSD-3-Clause.txt +3 -0
  71. cmdbox/licenses/LICENSE_cyclopts_3_22_5_Apache_Software_License.txt +201 -0
  72. cmdbox/licenses/LICENSE_fastapi-sso_0_18_0_MIT_License.txt +21 -0
  73. cmdbox/licenses/LICENSE_fastmcp_2_11_3_Apache_Software_License.txt +201 -0
  74. cmdbox/licenses/LICENSE_google-adk_1_9_0_Apache_Software_License.txt +202 -0
  75. cmdbox/licenses/LICENSE_google-genai_1_28_0_Apache_Software_License.txt +202 -0
  76. cmdbox/licenses/LICENSE_google-genai_1_29_0_Apache_Software_License.txt +202 -0
  77. cmdbox/licenses/LICENSE_greenlet_3_2_4_MIT_AND_Python-2_0.txt +30 -0
  78. cmdbox/licenses/LICENSE_isodate_0_7_2_BSD_License.txt +26 -0
  79. cmdbox/licenses/LICENSE_lazy-object-proxy_1_11_0_BSD_License.txt +20 -0
  80. cmdbox/licenses/LICENSE_litellm-enterprise_0_1_19_UNKNOWN.txt +37 -0
  81. cmdbox/licenses/LICENSE_litellm_1_75_5_post1_MIT_License.txt +26 -0
  82. cmdbox/licenses/LICENSE_markdown-it-py_4_0_0_MIT_License.txt +21 -0
  83. cmdbox/licenses/LICENSE_mcp_1_12_4_MIT_License.txt +21 -0
  84. cmdbox/licenses/LICENSE_multidict_6_6_4_Apache_License_2_0.txt +13 -0
  85. cmdbox/licenses/LICENSE_oauthlib_3_3_1_BSD-3-Clause.txt +27 -0
  86. cmdbox/licenses/LICENSE_openai_1_99_9_Apache_Software_License.txt +201 -0
  87. cmdbox/licenses/LICENSE_openapi-core_0_19_5_BSD_License.txt +29 -0
  88. cmdbox/licenses/LICENSE_openapi-schema-validator_0_6_3_BSD_License.txt +29 -0
  89. cmdbox/licenses/LICENSE_openapi-spec-validator_0_7_2_Apache_Software_License.txt +201 -0
  90. cmdbox/licenses/LICENSE_opentelemetry-api_1_36_0_UNKNOWN.txt +201 -0
  91. cmdbox/licenses/LICENSE_opentelemetry-sdk_1_36_0_UNKNOWN.txt +201 -0
  92. cmdbox/licenses/LICENSE_opentelemetry-semantic-conventions_0_57b0_UNKNOWN.txt +201 -0
  93. cmdbox/licenses/LICENSE_orjson_3_11_1_Apache_Software_License-MIT_License.txt +201 -0
  94. cmdbox/licenses/LICENSE_parse_1_20_2_MIT_License.txt +19 -0
  95. cmdbox/licenses/LICENSE_pathable_0_4_4_Apache_Software_License.txt +201 -0
  96. cmdbox/licenses/{LICENSE_pillow_11_2_1_UNKNOWN.txt → LICENSE_pillow_11_3_0_UNKNOWN.txt} +393 -3
  97. cmdbox/licenses/LICENSE_pyperclip_1_9_0_BSD_License.txt +27 -0
  98. cmdbox/licenses/LICENSE_redis_6_4_0_MIT_License.txt +21 -0
  99. cmdbox/licenses/LICENSE_rfc3339-validator_0_1_4_MIT_License.txt +22 -0
  100. cmdbox/licenses/LICENSE_rich-rst_1_3_1_MIT_License.txt +7 -0
  101. cmdbox/licenses/LICENSE_rpds-py_0_27_0_UNKNOWN.txt +19 -0
  102. cmdbox/licenses/{LICENSE_setuptools_65_5_0_MIT_License.txt → LICENSE_setuptools_80_9_0_UNKNOWN.txt} +0 -2
  103. cmdbox/licenses/LICENSE_sphinx-intl_2_3_2_UNKNOWN.txt +25 -0
  104. cmdbox/licenses/LICENSE_tenacity_9_1_2_Apache_Software_License.txt +202 -0
  105. cmdbox/licenses/LICENSE_tiktoken_0_11_0_MIT_License-Copyright-c-2022_OpenAI-Shantanu_Jain-Permission_is_hereby_granted-free_of_charge-to_any_per.txt +21 -0
  106. cmdbox/licenses/LICENSE_tokenizers_0_21_4_Apache_Software_License.txt +1 -0
  107. cmdbox/licenses/LICENSE_voicevox_core_0_16_0_MIT.txt +20 -0
  108. cmdbox/licenses/LICENSE_watchdog_6_0_0_Apache_Software_License.txt +16 -0
  109. cmdbox/licenses/{LICENSE_httptools_0_6_4_MIT_License.txt → LICENSE_wsproto_1_2_0_MIT_License.txt} +3 -3
  110. cmdbox/licenses/files.txt +69 -50
  111. cmdbox/logconf_cmdbox.yml +136 -0
  112. cmdbox/version.py +2 -2
  113. cmdbox/web/agent.html +16 -2
  114. cmdbox/web/assets/cmdbox/agent.js +226 -1
  115. cmdbox/web/assets/cmdbox/common.js +20 -25
  116. cmdbox/web/assets/cmdbox/svgicon.js +18 -0
  117. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.1.dist-info}/METADATA +29 -20
  118. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.1.dist-info}/RECORD +158 -118
  119. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.1.dist-info}/WHEEL +1 -1
  120. cmdbox/config.yml +0 -3
  121. cmdbox/licenses/LICENSE_shellingham_1_5_4_ISC_License-ISCL.txt +0 -13
  122. cmdbox/licenses/LICENSE_watchfiles_1_1_0_MIT_License.txt +0 -21
  123. cmdbox/logconf_audit.yml +0 -43
  124. cmdbox/logconf_client.yml +0 -43
  125. cmdbox/logconf_edge.yml +0 -43
  126. cmdbox/logconf_gui.yml +0 -43
  127. cmdbox/logconf_mcp.yml +0 -43
  128. cmdbox/logconf_server.yml +0 -43
  129. cmdbox/logconf_web.yml +0 -43
  130. /cmdbox/licenses/{LICENSE_Authlib_1_6_0_BSD_License.txt → LICENSE_Authlib_1_6_1_BSD_License.txt} +0 -0
  131. /cmdbox/licenses/{LICENSE_SQLAlchemy_2_0_41_MIT.txt → LICENSE_SQLAlchemy_2_0_42_MIT.txt} +0 -0
  132. /cmdbox/licenses/{LICENSE_aiohttp_3_12_13_Apache-2_0.txt → LICENSE_aiohttp_3_12_15_Apache-2_0_AND_MIT.txt} +0 -0
  133. /cmdbox/licenses/{LICENSE_aiosignal_1_3_2_Apache_Software_License.txt → LICENSE_aiosignal_1_4_0_Apache_Software_License.txt} +0 -0
  134. /cmdbox/licenses/{LICENSE_certifi_2025_6_15_Mozilla_Public_License_2_0-MPL_2_0.txt → LICENSE_certifi_2025_7_14_Mozilla_Public_License_2_0-MPL_2_0.txt} +0 -0
  135. /cmdbox/licenses/{LICENSE_cryptography_45_0_4_Apache-2_0_OR_BSD-3-Clause.txt → LICENSE_cryptography_45_0_5_Apache-2_0_OR_BSD-3-Clause.txt} +0 -0
  136. /cmdbox/licenses/{LICENSE_docstring_parser_0_16_MIT_License.txt → LICENSE_docstring_parser_0_17_0_MIT_License.txt} +0 -0
  137. /cmdbox/licenses/{LICENSE_fastapi_0_115_14_MIT_License.txt → LICENSE_fastapi_0_116_1_MIT_License.txt} +0 -0
  138. /cmdbox/licenses/{LICENSE_fastmcp_2_10_1_Apache_Software_License.txt → LICENSE_fastmcp_2_11_0_Apache_Software_License.txt} +0 -0
  139. /cmdbox/licenses/{LICENSE_fsspec_2025_5_1_BSD_License.txt → LICENSE_fsspec_2025_7_0_BSD_License.txt} +0 -0
  140. /cmdbox/licenses/{LICENSE_google-adk_1_5_0_Apache_Software_License.txt → LICENSE_google-adk_1_10_0_Apache_Software_License.txt} +0 -0
  141. /cmdbox/licenses/{LICENSE_google-api-python-client_2_174_0_Apache_Software_License.txt → LICENSE_google-api-python-client_2_177_0_Apache_Software_License.txt} +0 -0
  142. /cmdbox/licenses/{LICENSE_huggingface-hub_0_33_1_Apache_Software_License.txt → LICENSE_google-api-python-client_2_178_0_Apache_Software_License.txt} +0 -0
  143. /cmdbox/licenses/{LICENSE_google-cloud-aiplatform_1_100_0_Apache_2_0.txt → LICENSE_google-cloud-aiplatform_1_106_0_Apache_2_0.txt} +0 -0
  144. /cmdbox/licenses/{LICENSE_google-cloud-bigquery_3_34_0_Apache_Software_License.txt → LICENSE_google-cloud-aiplatform_1_108_0_Apache_2_0.txt} +0 -0
  145. /cmdbox/licenses/{LICENSE_google-genai_1_23_0_Apache_Software_License.txt → LICENSE_google-cloud-bigquery_3_35_1_Apache_Software_License.txt} +0 -0
  146. /cmdbox/licenses/{LICENSE_grpcio-status_1_73_1_Apache_Software_License.txt → LICENSE_grpcio-status_1_74_0_Apache_Software_License.txt} +0 -0
  147. /cmdbox/licenses/{LICENSE_grpcio_1_73_1_Apache_Software_License.txt → LICENSE_grpcio_1_74_0_Apache_Software_License.txt} +0 -0
  148. /cmdbox/licenses/{LICENSE_opentelemetry-api_1_34_1_Apache_Software_License.txt → LICENSE_huggingface-hub_0_34_3_Apache_Software_License.txt} +0 -0
  149. /cmdbox/licenses/{LICENSE_opentelemetry-sdk_1_34_1_Apache_Software_License.txt → LICENSE_huggingface-hub_0_34_4_Apache_Software_License.txt} +0 -0
  150. /cmdbox/licenses/{LICENSE_opentelemetry-semantic-conventions_0_55b1_Apache_Software_License.txt → LICENSE_jsonschema-path_0_3_4_Apache_Software_License.txt} +0 -0
  151. /cmdbox/licenses/{LICENSE_jsonschema_4_24_0_UNKNOWN.txt → LICENSE_jsonschema_4_25_0_UNKNOWN.txt} +0 -0
  152. /cmdbox/licenses/{LICENSE_litellm_1_73_6_MIT_License.txt → LICENSE_litellm_1_74_12_MIT_License.txt} +0 -0
  153. /cmdbox/licenses/{LICENSE_mcp_1_10_1_MIT_License.txt → LICENSE_mcp_1_12_3_MIT_License.txt} +0 -0
  154. /cmdbox/licenses/{LICENSE_multidict_6_6_2_Apache_License_2_0.txt → LICENSE_multidict_6_6_3_Apache_License_2_0.txt} +0 -0
  155. /cmdbox/licenses/{LICENSE_nh3_0_2_21_MIT.txt → LICENSE_nh3_0_3_0_MIT.txt} +0 -0
  156. /cmdbox/licenses/{LICENSE_numpy_2_3_1_BSD_License.txt → LICENSE_numpy_2_3_2_BSD_License.txt} +0 -0
  157. /cmdbox/licenses/{LICENSE_openai_1_93_0_Apache_Software_License.txt → LICENSE_openai_1_98_0_Apache_Software_License.txt} +0 -0
  158. /cmdbox/licenses/{LICENSE_tokenizers_0_21_2_Apache_Software_License.txt → LICENSE_pywin32_311_Python_Software_Foundation_License.txt} +0 -0
  159. /cmdbox/licenses/{LICENSE_regex_2024_11_6_Apache_Software_License.txt → LICENSE_regex_2025_7_34_UNKNOWN.txt} +0 -0
  160. /cmdbox/licenses/{LICENSE_rich_14_0_0_MIT_License.txt → LICENSE_rich_14_1_0_MIT_License.txt} +0 -0
  161. /cmdbox/licenses/{LICENSE_rpds-py_0_25_1_MIT.txt → LICENSE_rpds-py_0_26_0_MIT.txt} +0 -0
  162. /cmdbox/licenses/{LICENSE_sse-starlette_2_3_6_BSD_License.txt → LICENSE_sse-starlette_3_0_2_UNKNOWN.txt} +0 -0
  163. /cmdbox/licenses/{LICENSE_starlette_0_46_2_BSD_License.txt → LICENSE_starlette_0_47_2_BSD_License.txt} +0 -0
  164. /cmdbox/licenses/{LICENSE_typing_extensions_4_14_0_UNKNOWN.txt → LICENSE_typing_extensions_4_14_1_UNKNOWN.txt} +0 -0
  165. /cmdbox/licenses/{LICENSE_zope_event_5_1_Zope_Public_License.txt → LICENSE_zope_event_5_1_1_Zope_Public_License.txt} +0 -0
  166. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.1.dist-info}/entry_points.txt +0 -0
  167. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.1.dist-info/licenses}/LICENSE +0 -0
  168. {cmdbox-0.6.3.2.dist-info → cmdbox-0.6.4.1.dist-info}/top_level.txt +0 -0
@@ -1,235 +1,236 @@
1
- from cmdbox.app import common, feature, web
2
- from cmdbox.app.options import Options
3
- from cmdbox.app.features.cli import agent_base
4
- from pathlib import Path
5
- from typing import Dict, Any, Tuple, List, Union
6
- from urllib.request import pathname2url
7
- import argparse
8
- import logging
9
- import multiprocessing
10
-
11
-
12
- class WebStart(feature.UnsupportEdgeFeature, agent_base.AgentBase):
13
- def get_mode(self) -> Union[str, List[str]]:
14
- """
15
- この機能のモードを返します
16
-
17
- Returns:
18
- Union[str, List[str]]: モード
19
- """
20
- return 'web'
21
-
22
- def get_cmd(self):
23
- """
24
- この機能のコマンドを返します
25
-
26
- Returns:
27
- str: コマンド
28
- """
29
- return 'start'
30
-
31
- def get_option(self):
32
- """
33
- この機能のオプションを返します
34
-
35
- Returns:
36
- Dict[str, Any]: オプション
37
- """
38
- opt = super().get_option()
39
- opt['use_redis'] = self.USE_REDIS_MEIGHT
40
- opt['nouse_webmode'] = True
41
- opt['description_ja'] = "Webモードを起動します。"
42
- opt['description_en'] = "Start Web mode."
43
- opt['choice'] += [
44
- dict(opt="host", type=Options.T_STR, default=self.default_host, required=True, multi=False, hide=True, choice=None, web="mask",
45
- description_ja="Redisサーバーのサービスホストを指定します。",
46
- description_en="Specify the service host of the Redis server."),
47
- dict(opt="port", type=Options.T_INT, default=self.default_port, required=True, multi=False, hide=True, choice=None, web="mask",
48
- description_ja="Redisサーバーのサービスポートを指定します。",
49
- description_en="Specify the service port of the Redis server."),
50
- dict(opt="password", type=Options.T_STR, default=self.default_pass, required=True, multi=False, hide=True, choice=None, web="mask",
51
- description_ja="Redisサーバーのアクセスパスワード(任意)を指定します。省略時は `password` を使用します。",
52
- description_en="Specify the access password of the Redis server (optional). If omitted, `password` is used."),
53
- dict(opt="svname", type=Options.T_STR, default=self.default_svname, required=True, multi=False, hide=True, choice=None, web="readonly",
54
- description_ja="サーバーのサービス名を指定します。省略時は `server` を使用します。",
55
- description_en="Specify the service name of the inference server. If omitted, `server` is used."),
56
- dict(opt="data", type=Options.T_DIR, default=self.default_data, required=False, multi=False, hide=False, choice=None,
57
- description_ja=f"省略した時は `$HONE/.{self.ver.__appid__}` を使用します。",
58
- description_en=f"When omitted, `$HONE/.{self.ver.__appid__}` is used."),
59
- dict(opt="allow_host", type=Options.T_STR, default="0.0.0.0", required=False, multi=False, hide=False, choice=None,
60
- description_ja="省略した時は `0.0.0.0` を使用します。",
61
- description_en="If omitted, `0.0.0.0` is used."),
62
- dict(opt="listen_port", type=Options.T_INT, default="8081", required=False, multi=False, hide=False, choice=None,
63
- description_ja="省略した時は `8081` を使用します。",
64
- description_en="If omitted, `8081` is used."),
65
- dict(opt="ssl_listen_port", type=Options.T_INT, default="8443", required=False, multi=False, hide=False, choice=None,
66
- description_ja="省略した時は `8443` を使用します。",
67
- description_en="If omitted, `8443` is used."),
68
- dict(opt="ssl_cert", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
69
- description_ja="SSLサーバー証明書ファイルを指定します。",
70
- description_en="Specify the SSL server certificate file."),
71
- dict(opt="ssl_key", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
72
- description_ja="SSLサーバー秘密鍵ファイルを指定します。",
73
- description_en="Specify the SSL server private key file."),
74
- dict(opt="ssl_keypass", type=Options.T_STR, default=None, required=False, multi=False, hide=True, choice=None,
75
- description_ja="SSLサーバー秘密鍵ファイルの複合化パスワードを指定します。",
76
- description_en="Specify the composite password for the SSL server private key file."),
77
- dict(opt="ssl_ca_certs", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
78
- description_ja="SSLサーバーCA証明書ファイルを指定します。",
79
- description_en="Specify the SSL server CA certificate file."),
80
- dict(opt="signin_file", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
81
- description_ja="サインイン可能なユーザーとパスワードを記載したファイルを指定します。省略した時は認証を要求しません。",
82
- description_en="Specify a file containing users and passwords with which they can signin. If omitted, no authentication is required."),
83
- dict(opt="session_domain", type=Options.T_STR, default=None, required=False, multi=False, hide=True, choice=None,
84
- description_ja="サインインしたユーザーのセッションが有効なドメインを指定します。",
85
- description_en="Specify the domain for which the signed-in user's session is valid."),
86
- dict(opt="session_path", type=Options.T_STR, default="/", required=False, multi=False, hide=True, choice=None,
87
- description_ja="サインインしたユーザーのセッションが有効なパスを指定します。",
88
- description_en="Specify the session timeout in seconds for signed-in users."),
89
- dict(opt="session_secure", type=Options.T_BOOL, default=False, required=False, multi=False, hide=True, choice=[True, False],
90
- description_ja="サインインしたユーザーのセッションにSecureフラグを設定します。",
91
- description_en="Set the Secure flag for the signed-in user's session."),
92
- dict(opt="session_timeout", type=Options.T_INT, default="900", required=False, multi=False, hide=True, choice=None,
93
- description_ja="サインインしたユーザーのセッションタイムアウトの時間を秒で指定します。",
94
- description_en="Specify the session timeout in seconds for signed-in users."),
95
- dict(opt="guvicorn_workers", type=Options.T_INT, default=multiprocessing.cpu_count()*2, required=False, multi=False, hide=True, choice=None,
96
- description_ja="guvicornワーカー数を指定します。Linux環境でのみ有効です。-1又は未指定の場合はCPU数の2倍を使用します。",
97
- description_en="Specifies the number of guvicorn workers, valid only in Linux environment. If -1 or unspecified, twice the number of CPUs is used."),
98
- dict(opt="guvicorn_timeout", type=Options.T_INT, default=30, required=False, multi=False, hide=True, choice=None,
99
- description_ja="guvicornワーカーのタイムアウトの時間を秒で指定します。",
100
- description_en="Specify the timeout duration of the guvicorn worker in seconds."),
101
- dict(opt="client_only", type=Options.T_BOOL, default=False, required=False, multi=False, hide=True, choice=[True, False],
102
- description_ja="サーバーへの接続を行わないようにします。",
103
- description_en="Do not make connections to the server."),
104
- dict(opt="outputs_key", type=Options.T_STR, default=None, required=False, multi=True, hide=False, choice=None,
105
- description_ja="showimg及びwebcap画面で表示する項目を指定します。省略した場合は全ての項目を表示します。",
106
- description_en="Specify items to be displayed on the showimg and webcap screens. If omitted, all items are displayed."),
107
- dict(opt="doc_root", type=Options.T_DIR, default=None, required=False, multi=False, hide=False, choice=None,
108
- description_ja="カスタムファイルのドキュメントルート. フォルダ指定のカスタムファイルのパスから、doc_rootのパスを除去したパスでURLマッピングします。",
109
- description_en="Document root for custom files. URL mapping from the path of a folder-specified custom file with the path of doc_root removed."),
110
- dict(opt="gui_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
111
- description_ja="`gui.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
112
- description_en="Specify `gui.html`. If omitted, the cmdbox built-in HTML file is used."),
113
- dict(opt="filer_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
114
- description_ja="`filer.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
115
- description_en="Specify `filer.html`. If omitted, the cmdbox built-in HTML file is used."),
116
- dict(opt="result_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
117
- description_ja="`result.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
118
- description_en="Specify `result.html`. If omitted, the cmdbox built-in HTML file is used."),
119
- dict(opt="users_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
120
- description_ja="`users.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
121
- description_en="Specify `users.html`. If omitted, the cmdbox built-in HTML file is used."),
122
- dict(opt="assets", type=Options.T_FILE, default=None, required=False, multi=True, hide=False, choice=None, fileio="in",
123
- description_ja="htmlファイルを使用する場合に必要なアセットファイルを指定します。",
124
- description_en="Specify the asset file required when using html files."),
125
- dict(opt="signin_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
126
- description_ja="`signin.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
127
- description_en="Specify `signin.html`. If omitted, the cmdbox built-in HTML file is used."),
128
- dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
129
- description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
130
- description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
131
- dict(opt="capture_stdout", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
132
- description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をキャプチャーし、実行結果画面に表示します。",
133
- description_en="Available only in GUI mode. Captures standard output during command execution and displays it on the execution result screen."),
134
- dict(opt="capture_maxsize", type=Options.T_INT, default=self.DEFAULT_CAPTURE_MAXSIZE, required=False, multi=False, hide=True, choice=None,
135
- description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力の最大キャプチャーサイズを指定します。",
136
- description_en="Available only in GUI mode. Specifies the maximum capture size of standard output when executing commands."),
137
- ]
138
- return opt
139
-
140
- def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
141
- """
142
- この機能の実行を行います
143
-
144
- Args:
145
- logger (logging.Logger): ロガー
146
- args (argparse.Namespace): 引数
147
- tm (float): 実行開始時間
148
- pf (List[Dict[str, float]]): 呼出元のパフォーマンス情報
149
-
150
- Returns:
151
- Tuple[int, Dict[str, Any], Any]: 終了コード, 結果, オブジェクト
152
- """
153
- if args.data is None:
154
- msg = dict(warn=f"Please specify the --data option.")
155
- common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
156
- return 1, msg, None
157
- w = None
158
- try:
159
- args.gui_mode = False if not hasattr(args, 'gui_mode') or not args.gui_mode else args.gui_mode
160
- w = self.createWeb(logger, args)
161
- agent_runner, mcp = self._init_agent_runner(w, logger, args)
162
- args.ssl_cert = None if args.ssl_cert is None else Path(args.ssl_cert)
163
- args.ssl_key = None if args.ssl_key is None else Path(args.ssl_key)
164
- args.ssl_ca_certs = None if args.ssl_ca_certs is None else Path(args.ssl_ca_certs)
165
- self.start(w, agent_runner, mcp, logger, args)
166
- msg = dict(success="web complate.")
167
- common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
168
- return 0, msg, w
169
- except Exception as e:
170
- logger.error(f"Web server start error. {e}", exc_info=True)
171
- msg = dict(warn=f"Web server start error. {e}")
172
- common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
173
- return 1, msg, w
174
-
175
- def createWeb(self, logger:logging.Logger, args:argparse.Namespace) -> web.Web:
176
- """
177
- Webオブジェクトを作成します
178
-
179
- Args:
180
- logger (logging.Logger): ロガー
181
- args (argparse.Namespace): 引数
182
-
183
- Returns:
184
- web.Web: Webオブジェクト
185
- """
186
- w = web.Web.getInstance(logger, Path(args.data), appcls=self.appcls, ver=self.ver,
187
- redis_host=args.host, redis_port=args.port, redis_password=args.password, svname=args.svname,
188
- client_only=args.client_only, doc_root=args.doc_root, gui_html=args.gui_html, filer_html=args.filer_html,
189
- result_html=args.result_html, users_html=args.users_html,
190
- assets=args.assets, signin_html=args.signin_html, signin_file=args.signin_file, gui_mode=args.gui_mode)
191
- return w
192
-
193
- def _init_agent_runner(self, w:web.Web, logger:logging.Logger, args:argparse.Namespace) -> Tuple[Any, Any]:
194
- """
195
- エージェントをセットアップします
196
-
197
- Args:
198
- w (web.Web): Webオブジェクト
199
- logger (logging.Logger): ロガー
200
- args (argparse.Namespace): 引数
201
-
202
- Returns:
203
- Tuple[agent_base.AgentBase, Any]: エージェントオブジェクト, MCPオブジェクト
204
- """
205
- logger.info(f"Agent={args.agent}")
206
- if args.agent=='use':
207
- if not hasattr(self, 'mcp'):
208
- from cmdbox.app import mcp
209
- self.mcp = mcp.Mcp(logger, args.data, w.signin, self.appcls, self.ver)
210
- if args.agent_session_store == 'sqlite':
211
- args.agent_session_dburl = "sqlite:" + pathname2url(str(w.agent_path / 'session.db'))
212
- elif args.agent_session_store == 'postgresql':
213
- args.agent_session_dburl = f"postgresql+psycopg://{args.agent_pg_user}:{args.agent_pg_password}@{args.agent_pg_host}:{args.agent_pg_port}/{args.agent_pg_dbname}"
214
- else:
215
- args.agent_session_dburl = None
216
- return self.mcp.init_agent_runner(logger, args, w)
217
- return None, None
218
-
219
- def start(self, w:web.Web, agent_runner, mcp, logger:logging.Logger, args:argparse.Namespace) -> None:
220
- """
221
- Webモードを起動します
222
-
223
- Args:
224
- w (web.Web): Webオブジェクト
225
- agent_runner: エージェントランナー
226
- mcp: MCPオブジェクト
227
- logger (logging.Logger): ロガー
228
- args (argparse.Namespace): 引数
229
- """
230
- w.start(allow_host=args.allow_host, listen_port=args.listen_port, ssl_listen_port=args.ssl_listen_port,
231
- ssl_cert=args.ssl_cert, ssl_key=args.ssl_key, ssl_keypass=args.ssl_keypass, ssl_ca_certs=args.ssl_ca_certs,
232
- session_domain=args.session_domain, session_path=args.session_path,
233
- session_secure=args.session_secure, session_timeout=args.session_timeout,
234
- outputs_key=args.outputs_key, guvicorn_workers=args.guvicorn_workers, guvicorn_timeout=args.guvicorn_timeout,
235
- agent_runner=agent_runner, mcp=mcp,)
1
+ from cmdbox.app import common, feature, web
2
+ from cmdbox.app.options import Options
3
+ from cmdbox.app.features.cli import agent_base
4
+ from pathlib import Path
5
+ from typing import Dict, Any, Tuple, List, Union
6
+ from urllib.request import pathname2url
7
+ import argparse
8
+ import logging
9
+ import multiprocessing
10
+
11
+
12
+ class WebStart(feature.UnsupportEdgeFeature, agent_base.AgentBase):
13
+ def get_mode(self) -> Union[str, List[str]]:
14
+ """
15
+ この機能のモードを返します
16
+
17
+ Returns:
18
+ Union[str, List[str]]: モード
19
+ """
20
+ return 'web'
21
+
22
+ def get_cmd(self):
23
+ """
24
+ この機能のコマンドを返します
25
+
26
+ Returns:
27
+ str: コマンド
28
+ """
29
+ return 'start'
30
+
31
+ def get_option(self):
32
+ """
33
+ この機能のオプションを返します
34
+
35
+ Returns:
36
+ Dict[str, Any]: オプション
37
+ """
38
+ opt = super().get_option()
39
+ opt['use_redis'] = self.USE_REDIS_MEIGHT
40
+ opt['nouse_webmode'] = True
41
+ opt['use_agent'] = False
42
+ opt['description_ja'] = "Webモードを起動します。"
43
+ opt['description_en'] = "Start Web mode."
44
+ opt['choice'] += [
45
+ dict(opt="host", type=Options.T_STR, default=self.default_host, required=True, multi=False, hide=True, choice=None, web="mask",
46
+ description_ja="Redisサーバーのサービスホストを指定します。",
47
+ description_en="Specify the service host of the Redis server."),
48
+ dict(opt="port", type=Options.T_INT, default=self.default_port, required=True, multi=False, hide=True, choice=None, web="mask",
49
+ description_ja="Redisサーバーのサービスポートを指定します。",
50
+ description_en="Specify the service port of the Redis server."),
51
+ dict(opt="password", type=Options.T_STR, default=self.default_pass, required=True, multi=False, hide=True, choice=None, web="mask",
52
+ description_ja="Redisサーバーのアクセスパスワード(任意)を指定します。省略時は `password` を使用します。",
53
+ description_en="Specify the access password of the Redis server (optional). If omitted, `password` is used."),
54
+ dict(opt="svname", type=Options.T_STR, default=self.default_svname, required=True, multi=False, hide=True, choice=None, web="readonly",
55
+ description_ja="サーバーのサービス名を指定します。省略時は `server` を使用します。",
56
+ description_en="Specify the service name of the inference server. If omitted, `server` is used."),
57
+ dict(opt="data", type=Options.T_DIR, default=self.default_data, required=False, multi=False, hide=False, choice=None,
58
+ description_ja=f"省略した時は `$HONE/.{self.ver.__appid__}` を使用します。",
59
+ description_en=f"When omitted, `$HONE/.{self.ver.__appid__}` is used."),
60
+ dict(opt="allow_host", type=Options.T_STR, default="0.0.0.0", required=False, multi=False, hide=False, choice=None,
61
+ description_ja="省略した時は `0.0.0.0` を使用します。",
62
+ description_en="If omitted, `0.0.0.0` is used."),
63
+ dict(opt="listen_port", type=Options.T_INT, default="8081", required=False, multi=False, hide=False, choice=None,
64
+ description_ja="省略した時は `8081` を使用します。",
65
+ description_en="If omitted, `8081` is used."),
66
+ dict(opt="ssl_listen_port", type=Options.T_INT, default="8443", required=False, multi=False, hide=False, choice=None,
67
+ description_ja="省略した時は `8443` を使用します。",
68
+ description_en="If omitted, `8443` is used."),
69
+ dict(opt="ssl_cert", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
70
+ description_ja="SSLサーバー証明書ファイルを指定します。",
71
+ description_en="Specify the SSL server certificate file."),
72
+ dict(opt="ssl_key", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
73
+ description_ja="SSLサーバー秘密鍵ファイルを指定します。",
74
+ description_en="Specify the SSL server private key file."),
75
+ dict(opt="ssl_keypass", type=Options.T_STR, default=None, required=False, multi=False, hide=True, choice=None,
76
+ description_ja="SSLサーバー秘密鍵ファイルの複合化パスワードを指定します。",
77
+ description_en="Specify the composite password for the SSL server private key file."),
78
+ dict(opt="ssl_ca_certs", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
79
+ description_ja="SSLサーバーCA証明書ファイルを指定します。",
80
+ description_en="Specify the SSL server CA certificate file."),
81
+ dict(opt="signin_file", type=Options.T_FILE, default=None, required=False, multi=False, hide=True, choice=None, fileio="in",
82
+ description_ja="サインイン可能なユーザーとパスワードを記載したファイルを指定します。省略した時は認証を要求しません。",
83
+ description_en="Specify a file containing users and passwords with which they can signin. If omitted, no authentication is required."),
84
+ dict(opt="session_domain", type=Options.T_STR, default=None, required=False, multi=False, hide=True, choice=None,
85
+ description_ja="サインインしたユーザーのセッションが有効なドメインを指定します。",
86
+ description_en="Specify the domain for which the signed-in user's session is valid."),
87
+ dict(opt="session_path", type=Options.T_STR, default="/", required=False, multi=False, hide=True, choice=None,
88
+ description_ja="サインインしたユーザーのセッションが有効なパスを指定します。",
89
+ description_en="Specify the session timeout in seconds for signed-in users."),
90
+ dict(opt="session_secure", type=Options.T_BOOL, default=False, required=False, multi=False, hide=True, choice=[True, False],
91
+ description_ja="サインインしたユーザーのセッションにSecureフラグを設定します。",
92
+ description_en="Set the Secure flag for the signed-in user's session."),
93
+ dict(opt="session_timeout", type=Options.T_INT, default="900", required=False, multi=False, hide=True, choice=None,
94
+ description_ja="サインインしたユーザーのセッションタイムアウトの時間を秒で指定します。",
95
+ description_en="Specify the session timeout in seconds for signed-in users."),
96
+ dict(opt="guvicorn_workers", type=Options.T_INT, default=multiprocessing.cpu_count()*2, required=False, multi=False, hide=True, choice=None,
97
+ description_ja="guvicornワーカー数を指定します。Linux環境でのみ有効です。-1又は未指定の場合はCPU数の2倍を使用します。",
98
+ description_en="Specifies the number of guvicorn workers, valid only in Linux environment. If -1 or unspecified, twice the number of CPUs is used."),
99
+ dict(opt="guvicorn_timeout", type=Options.T_INT, default=30, required=False, multi=False, hide=True, choice=None,
100
+ description_ja="guvicornワーカーのタイムアウトの時間を秒で指定します。",
101
+ description_en="Specify the timeout duration of the guvicorn worker in seconds."),
102
+ dict(opt="client_only", type=Options.T_BOOL, default=False, required=False, multi=False, hide=True, choice=[True, False],
103
+ description_ja="サーバーへの接続を行わないようにします。",
104
+ description_en="Do not make connections to the server."),
105
+ dict(opt="outputs_key", type=Options.T_STR, default=None, required=False, multi=True, hide=False, choice=None,
106
+ description_ja="showimg及びwebcap画面で表示する項目を指定します。省略した場合は全ての項目を表示します。",
107
+ description_en="Specify items to be displayed on the showimg and webcap screens. If omitted, all items are displayed."),
108
+ dict(opt="doc_root", type=Options.T_DIR, default=None, required=False, multi=False, hide=False, choice=None,
109
+ description_ja="カスタムファイルのドキュメントルート. フォルダ指定のカスタムファイルのパスから、doc_rootのパスを除去したパスでURLマッピングします。",
110
+ description_en="Document root for custom files. URL mapping from the path of a folder-specified custom file with the path of doc_root removed."),
111
+ dict(opt="gui_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
112
+ description_ja="`gui.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
113
+ description_en="Specify `gui.html`. If omitted, the cmdbox built-in HTML file is used."),
114
+ dict(opt="filer_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
115
+ description_ja="`filer.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
116
+ description_en="Specify `filer.html`. If omitted, the cmdbox built-in HTML file is used."),
117
+ dict(opt="result_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
118
+ description_ja="`result.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
119
+ description_en="Specify `result.html`. If omitted, the cmdbox built-in HTML file is used."),
120
+ dict(opt="users_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
121
+ description_ja="`users.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
122
+ description_en="Specify `users.html`. If omitted, the cmdbox built-in HTML file is used."),
123
+ dict(opt="assets", type=Options.T_FILE, default=None, required=False, multi=True, hide=False, choice=None, fileio="in",
124
+ description_ja="htmlファイルを使用する場合に必要なアセットファイルを指定します。",
125
+ description_en="Specify the asset file required when using html files."),
126
+ dict(opt="signin_html", type=Options.T_FILE, default=None, required=False, multi=False, hide=False, choice=None, fileio="in",
127
+ description_ja="`signin.html` を指定します。省略時はcmdbox内蔵のHTMLファイルを使用します。",
128
+ description_en="Specify `signin.html`. If omitted, the cmdbox built-in HTML file is used."),
129
+ dict(opt="stdout_log", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
130
+ description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をConsole logに出力します。",
131
+ description_en="Available only in GUI mode. Outputs standard output during command execution to Console log."),
132
+ dict(opt="capture_stdout", type=Options.T_BOOL, default=True, required=False, multi=False, hide=True, choice=[True, False],
133
+ description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力をキャプチャーし、実行結果画面に表示します。",
134
+ description_en="Available only in GUI mode. Captures standard output during command execution and displays it on the execution result screen."),
135
+ dict(opt="capture_maxsize", type=Options.T_INT, default=self.DEFAULT_CAPTURE_MAXSIZE, required=False, multi=False, hide=True, choice=None,
136
+ description_ja="GUIモードでのみ使用可能です。コマンド実行時の標準出力の最大キャプチャーサイズを指定します。",
137
+ description_en="Available only in GUI mode. Specifies the maximum capture size of standard output when executing commands."),
138
+ ]
139
+ return opt
140
+
141
+ def apprun(self, logger:logging.Logger, args:argparse.Namespace, tm:float, pf:List[Dict[str, float]]=[]) -> Tuple[int, Dict[str, Any], Any]:
142
+ """
143
+ この機能の実行を行います
144
+
145
+ Args:
146
+ logger (logging.Logger): ロガー
147
+ args (argparse.Namespace): 引数
148
+ tm (float): 実行開始時間
149
+ pf (List[Dict[str, float]]): 呼出元のパフォーマンス情報
150
+
151
+ Returns:
152
+ Tuple[int, Dict[str, Any], Any]: 終了コード, 結果, オブジェクト
153
+ """
154
+ if args.data is None:
155
+ msg = dict(warn=f"Please specify the --data option.")
156
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
157
+ return self.RESP_WARN, msg, None
158
+ w = None
159
+ try:
160
+ args.gui_mode = False if not hasattr(args, 'gui_mode') or not args.gui_mode else args.gui_mode
161
+ w = self.createWeb(logger, args)
162
+ agent_runner, mcp = self._init_agent_runner(w, logger, args)
163
+ args.ssl_cert = None if args.ssl_cert is None else Path(args.ssl_cert)
164
+ args.ssl_key = None if args.ssl_key is None else Path(args.ssl_key)
165
+ args.ssl_ca_certs = None if args.ssl_ca_certs is None else Path(args.ssl_ca_certs)
166
+ self.start(w, agent_runner, mcp, logger, args)
167
+ msg = dict(success="web complate.")
168
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
169
+ return self.RESP_SUCCESS, msg, w
170
+ except Exception as e:
171
+ logger.error(f"Web server start error. {e}", exc_info=True)
172
+ msg = dict(warn=f"Web server start error. {e}")
173
+ common.print_format(msg, args.format, tm, args.output_json, args.output_json_append, pf=pf)
174
+ return self.RESP_WARN, msg, w
175
+
176
+ def createWeb(self, logger:logging.Logger, args:argparse.Namespace) -> web.Web:
177
+ """
178
+ Webオブジェクトを作成します
179
+
180
+ Args:
181
+ logger (logging.Logger): ロガー
182
+ args (argparse.Namespace): 引数
183
+
184
+ Returns:
185
+ web.Web: Webオブジェクト
186
+ """
187
+ w = web.Web.getInstance(logger, Path(args.data), appcls=self.appcls, ver=self.ver,
188
+ redis_host=args.host, redis_port=args.port, redis_password=args.password, svname=args.svname,
189
+ client_only=args.client_only, doc_root=args.doc_root, gui_html=args.gui_html, filer_html=args.filer_html,
190
+ result_html=args.result_html, users_html=args.users_html,
191
+ assets=args.assets, signin_html=args.signin_html, signin_file=args.signin_file, gui_mode=args.gui_mode)
192
+ return w
193
+
194
+ def _init_agent_runner(self, w:web.Web, logger:logging.Logger, args:argparse.Namespace) -> Tuple[Any, Any]:
195
+ """
196
+ エージェントをセットアップします
197
+
198
+ Args:
199
+ w (web.Web): Webオブジェクト
200
+ logger (logging.Logger): ロガー
201
+ args (argparse.Namespace): 引数
202
+
203
+ Returns:
204
+ Tuple[agent_base.AgentBase, Any]: エージェントオブジェクト, MCPオブジェクト
205
+ """
206
+ logger.info(f"Agent={args.agent}")
207
+ if args.agent=='use':
208
+ if not hasattr(self, 'mcp'):
209
+ from cmdbox.app import mcp
210
+ self.mcp = mcp.Mcp(logger, Path(args.data), w.signin, self.appcls, self.ver)
211
+ if args.agent_session_store == 'sqlite':
212
+ args.agent_session_dburl = "sqlite:" + pathname2url(str(w.agent_path / 'session.db'))
213
+ elif args.agent_session_store == 'postgresql':
214
+ args.agent_session_dburl = f"postgresql+psycopg://{args.agent_pg_user}:{args.agent_pg_password}@{args.agent_pg_host}:{args.agent_pg_port}/{args.agent_pg_dbname}"
215
+ else:
216
+ args.agent_session_dburl = None
217
+ return self.mcp.init_agent_runner(logger, args, w)
218
+ return None, None
219
+
220
+ def start(self, w:web.Web, agent_runner, mcp, logger:logging.Logger, args:argparse.Namespace) -> None:
221
+ """
222
+ Webモードを起動します
223
+
224
+ Args:
225
+ w (web.Web): Webオブジェクト
226
+ agent_runner: エージェントランナー
227
+ mcp: MCPオブジェクト
228
+ logger (logging.Logger): ロガー
229
+ args (argparse.Namespace): 引数
230
+ """
231
+ w.start(allow_host=args.allow_host, listen_port=args.listen_port, ssl_listen_port=args.ssl_listen_port,
232
+ ssl_cert=args.ssl_cert, ssl_key=args.ssl_key, ssl_keypass=args.ssl_keypass, ssl_ca_certs=args.ssl_ca_certs,
233
+ session_domain=args.session_domain, session_path=args.session_path,
234
+ session_secure=args.session_secure, session_timeout=args.session_timeout,
235
+ outputs_key=args.outputs_key, guvicorn_workers=args.guvicorn_workers, guvicorn_timeout=args.guvicorn_timeout,
236
+ agent_runner=agent_runner, mcp=mcp,)