ai_co_discuss 0.4.4 → 0.4.6

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.
package/package.json CHANGED
@@ -1,95 +1,96 @@
1
- {
2
- "name": "ai_co_discuss",
3
- "version": "0.4.4",
4
- "bin": {
5
- "codiscuss": "runner/codiscuss.mjs"
6
- },
7
- "scripts": {
8
- "dev": "npm run build && wrangler pages dev --ip 127.0.0.1 --port 8787",
9
- "db:local": "wrangler d1 execute DB --local --file backend/schema.sql",
10
- "db:remote": "wrangler d1 execute DB --remote --file backend/schema.sql",
11
- "check": "node --check backend/worker.mjs && node --check web/app.js && node --check runner/admin_account.mjs && node --check runner/codiscuss.mjs && node --check runner/discussion_api.mjs && node --check runner/discussion_launch.mjs && node --check runner/discussion_local.mjs && node --check runner/discussion_runner.mjs && node --check runner/discussion_service.mjs && node --check runner/discussion_setup.mjs && node --check runner/discussion_sidecar.mjs && node --check runner/discussion_skills.mjs && node --check runner/discussion_tui.mjs && node --check runner/execution_progress.mjs && node --check runner/expert_prompts.mjs && node --check runner/files.mjs && node --check runner/free_runner.mjs && node --check runner/remote_launch.mjs && node --check runner/remote_policy.mjs && node --check runner/device_auth.mjs && node --check runner/webauthn.mjs && node --check runner/scheduler.mjs && node --check runner/session_driver.mjs && node --check runner/workflows.mjs && node --check runner/workflow_flow.mjs && node --check runner/adapters/antigravity_app.mjs && node --check runner/adapters/antigravity_cli.mjs && node --check runner/adapters/antigravity_sidecar.mjs && node --check runner/adapters/api.mjs && node --check runner/adapters/claude.mjs && node --check runner/adapters/cli.mjs && node --check runner/adapters/codex_app.mjs && node --check runner/adapters/codex_app_client.mjs && node --check runner/adapters/codex_cli.mjs && node --check runner/adapters/common.mjs && node --check runner/adapters/index.mjs && node --check runner/adapters/profiles.mjs",
12
- "runner": "node runner/discussion_runner.mjs",
13
- "service": "node runner/discussion_service.mjs",
14
- "build:ui": "vite build --config frontend/vite.config.mjs --mode markdown && vite build --config frontend/vite.config.mjs --mode backup && vite build --config frontend/vite.config.mjs",
15
- "test:markdown": "node --test tests/test_markdown.mjs",
16
- "build": "npm run check && npm run build:ui && node scripts/build_pages.mjs",
17
- "test:pages": "node --test tests/test_pages.mjs",
18
- "deploy": "npm run build && wrangler pages deploy --branch main --commit-dirty=true",
19
- "deploy:pages": "npm run deploy",
20
- "test": "npm run test:python && npm run test:js",
21
- "test:python": "python -m unittest discover -s tests -p test_*.py",
22
- "test:js": "node --test tests/test_*.mjs",
23
- "test:install": "node --test tests/test_setup.mjs tests/test_local.mjs tests/test_package.mjs"
24
- },
25
- "devDependencies": {
26
- "@iconify-json/lucide": "1.2.144",
27
- "@mdit/plugin-katex": "1.1.3",
28
- "@nuxt/ui": "4.11.3",
29
- "@tailwindcss/vite": "4.3.3",
30
- "@vitejs/plugin-vue": "6.0.10",
31
- "@vue-flow/background": "1.3.2",
32
- "@vue-flow/controls": "1.1.3",
33
- "@vue-flow/core": "1.48.2",
34
- "@vue-flow/minimap": "1.5.4",
35
- "fflate": "0.8.3",
36
- "jsqr": "1.4.0",
37
- "katex": "0.18.10",
38
- "markdown-it": "15.0.3",
39
- "markdown-it-cjk-friendly": "3.0.0",
40
- "motion-v": "2.7.0",
41
- "pdfjs-dist": "6.4.299",
42
- "uqr": "0.1.2",
43
- "vite": "8.3.4",
44
- "vue": "3.5.44",
45
- "wrangler": "4.151.0"
46
- },
47
- "description": "让不同 AI 在各自软件中协作的共享讨论空间",
48
- "keywords": [
49
- "ai",
50
- "multi-agent",
51
- "discussion",
52
- "cli",
53
- "codex",
54
- "claude",
55
- "gemini"
56
- ],
57
- "homepage": "https://github.com/huyan1458/ai_co_discuss#readme",
58
- "repository": {
59
- "type": "git",
60
- "url": "git+https://github.com/huyan1458/ai_co_discuss.git"
61
- },
62
- "bugs": {
63
- "url": "https://github.com/huyan1458/ai_co_discuss/issues"
64
- },
65
- "author": "huyan1458",
66
- "license": "MIT",
67
- "engines": {
68
- "node": ">=24"
69
- },
70
- "overrides": {
71
- "fontless": {
72
- "esbuild": "0.28.2"
73
- }
74
- },
75
- "files": [
76
- "runner/*.mjs",
77
- "runner/adapters/*.mjs",
78
- "runner/*.py",
79
- "backend/*.py",
80
- "backend/schema.sql",
81
- "backend/migrations/*.sql",
82
- "server.py",
83
- "web/**",
84
- ".agents/skills/discuss-host/**",
85
- ".agents/skills/discuss-participant/**",
86
- ".agents/skills/discuss-report/**",
87
- ".agents/skills/workflow-creator/**",
88
- ".agents/skills/local-tts-setup/**",
89
- "workflows/**",
90
- ".github/SECURITY.md",
91
- "docs/**",
92
- "!**/*.log",
93
- "LICENSE"
94
- ]
95
- }
1
+ {
2
+ "name": "ai_co_discuss",
3
+ "version": "0.4.6",
4
+ "bin": {
5
+ "codiscuss": "runner/codiscuss.mjs"
6
+ },
7
+ "scripts": {
8
+ "dev": "npm run build && wrangler pages dev --ip 127.0.0.1 --port 8787",
9
+ "db:local": "wrangler d1 execute DB --local --file backend/schema.sql",
10
+ "db:remote": "wrangler d1 execute DB --remote --file backend/schema.sql",
11
+ "check": "node --check backend/worker.mjs && node --check web/app.js && node --check runner/admin_account.mjs && node --check runner/codiscuss.mjs && node --check runner/discussion_api.mjs && node --check runner/discussion_launch.mjs && node --check runner/discussion_local.mjs && node --check runner/discussion_runner.mjs && node --check runner/discussion_service.mjs && node --check runner/discussion_setup.mjs && node --check runner/discussion_sidecar.mjs && node --check runner/discussion_skills.mjs && node --check runner/discussion_tui.mjs && node --check runner/execution_progress.mjs && node --check runner/expert_prompts.mjs && node --check runner/files.mjs && node --check runner/free_runner.mjs && node --check runner/remote_launch.mjs && node --check runner/remote_policy.mjs && node --check runner/device_auth.mjs && node --check runner/webauthn.mjs && node --check runner/scheduler.mjs && node --check runner/session_driver.mjs && node --check runner/workflows.mjs && node --check runner/workflow_flow.mjs && node --check runner/adapters/antigravity_app.mjs && node --check runner/adapters/antigravity_cli.mjs && node --check runner/adapters/antigravity_sidecar.mjs && node --check runner/adapters/api.mjs && node --check runner/adapters/claude.mjs && node --check runner/adapters/cli.mjs && node --check runner/adapters/codex_app.mjs && node --check runner/adapters/codex_app_client.mjs && node --check runner/adapters/codex_cli.mjs && node --check runner/adapters/common.mjs && node --check runner/adapters/index.mjs && node --check runner/adapters/profiles.mjs",
12
+ "runner": "node runner/discussion_runner.mjs",
13
+ "service": "node runner/discussion_service.mjs",
14
+ "build:ui": "vite build --config frontend/vite.config.mjs --mode markdown && vite build --config frontend/vite.config.mjs --mode backup && vite build --config frontend/vite.config.mjs",
15
+ "test:markdown": "node --test tests/test_markdown.mjs",
16
+ "build": "npm run check && npm run build:ui && node scripts/build_pages.mjs",
17
+ "test:pages": "node --test tests/test_pages.mjs",
18
+ "deploy": "npm run build && wrangler pages deploy --branch main --commit-dirty=true",
19
+ "deploy:pages": "npm run deploy",
20
+ "test": "npm run test:python && npm run test:js",
21
+ "test:python": "python -m unittest discover -s tests -p test_*.py",
22
+ "test:js": "node --test tests/test_*.mjs",
23
+ "test:install": "node --test tests/test_setup.mjs tests/test_local.mjs tests/test_package.mjs"
24
+ },
25
+ "devDependencies": {
26
+ "@iconify-json/lucide": "1.2.144",
27
+ "@mdit/plugin-katex": "1.1.3",
28
+ "@nuxt/ui": "4.11.3",
29
+ "@tailwindcss/vite": "4.3.3",
30
+ "@vitejs/plugin-vue": "6.0.10",
31
+ "@vue-flow/background": "1.3.2",
32
+ "@vue-flow/controls": "1.1.3",
33
+ "@vue-flow/core": "1.48.2",
34
+ "@vue-flow/minimap": "1.5.4",
35
+ "fflate": "0.8.3",
36
+ "jsqr": "1.4.0",
37
+ "katex": "0.18.10",
38
+ "markdown-it": "15.0.3",
39
+ "markdown-it-cjk-friendly": "3.0.0",
40
+ "motion-v": "2.7.0",
41
+ "pdfjs-dist": "6.4.299",
42
+ "uqr": "0.1.2",
43
+ "vite": "8.3.4",
44
+ "vue": "3.5.44",
45
+ "wrangler": "4.151.0"
46
+ },
47
+ "description": "让不同 AI 在各自软件中协作的共享讨论空间",
48
+ "keywords": [
49
+ "ai",
50
+ "multi-agent",
51
+ "discussion",
52
+ "cli",
53
+ "codex",
54
+ "claude",
55
+ "gemini"
56
+ ],
57
+ "homepage": "https://github.com/huyan1458/ai_co_discuss#readme",
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://github.com/huyan1458/ai_co_discuss.git"
61
+ },
62
+ "bugs": {
63
+ "url": "https://github.com/huyan1458/ai_co_discuss/issues"
64
+ },
65
+ "author": "huyan1458",
66
+ "license": "MIT",
67
+ "engines": {
68
+ "node": ">=24"
69
+ },
70
+ "overrides": {
71
+ "fontless": {
72
+ "esbuild": "0.28.2"
73
+ }
74
+ },
75
+ "files": [
76
+ "runner/*.mjs",
77
+ "runner/adapters/*.mjs",
78
+ "runner/*.py",
79
+ "backend/*.py",
80
+ "backend/schema.sql",
81
+ "backend/migrations/*.sql",
82
+ "server.py",
83
+ "web/**",
84
+ ".agents/skills/discuss-host/**",
85
+ ".agents/skills/discuss-participant/**",
86
+ ".agents/skills/discuss-report/**",
87
+ ".agents/skills/workflow-creator/**",
88
+ ".agents/skills/local-tts-setup/**",
89
+ ".agents/skills/local-stt-setup/**",
90
+ "workflows/**",
91
+ ".github/SECURITY.md",
92
+ "docs/**",
93
+ "!**/*.log",
94
+ "LICENSE"
95
+ ]
96
+ }
package/runner/discuss.py CHANGED
@@ -10,6 +10,7 @@ import re
10
10
  import secrets
11
11
  import sys
12
12
  import tempfile
13
+ import time
13
14
  from dataclasses import dataclass
14
15
  from http.client import HTTPException
15
16
  from pathlib import Path
@@ -19,6 +20,9 @@ from urllib.request import HTTPRedirectHandler, Request, build_opener
19
20
 
20
21
  VERSION = "0.2.0"
21
22
  DEFAULT_TIMEOUT = 20
23
+ # A refused connection never reached the site, so resending is safe; the local site is back within seconds of an upgrade restart.
24
+ REFUSED_RETRY_SECONDS = 10
25
+ REFUSED_RETRY_INTERVAL = 1.0
22
26
  MAX_BODY_BYTES = 512 * 1024
23
27
  MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024
24
28
  MAX_MESSAGE_ATTACHMENTS = 10
@@ -495,7 +499,7 @@ def sequence_commands(subcommands, registry):
495
499
  def build_parser(prog="discuss"):
496
500
  """Build help and schema from the same command definitions."""
497
501
  parser = Parser(prog=prog, description="AI CoDiscuss CLI:通过 HTTP 操作现有讨论网站。",
498
- allow_abbrev=False, epilog="站点、房间、操作者与执行编号省略时取自凭据文件;提交编号省略时按内容生成;不保存当前房间,不自动重试写入。")
502
+ allow_abbrev=False, epilog="站点、房间、操作者与执行编号省略时取自凭据文件;提交编号省略时按内容生成;不保存当前房间;只在连接被拒绝时于 10 秒内自动重试,其他写入失败不重试。")
499
503
  add_common(parser)
500
504
  parser.add_argument("--version", action="version", version=f"{prog} {VERSION}")
501
505
  subcommands = parser.add_subparsers(dest="resource", required=True)
@@ -1060,22 +1064,33 @@ def http_error(error, plan):
1060
1064
  outcome="unknown" if uncertain else "rejected")
1061
1065
 
1062
1066
 
1067
+ def connection_refused(error):
1068
+ """Whether the request failed before anything reached the site."""
1069
+ cause = error.reason if isinstance(error, URLError) else error
1070
+ return isinstance(cause, ConnectionRefusedError)
1071
+
1072
+
1063
1073
  def send_request(plan, url, timeout, headers=None):
1064
- """Send exactly once, preserving TLS verification and bounded waiting."""
1074
+ """Send once it is accepted, retrying only a refused connection, with TLS verification and bounded waiting."""
1065
1075
  data = request_data(plan)
1066
1076
  content_type = "application/octet-stream" if plan.upload_file is not None else "application/json"
1067
1077
  request = Request(url, data=data, method=plan.method,
1068
1078
  headers={"Content-Type": content_type, "Accept": "*/*" if plan.download_file else "application/json, text/plain",
1069
1079
  "User-Agent": f"AI-CoDiscuss-CLI/{VERSION}", **(headers or {})})
1070
- try:
1071
- with build_opener(NoRedirect()).open(request, timeout=timeout) as response:
1072
- return decode_response(response, plan)
1073
- except HTTPError as error:
1074
- with error:
1075
- raise http_error(error, plan) from error
1076
- except (URLError, OSError, HTTPException) as error:
1077
- raise CliError(f"网络请求失败: {error}", 3,
1078
- outcome="unknown" if plan.method == "POST" else "unavailable") from error
1080
+ deadline = time.monotonic() + REFUSED_RETRY_SECONDS
1081
+ while True:
1082
+ try:
1083
+ with build_opener(NoRedirect()).open(request, timeout=timeout) as response:
1084
+ return decode_response(response, plan)
1085
+ except HTTPError as error:
1086
+ with error:
1087
+ raise http_error(error, plan) from error
1088
+ except (URLError, OSError, HTTPException) as error:
1089
+ if connection_refused(error) and time.monotonic() < deadline:
1090
+ time.sleep(REFUSED_RETRY_INTERVAL)
1091
+ continue
1092
+ raise CliError(f"网络请求失败: {error}", 3,
1093
+ outcome="unknown" if plan.method == "POST" else "unavailable") from error
1079
1094
 
1080
1095
 
1081
1096
  def select_fields(value, names):
@@ -1136,7 +1151,7 @@ def command_schema(args, registry):
1136
1151
  if not name:
1137
1152
  return {"version": VERSION, "commands": {key: item.description for key, item in registry.items()},
1138
1153
  "exit_codes": EXIT_CODES, "site": "--site > DISCUSS_URL > 凭据(--access-file / DISCUSS_ACCESS_FILE / DISCUSS_ACCESS)中的 site;无内置默认站点",
1139
- "output": "默认 JSON;成功 stdout,错误 stderr;无交互提示、无自动重试"}
1154
+ "output": "默认 JSON;成功 stdout,错误 stderr;无交互提示;只在连接被拒绝时于 10 秒内自动重试"}
1140
1155
  if name not in registry:
1141
1156
  raise CliError(f"未知命令 {name};运行 discuss schema 查看可用命令")
1142
1157
  parser = registry[name]