cmdbox 0.6.3.1__py3-none-any.whl → 0.6.4__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 (135) hide show
  1. cmdbox/app/app.py +16 -7
  2. cmdbox/app/common.py +2 -2
  3. cmdbox/app/commons/loghandler.py +4 -1
  4. cmdbox/app/commons/redis_client.py +1 -1
  5. cmdbox/app/edge.py +1 -1
  6. cmdbox/app/feature.py +1 -1
  7. cmdbox/app/features/cli/cmdbox_audit_createdb.py +224 -224
  8. cmdbox/app/features/cli/cmdbox_audit_delete.py +4 -4
  9. cmdbox/app/features/cli/cmdbox_audit_search.py +4 -4
  10. cmdbox/app/features/cli/cmdbox_audit_write.py +6 -8
  11. cmdbox/app/features/cli/cmdbox_client_file_copy.py +3 -3
  12. cmdbox/app/features/cli/cmdbox_client_file_download.py +3 -3
  13. cmdbox/app/features/cli/cmdbox_client_file_list.py +3 -3
  14. cmdbox/app/features/cli/cmdbox_client_file_mkdir.py +3 -3
  15. cmdbox/app/features/cli/cmdbox_client_file_move.py +3 -3
  16. cmdbox/app/features/cli/cmdbox_client_file_remove.py +3 -3
  17. cmdbox/app/features/cli/cmdbox_client_file_rmdir.py +3 -3
  18. cmdbox/app/features/cli/cmdbox_client_file_upload.py +3 -3
  19. cmdbox/app/features/cli/cmdbox_client_http.py +7 -6
  20. cmdbox/app/features/cli/cmdbox_client_server_info.py +4 -4
  21. cmdbox/app/features/cli/cmdbox_cmd_list.py +3 -3
  22. cmdbox/app/features/cli/cmdbox_cmd_load.py +5 -5
  23. cmdbox/app/features/cli/cmdbox_edge_config.py +1 -1
  24. cmdbox/app/features/cli/cmdbox_edge_start.py +3 -3
  25. cmdbox/app/features/cli/cmdbox_mcp_client.py +174 -174
  26. cmdbox/app/features/cli/cmdbox_mcp_proxy.py +96 -96
  27. cmdbox/app/features/cli/cmdbox_server_list.py +2 -2
  28. cmdbox/app/features/cli/cmdbox_server_start.py +103 -103
  29. cmdbox/app/features/cli/cmdbox_server_stop.py +4 -4
  30. cmdbox/app/features/cli/cmdbox_tts_install.py +307 -0
  31. cmdbox/app/features/cli/cmdbox_tts_say.py +179 -0
  32. cmdbox/app/features/cli/cmdbox_tts_start.py +329 -0
  33. cmdbox/app/features/cli/cmdbox_tts_stop.py +108 -0
  34. cmdbox/app/features/cli/cmdbox_web_apikey_add.py +91 -106
  35. cmdbox/app/features/cli/cmdbox_web_apikey_del.py +91 -106
  36. cmdbox/app/features/cli/cmdbox_web_gencert.py +6 -6
  37. cmdbox/app/features/cli/cmdbox_web_genpass.py +168 -168
  38. cmdbox/app/features/cli/cmdbox_web_group_add.py +94 -109
  39. cmdbox/app/features/cli/cmdbox_web_group_del.py +87 -102
  40. cmdbox/app/features/cli/cmdbox_web_group_edit.py +94 -109
  41. cmdbox/app/features/cli/cmdbox_web_group_list.py +87 -102
  42. cmdbox/app/features/cli/cmdbox_web_start.py +235 -235
  43. cmdbox/app/features/cli/cmdbox_web_stop.py +72 -72
  44. cmdbox/app/features/cli/cmdbox_web_user_add.py +104 -119
  45. cmdbox/app/features/cli/cmdbox_web_user_del.py +87 -102
  46. cmdbox/app/features/cli/cmdbox_web_user_edit.py +104 -119
  47. cmdbox/app/features/cli/cmdbox_web_user_list.py +87 -102
  48. cmdbox/app/filer.py +9 -9
  49. cmdbox/app/mcp.py +15 -7
  50. cmdbox/app/options.py +46 -43
  51. cmdbox/app/server.py +224 -224
  52. cmdbox/app/web.py +1 -1
  53. cmdbox/extensions/features.yml +3 -0
  54. cmdbox/extensions/sample_project/sample/app/features/cli/sample_client_time.py +2 -2
  55. cmdbox/extensions/sample_project/sample/app/features/cli/sample_server_time.py +3 -3
  56. cmdbox/licenses/LICENSE_Werkzeug_3_1_1_BSD_License.txt +28 -0
  57. cmdbox/licenses/LICENSE_absolufy-imports_0_3_1_MIT_License.txt +21 -0
  58. cmdbox/licenses/LICENSE_cyclopts_3_22_5_Apache_Software_License.txt +201 -0
  59. cmdbox/licenses/LICENSE_isodate_0_7_2_BSD_License.txt +26 -0
  60. cmdbox/licenses/LICENSE_lazy-object-proxy_1_11_0_BSD_License.txt +20 -0
  61. cmdbox/licenses/LICENSE_openapi-core_0_19_5_BSD_License.txt +29 -0
  62. cmdbox/licenses/LICENSE_openapi-schema-validator_0_6_3_BSD_License.txt +29 -0
  63. cmdbox/licenses/LICENSE_openapi-spec-validator_0_7_2_Apache_Software_License.txt +201 -0
  64. cmdbox/licenses/LICENSE_opentelemetry-semantic-conventions_0_57b0_UNKNOWN.txt +201 -0
  65. cmdbox/licenses/LICENSE_parse_1_20_2_MIT_License.txt +19 -0
  66. cmdbox/licenses/LICENSE_pathable_0_4_4_Apache_Software_License.txt +201 -0
  67. cmdbox/licenses/{LICENSE_pillow_11_2_1_UNKNOWN.txt → LICENSE_pillow_11_3_0_UNKNOWN.txt} +393 -3
  68. cmdbox/licenses/LICENSE_pyperclip_1_9_0_BSD_License.txt +27 -0
  69. cmdbox/licenses/LICENSE_rfc3339-validator_0_1_4_MIT_License.txt +22 -0
  70. cmdbox/licenses/LICENSE_rich-rst_1_3_1_MIT_License.txt +7 -0
  71. cmdbox/licenses/{LICENSE_setuptools_65_5_0_MIT_License.txt → LICENSE_setuptools_80_9_0_UNKNOWN.txt} +0 -2
  72. cmdbox/licenses/LICENSE_tokenizers_0_21_4_Apache_Software_License.txt +1 -0
  73. cmdbox/licenses/LICENSE_voicevox_core_0_16_0_MIT.txt +20 -0
  74. cmdbox/licenses/LICENSE_watchdog_6_0_0_Apache_Software_License.txt +16 -0
  75. cmdbox/licenses/{LICENSE_typer_0_16_0_MIT_License.txt → LICENSE_wsproto_1_2_0_MIT_License.txt} +2 -2
  76. cmdbox/licenses/files.txt +56 -42
  77. cmdbox/logconf_cmdbox.yml +104 -0
  78. cmdbox/version.py +2 -2
  79. cmdbox/web/agent.html +8 -2
  80. cmdbox/web/assets/cmdbox/agent.js +182 -1
  81. cmdbox/web/assets/cmdbox/common.js +16 -3
  82. cmdbox/web/assets/cmdbox/svgicon.js +18 -0
  83. {cmdbox-0.6.3.1.dist-info → cmdbox-0.6.4.dist-info}/METADATA +28 -20
  84. {cmdbox-0.6.3.1.dist-info → cmdbox-0.6.4.dist-info}/RECORD +124 -114
  85. {cmdbox-0.6.3.1.dist-info → cmdbox-0.6.4.dist-info}/WHEEL +1 -1
  86. cmdbox/config.yml +0 -3
  87. cmdbox/licenses/LICENSE_httptools_0_6_4_MIT_License.txt +0 -21
  88. cmdbox/licenses/LICENSE_shellingham_1_5_4_ISC_License-ISCL.txt +0 -13
  89. cmdbox/licenses/LICENSE_watchfiles_1_1_0_MIT_License.txt +0 -21
  90. cmdbox/logconf_audit.yml +0 -43
  91. cmdbox/logconf_client.yml +0 -43
  92. cmdbox/logconf_edge.yml +0 -43
  93. cmdbox/logconf_gui.yml +0 -43
  94. cmdbox/logconf_mcp.yml +0 -43
  95. cmdbox/logconf_server.yml +0 -43
  96. cmdbox/logconf_web.yml +0 -43
  97. /cmdbox/licenses/{LICENSE_Authlib_1_6_0_BSD_License.txt → LICENSE_Authlib_1_6_1_BSD_License.txt} +0 -0
  98. /cmdbox/licenses/{LICENSE_SQLAlchemy_2_0_41_MIT.txt → LICENSE_SQLAlchemy_2_0_42_MIT.txt} +0 -0
  99. /cmdbox/licenses/{LICENSE_aiohttp_3_12_13_Apache-2_0.txt → LICENSE_aiohttp_3_12_15_Apache-2_0_AND_MIT.txt} +0 -0
  100. /cmdbox/licenses/{LICENSE_aiosignal_1_3_2_Apache_Software_License.txt → LICENSE_aiosignal_1_4_0_Apache_Software_License.txt} +0 -0
  101. /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
  102. /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
  103. /cmdbox/licenses/{LICENSE_docstring_parser_0_16_MIT_License.txt → LICENSE_docstring_parser_0_17_0_MIT_License.txt} +0 -0
  104. /cmdbox/licenses/{LICENSE_fastapi_0_115_14_MIT_License.txt → LICENSE_fastapi_0_116_1_MIT_License.txt} +0 -0
  105. /cmdbox/licenses/{LICENSE_fastmcp_2_10_1_Apache_Software_License.txt → LICENSE_fastmcp_2_11_0_Apache_Software_License.txt} +0 -0
  106. /cmdbox/licenses/{LICENSE_fsspec_2025_5_1_BSD_License.txt → LICENSE_fsspec_2025_7_0_BSD_License.txt} +0 -0
  107. /cmdbox/licenses/{LICENSE_google-adk_1_5_0_Apache_Software_License.txt → LICENSE_google-adk_1_9_0_Apache_Software_License.txt} +0 -0
  108. /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
  109. /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
  110. /cmdbox/licenses/{LICENSE_google-cloud-bigquery_3_34_0_Apache_Software_License.txt → LICENSE_google-cloud-bigquery_3_35_1_Apache_Software_License.txt} +0 -0
  111. /cmdbox/licenses/{LICENSE_google-genai_1_23_0_Apache_Software_License.txt → LICENSE_google-genai_1_28_0_Apache_Software_License.txt} +0 -0
  112. /cmdbox/licenses/{LICENSE_grpcio-status_1_73_1_Apache_Software_License.txt → LICENSE_grpcio-status_1_74_0_Apache_Software_License.txt} +0 -0
  113. /cmdbox/licenses/{LICENSE_grpcio_1_73_1_Apache_Software_License.txt → LICENSE_grpcio_1_74_0_Apache_Software_License.txt} +0 -0
  114. /cmdbox/licenses/{LICENSE_huggingface-hub_0_33_1_Apache_Software_License.txt → LICENSE_huggingface-hub_0_34_3_Apache_Software_License.txt} +0 -0
  115. /cmdbox/licenses/{LICENSE_opentelemetry-api_1_34_1_Apache_Software_License.txt → LICENSE_jsonschema-path_0_3_4_Apache_Software_License.txt} +0 -0
  116. /cmdbox/licenses/{LICENSE_jsonschema_4_24_0_UNKNOWN.txt → LICENSE_jsonschema_4_25_0_UNKNOWN.txt} +0 -0
  117. /cmdbox/licenses/{LICENSE_litellm_1_73_6_MIT_License.txt → LICENSE_litellm_1_74_12_MIT_License.txt} +0 -0
  118. /cmdbox/licenses/{LICENSE_mcp_1_10_1_MIT_License.txt → LICENSE_mcp_1_12_3_MIT_License.txt} +0 -0
  119. /cmdbox/licenses/{LICENSE_multidict_6_6_2_Apache_License_2_0.txt → LICENSE_multidict_6_6_3_Apache_License_2_0.txt} +0 -0
  120. /cmdbox/licenses/{LICENSE_nh3_0_2_21_MIT.txt → LICENSE_nh3_0_3_0_MIT.txt} +0 -0
  121. /cmdbox/licenses/{LICENSE_numpy_2_3_1_BSD_License.txt → LICENSE_numpy_2_3_2_BSD_License.txt} +0 -0
  122. /cmdbox/licenses/{LICENSE_openai_1_93_0_Apache_Software_License.txt → LICENSE_openai_1_98_0_Apache_Software_License.txt} +0 -0
  123. /cmdbox/licenses/{LICENSE_opentelemetry-sdk_1_34_1_Apache_Software_License.txt → LICENSE_opentelemetry-api_1_36_0_UNKNOWN.txt} +0 -0
  124. /cmdbox/licenses/{LICENSE_opentelemetry-semantic-conventions_0_55b1_Apache_Software_License.txt → LICENSE_opentelemetry-sdk_1_36_0_UNKNOWN.txt} +0 -0
  125. /cmdbox/licenses/{LICENSE_tokenizers_0_21_2_Apache_Software_License.txt → LICENSE_pywin32_311_Python_Software_Foundation_License.txt} +0 -0
  126. /cmdbox/licenses/{LICENSE_regex_2024_11_6_Apache_Software_License.txt → LICENSE_regex_2025_7_34_UNKNOWN.txt} +0 -0
  127. /cmdbox/licenses/{LICENSE_rich_14_0_0_MIT_License.txt → LICENSE_rich_14_1_0_MIT_License.txt} +0 -0
  128. /cmdbox/licenses/{LICENSE_rpds-py_0_25_1_MIT.txt → LICENSE_rpds-py_0_26_0_MIT.txt} +0 -0
  129. /cmdbox/licenses/{LICENSE_sse-starlette_2_3_6_BSD_License.txt → LICENSE_sse-starlette_3_0_2_UNKNOWN.txt} +0 -0
  130. /cmdbox/licenses/{LICENSE_starlette_0_46_2_BSD_License.txt → LICENSE_starlette_0_47_2_BSD_License.txt} +0 -0
  131. /cmdbox/licenses/{LICENSE_typing_extensions_4_14_0_UNKNOWN.txt → LICENSE_typing_extensions_4_14_1_UNKNOWN.txt} +0 -0
  132. /cmdbox/licenses/{LICENSE_zope_event_5_1_Zope_Public_License.txt → LICENSE_zope_event_5_1_1_Zope_Public_License.txt} +0 -0
  133. {cmdbox-0.6.3.1.dist-info → cmdbox-0.6.4.dist-info}/entry_points.txt +0 -0
  134. {cmdbox-0.6.3.1.dist-info → cmdbox-0.6.4.dist-info/licenses}/LICENSE +0 -0
  135. {cmdbox-0.6.3.1.dist-info → cmdbox-0.6.4.dist-info}/top_level.txt +0 -0
@@ -28,11 +28,16 @@ agent.format_agent_message = (container, messages, txt, message) => {
28
28
  if (!start || start.length < 0) {
29
29
  // JSON開始部分が無い場合はそのまま表示
30
30
  const msg = message.replace(/\n/g, '<br/>');
31
+ agent.say.say(msg);
31
32
  txt.append(msg);
32
33
  break;
33
34
  }
34
35
  start = message.substring(0, start.index);
35
- if (start) txt.append(start.replace(/\n/g, '<br/>'));
36
+ if (start) {
37
+ const msg = start.replace(/\n/g, '<br/>');
38
+ agent.say.say(msg);
39
+ txt.append(msg);
40
+ }
36
41
  message = message.replace(start+regs_start.source, '');
37
42
 
38
43
  // JSON内容部分を探す
@@ -92,6 +97,83 @@ agent.recursive_json_parse = (jobj) => {
92
97
  }
93
98
  });
94
99
  };
100
+ agent.say = {};
101
+ agent.say.model = 'ずんだもんノーマル';
102
+ agent.say.start = ()=> {
103
+ const opt = cmdbox.get_server_opt(false, $('#filer_form'));
104
+ opt['mode'] = 'tts';
105
+ opt['cmd'] = 'start';
106
+ opt['tts_engine'] = 'voicevox';
107
+ opt['voicevox_model'] = agent.say.model;
108
+ cmdbox.show_loading();
109
+ return cmdbox.sv_exec_cmd(opt).then(res => {
110
+ if (res && res['success']) res = [res];
111
+ cmdbox.hide_loading();
112
+ if (!res[0] || !res[0]['success']) {
113
+ if (res[0] && res[0]['warn']) throw res[0]['warn'];
114
+ else if (res['warn']) throw res['warn'];
115
+ throw res;
116
+ }
117
+ if (res[0]['success']['data']) return res[0]['success']['data'];
118
+ return res[0]['success'];
119
+ });
120
+ };
121
+ agent.say.stop = () => {
122
+ const opt = cmdbox.get_server_opt(false, $('#filer_form'));
123
+ opt['mode'] = 'tts';
124
+ opt['cmd'] = 'stop';
125
+ opt['tts_engine'] = 'voicevox';
126
+ opt['voicevox_model'] = agent.say.model;
127
+ cmdbox.show_loading();
128
+ return cmdbox.sv_exec_cmd(opt).then(res => {
129
+ if (res && res['success']) res = [res];
130
+ cmdbox.hide_loading();
131
+ if (!res[0] || !res[0]['success']) {
132
+ if (res[0] && res[0]['warn']) throw res[0]['warn'];
133
+ else if (res['warn']) throw res['warn'];
134
+ throw res;
135
+ }
136
+ if (res[0]['success']['data']) return res[0]['success']['data'];
137
+ return res[0]['success'];
138
+ });
139
+ };
140
+ agent.say.isStart = () => {
141
+ const btn_say = $('#btn_say');
142
+ return btn_say.hasClass('say_on')
143
+ };
144
+ agent.say.say = (tts_text) => {
145
+ if (!agent.say.isStart()) return;
146
+ const opt = cmdbox.get_server_opt(false, $('#filer_form'));
147
+ opt['mode'] = 'tts';
148
+ opt['cmd'] = 'say';
149
+ opt['tts_engine'] = 'voicevox';
150
+ opt['voicevox_model'] = agent.say.model;
151
+ opt['tts_text'] = tts_text;
152
+ cmdbox.show_loading();
153
+ return cmdbox.sv_exec_cmd(opt).then(async (res) => {
154
+ if (res && res['success']) res = [res];
155
+ cmdbox.hide_loading();
156
+ if (!res[0] || !res[0]['success']) {
157
+ if (res[0] && res[0]['warn']) throw res[0]['warn'];
158
+ throw res;
159
+ }
160
+ if (!res[0]['success']['data']) {
161
+ throw res[0]['success'];
162
+ }
163
+ // 音声データを再生
164
+ const binary_string = window.atob(res[0]['success']['data']);
165
+ const bytesArray = new Uint8Array(binary_string.length);
166
+ for (let i = 0; i < binary_string.length; i++) {
167
+ bytesArray[i] = binary_string.charCodeAt(i);
168
+ }
169
+ const audioContext = new (window.AudioContext || window.webkitAudioContext)();
170
+ const audioBuffer = await audioContext.decodeAudioData(bytesArray.buffer);
171
+ const source = audioContext.createBufferSource();
172
+ source.buffer = audioBuffer;
173
+ source.connect(audioContext.destination);
174
+ source.start(0);
175
+ });
176
+ };
95
177
  agent.init_form = async () => {
96
178
  const container = $('#message_container');
97
179
  const histories = $('#histories');
@@ -109,7 +191,9 @@ agent.init_form = async () => {
109
191
  clearInterval(agent.chat_callback_ping_handler);
110
192
  }
111
193
  messages.attr('data-session_id', session_id);
194
+ const btn_say = $('#btn_say');
112
195
  const btn_user_msg = $('#btn_user_msg');
196
+ const btn_rec = $('#btn_rec');
113
197
  const user_msg = $('#user_msg');
114
198
  let message_id = null;
115
199
  btn_user_msg.prop('disabled', true); // 初期状態で送信ボタンを無効化
@@ -134,6 +218,101 @@ agent.init_form = async () => {
134
218
  // メッセージ一覧を一番下までスクロール
135
219
  container.scrollTop(container.prop('scrollHeight'));
136
220
  });
221
+ // sayボタンのクリックイベント
222
+ btn_say.off('click').on('click', async () => {
223
+ if (agent.say.isStart()) {
224
+ agent.say.stop().then((msg) => {
225
+ //cmdbox.message(msg);
226
+ btn_say.removeClass('say_on');
227
+ btn_say.find('use').attr('href', '#btn_megaphone');
228
+ }).catch((err) => {
229
+ cmdbox.message(err);
230
+ if (err.startsWith('VoiceVox model is not running:')) {
231
+ btn_say.removeClass('say_on');
232
+ btn_say.find('use').attr('href', '#btn_megaphone');
233
+ }
234
+ });
235
+ return;
236
+ }
237
+ agent.say.start().then((msg) => {
238
+ //cmdbox.message(msg);
239
+ btn_say.addClass('say_on');
240
+ btn_say.find('use').attr('href', '#btn_megaphone_fill');
241
+ }).catch((err) => {
242
+ cmdbox.message(err);
243
+ if (err.startsWith('VoiceVox model is already running:')) {
244
+ btn_say.addClass('say_on');
245
+ btn_say.find('use').attr('href', '#btn_megaphone_fill');
246
+ }
247
+ });
248
+ });
249
+ // recボタンのクリックイベント
250
+ btn_rec.off('click').on('click', async () => {
251
+ // 録音を終了
252
+ if (btn_rec.hasClass('rec_on')) {
253
+ btn_rec.removeClass('rec_on');
254
+ btn_rec.find('use').attr('href', '#btn_mic');
255
+ // 録音中を停止
256
+ if (agent.recognition) {
257
+ agent.recognition.stop();
258
+ }
259
+ return;
260
+ }
261
+ // 録音を開始
262
+ const SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition;
263
+ if (!SpeechRecognition) {
264
+ cmdbox.message({'error':'Speech Recognition API is not supported in this browser.'});
265
+ return;
266
+ }
267
+ btn_rec.addClass('rec_on');
268
+ btn_rec.find('use').attr('href', '#btn_mic_fill');
269
+ let finalTranscript = user_msg.val();
270
+ agent.recognition = new SpeechRecognition();
271
+ agent.recognition.lang = 'ja-JP'; // 言語設定
272
+ agent.recognition.interimResults = true; // 中間結果を取得する
273
+ agent.recognition.maxAlternatives = 1; // 最小の候補数
274
+ agent.recognition.continuous = false; // 連続認識を無効にする
275
+ agent.recognition.onresult = (event) => {
276
+ let interimTranscript = '';
277
+ for (let i = event.resultIndex; i < event.results.length; i++) {
278
+ let transcript = event.results[i][0].transcript;
279
+ console.log(`transcript: ${transcript}`);
280
+ if (event.results[i].isFinal) {
281
+ finalTranscript += transcript;
282
+ } else {
283
+ interimTranscript = transcript;
284
+ }
285
+ }
286
+ user_msg.val(finalTranscript + interimTranscript);
287
+ };
288
+ agent.recognition.onerror = (event) => {
289
+ console.error(`Speech Recognition error: ${event.error}`);
290
+ if (event.error === 'no-speech') {
291
+ agent.recognition.restart();
292
+ return; // no-speechエラーは無視して再度認識を開始
293
+ }
294
+ btn_rec.removeClass('rec_on');
295
+ btn_rec.find('use').attr('href', '#btn_mic');
296
+ cmdbox.message({'error':`Speech Recognition error: ${event.error}`});
297
+ };
298
+ agent.recognition.onend = () => {
299
+ // 連続認識を無効にしているので、認識が終了したら再稼働させる。
300
+ console.log(`onend event triggered.`);
301
+ agent.recognition.restart();
302
+ };
303
+ agent.recognition.restart = () => {
304
+ if (btn_rec.hasClass('rec_on')) {
305
+ setTimeout(() => {
306
+ try {
307
+ agent.recognition.start();
308
+ } catch (error) {
309
+ console.error(`Error restarting recognition: ${error}`);
310
+ }
311
+ }, 100);
312
+ }
313
+ };
314
+ agent.recognition.start();
315
+ });
137
316
  // ws接続
138
317
  const protocol = window.location.protocol.endsWith('s:') ? 'wss' : 'ws';
139
318
  const host = window.location.hostname;
@@ -164,7 +343,9 @@ agent.init_form = async () => {
164
343
  ws.send('ping');
165
344
  agent.chat_reconnect_count = 0; // pingが成功したら再接続回数をリセット
166
345
  };
346
+ btn_say.prop('disabled', false);
167
347
  btn_user_msg.prop('disabled', false);
348
+ btn_rec.prop('disabled', false);
168
349
  agent.chat_callback_ping_handler = setInterval(() => {ping();}, ping_interval);
169
350
  };
170
351
  ws.onerror = (e) => {
@@ -1282,6 +1282,11 @@ cmdbox.add_form_func = (i, cmd_modal, row_content, row, next_elem, lcolsize=12,
1282
1282
  }
1283
1283
  else {
1284
1284
  // 選択肢がある場合
1285
+ let select_html = '<select class="form-select row_content_template_select"></select>';
1286
+ if (row.choice_edit){
1287
+ select_html = `<input type="text" class="form-control row_content_key row_content_template_input">`;
1288
+ select_html+= `<datalist class="row_content_template_select"></datalist>`;
1289
+ }
1285
1290
  if(row.type=='dict') {
1286
1291
  if (Array.isArray(row.choice)) {
1287
1292
  elem = $(`<div class="col-${lcolsize} mb-3">` // row_content_template_dict_choice
@@ -1289,7 +1294,7 @@ cmdbox.add_form_func = (i, cmd_modal, row_content, row, next_elem, lcolsize=12,
1289
1294
  +'<label class="input-group-text row_content_template_title">title</label>'
1290
1295
  +'<input type="text" class="form-control row_content_key row_content_template_input">'
1291
1296
  +'<label class="input-group-text">=</label>'
1292
- +'<select class="form-select row_content_template_select"></select>'
1297
+ + select_html
1293
1298
  +'</div></div>');
1294
1299
  }
1295
1300
  else {
@@ -1298,14 +1303,14 @@ cmdbox.add_form_func = (i, cmd_modal, row_content, row, next_elem, lcolsize=12,
1298
1303
  +'<label class="input-group-text row_content_template_title">title</label>'
1299
1304
  +'<select class="form-select row_content_key row_content_template_select"></select>'
1300
1305
  +'<label class="input-group-text">=</label>'
1301
- +'<select class="form-select row_content_template_select"></select>'
1306
+ + select_html
1302
1307
  +'</div></div>');
1303
1308
  }
1304
1309
  } else {
1305
1310
  elem = $(`<div class="col-${scolsize} mb-3">` // row_content_template_choice
1306
1311
  +'<div class="input-group">'
1307
1312
  +'<label class="input-group-text row_content_template_title">title</label>'
1308
- +'<select class="form-select row_content_template_select"></select>'
1313
+ + select_html
1309
1314
  +'</div></div>');
1310
1315
  }
1311
1316
  if (next_elem) next_elem.after(elem);
@@ -1386,6 +1391,14 @@ cmdbox.add_form_func = (i, cmd_modal, row_content, row, next_elem, lcolsize=12,
1386
1391
  if (row.web=='mask' || row.web=='readonly') {
1387
1392
  input_elem.attr('disabled', 'disabled');
1388
1393
  }
1394
+ // 選択肢編集可能な場合はinputのIDを参考にdatalistのIDを設定
1395
+ if (row.choice_edit) {
1396
+ input_elem.each((i, e) => {
1397
+ const elem = $(e), elem_id = elem.attr('id');
1398
+ elem.next().attr('id', elem_id + '_options');
1399
+ elem.attr('list', elem_id + '_options');
1400
+ });
1401
+ }
1389
1402
  // ファイルタイプの場合はファイラーモーダルを開くボタンを追加
1390
1403
  if(row.type=='file'){
1391
1404
  const btn = $('<button class="btn btn-secondary" type="button">file</button>');
@@ -118,5 +118,23 @@ init_svgicons = () => {
118
118
  `<symbol id="azure" viewBox="0 0 16 16">`
119
119
  +`<path d="M7.462 0H0v7.19h7.462zM16 0H8.538v7.19H16zM7.462 8.211H0V16h7.462zm8.538 0H8.538V16H16z"/>`
120
120
  +`</symbol>`);
121
+ svgicons.insertAdjacentHTML('beforeend',
122
+ `<symbol id="btn_megaphone" viewBox="0 0 16 16">`
123
+ +`<path d="M13 2.5a1.5 1.5 0 0 1 3 0v11a1.5 1.5 0 0 1-3 0v-.214c-2.162-1.241-4.49-1.843-6.912-2.083l.405 2.712A1 1 0 0 1 5.51 15.1h-.548a1 1 0 0 1-.916-.599l-1.85-3.49-.202-.003A2.014 2.014 0 0 1 0 9V7a2.02 2.02 0 0 1 1.992-2.013 75 75 0 0 0 2.483-.075c3.043-.154 6.148-.849 8.525-2.199zm1 0v11a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0m-1 1.35c-2.344 1.205-5.209 1.842-8 2.033v4.233q.27.015.537.036c2.568.189 5.093.744 7.463 1.993zm-9 6.215v-4.13a95 95 0 0 1-1.992.052A1.02 1.02 0 0 0 1 7v2c0 .55.448 1.002 1.006 1.009A61 61 0 0 1 4 10.065m-.657.975 1.609 3.037.01.024h.548l-.002-.014-.443-2.966a68 68 0 0 0-1.722-.082z"/>`
124
+ +`</symbol>`);
125
+ svgicons.insertAdjacentHTML('beforeend',
126
+ `<symbol id="btn_megaphone_fill" viewBox="0 0 16 16">`
127
+ +`<path d="M13 2.5a1.5 1.5 0 0 1 3 0v11a1.5 1.5 0 0 1-3 0zm-1 .724c-2.067.95-4.539 1.481-7 1.656v6.237a25 25 0 0 1 1.088.085c2.053.204 4.038.668 5.912 1.56zm-8 7.841V4.934c-.68.027-1.399.043-2.008.053A2.02 2.02 0 0 0 0 7v2c0 1.106.896 1.996 1.994 2.009l.496.008a64 64 0 0 1 1.51.048m1.39 1.081q.428.032.85.078l.253 1.69a1 1 0 0 1-.983 1.187h-.548a1 1 0 0 1-.916-.599l-1.314-2.48a66 66 0 0 1 1.692.064q.491.026.966.06"/>`
128
+ +`</symbol>`);
129
+ svgicons.insertAdjacentHTML('beforeend',
130
+ `<symbol id="btn_mic" viewBox="0 0 16 16">`
131
+ +`<path d="M3.5 6.5A.5.5 0 0 1 4 7v1a4 4 0 0 0 8 0V7a.5.5 0 0 1 1 0v1a5 5 0 0 1-4.5 4.975V15h3a.5.5 0 0 1 0 1h-7a.5.5 0 0 1 0-1h3v-2.025A5 5 0 0 1 3 8V7a.5.5 0 0 1 .5-.5"/>`
132
+ +`<path d="M10 8a2 2 0 1 1-4 0V3a2 2 0 1 1 4 0zM8 0a3 3 0 0 0-3 3v5a3 3 0 0 0 6 0V3a3 3 0 0 0-3-3"/>`
133
+ +`</symbol>`);
134
+ svgicons.insertAdjacentHTML('beforeend',
135
+ `<symbol id="btn_mic_fill" viewBox="0 0 16 16">`
136
+ +`<path d="M5 3a3 3 0 0 1 6 0v5a3 3 0 0 1-6 0z"/>`
137
+ +`<path d="M3.5 6.5A.5.5 0 0 1 4 7v1a4 4 0 0 0 8 0V7a.5.5 0 0 1 1 0v1a5 5 0 0 1-4.5 4.975V15h3a.5.5 0 0 1 0 1h-7a.5.5 0 0 1 0-1h3v-2.025A5 5 0 0 1 3 8V7a.5.5 0 0 1 .5-.5"/>`
138
+ +`</symbol>`);
121
139
  };
122
140
  init_svgicons();
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: cmdbox
3
- Version: 0.6.3.1
3
+ Version: 0.6.4
4
4
  Summary: cmdbox: It is a command line application with a plugin mechanism.
5
5
  Home-page: https://github.com/hamacom2004jp/cmdbox
6
6
  Download-URL: https://github.com/hamacom2004jp/cmdbox
@@ -36,14 +36,31 @@ Requires-Dist: pyjwt
36
36
  Requires-Dist: pystray
37
37
  Requires-Dist: python-multipart
38
38
  Requires-Dist: pycryptodome
39
+ Requires-Dist: pyyaml
39
40
  Requires-Dist: questionary
40
41
  Requires-Dist: redis
41
42
  Requires-Dist: requests
42
43
  Requires-Dist: rich
43
44
  Requires-Dist: six
44
45
  Requires-Dist: tabulate
45
- Requires-Dist: uvicorn[standard]
46
+ Requires-Dist: uvicorn
47
+ Requires-Dist: wsproto
46
48
  Requires-Dist: wheel
49
+ Dynamic: author
50
+ Dynamic: author-email
51
+ Dynamic: classifier
52
+ Dynamic: description
53
+ Dynamic: description-content-type
54
+ Dynamic: download-url
55
+ Dynamic: home-page
56
+ Dynamic: keywords
57
+ Dynamic: license
58
+ Dynamic: license-file
59
+ Dynamic: maintainer
60
+ Dynamic: maintainer-email
61
+ Dynamic: requires-dist
62
+ Dynamic: requires-python
63
+ Dynamic: summary
47
64
 
48
65
  # cmdbox (Command Development Application)
49
66
 
@@ -182,8 +199,8 @@ class ClientTime(feature.Feature):
182
199
  ret = dict(success=dict(data=dt.strftime('%Y-%m-%d %H:%M:%S')))
183
200
  common.print_format(ret, args.format, tm, args.output_json, args.output_json_append, pf=pf)
184
201
  if 'success' not in ret:
185
- return 1, ret, None
186
- return 0, ret, None
202
+ return self.RESP_WARN, ret, None
203
+ return self.RESP_SUCCESS, ret, None
187
204
 
188
205
  def edgerun(self, opt, tool, logger, timeout, prevres = None):
189
206
  status, res = tool.exec_cmd(opt, logger, timeout, prevres)
@@ -252,8 +269,8 @@ class ServerTime(feature.Feature):
252
269
  retry_count=args.retry_count, retry_interval=args.retry_interval, timeout=args.timeout)
253
270
  common.print_format(ret, args.format, tm, args.output_json, args.output_json_append, pf=pf)
254
271
  if 'success' not in ret:
255
- return 1, ret, None
256
- return 0, ret, None
272
+ return self.RESP_WARN, ret, None
273
+ return self.RESP_SUCCESS, ret, None
257
274
 
258
275
  def is_cluster_redirect(self):
259
276
  return False
@@ -265,7 +282,7 @@ class ServerTime(feature.Feature):
265
282
  dt = datetime.datetime.now(tz)
266
283
  ret = dict(success=dict(data=dt.strftime('%Y-%m-%d %H:%M:%S')))
267
284
  redis_cli.rpush(msg[1], ret)
268
- return self.RESP_SCCESS
285
+ return self.RESP_SUCCESS
269
286
 
270
287
  def edgerun(self, opt, tool, logger, timeout, prevres = None):
271
288
  status, res = tool.exec_cmd(opt, logger, timeout, prevres)
@@ -323,20 +340,11 @@ aliases: # Specify the alias for the specified co
323
340
  agentrule: # Specifies a list of rules that determine which commands the agent can execute.
324
341
  policy: deny # Specify the default policy for the rule. The value can be allow or deny.
325
342
  rules: # Specify the rules for the commands that the agent can execute according to the group to which the user belongs.
326
- - mode: audit # Specify the "mode" as the condition for applying the rule.
327
- cmds: [search, write] # Specify the "cmd" to which the rule applies. Multiple items can be specified in a list.
343
+ - mode: cmd # Specify the "mode" as the condition for applying the rule.
344
+ cmds: [list, load] # Specify the "cmd" to which the rule applies. Multiple items can be specified in a list.
328
345
  rule: allow # Specifies whether the specified command is allowed or not. Values are allow or deny.
329
346
  - mode: client
330
- cmds: [file_copy, file_download, file_list, file_mkdir, file_move, file_remove, file_rmdir, file_upload, server_info]
331
- rule: allow
332
- - mode: cmd
333
- cmds: [list, load]
334
- rule: allow
335
- - mode: server
336
- cmds: [list]
337
- rule: allow
338
- - mode: web
339
- cmds: [gencert, genpass, group_list, user_list]
347
+ cmds: [http]
340
348
  rule: allow
341
349
  audit:
342
350
  enabled: true # Specify whether to enable the audit function.