ai_co_discuss 0.4.13 → 0.4.16
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/.agents/skills/discuss-host/SKILL.md +42 -42
- package/.agents/skills/workflow-creator/SKILL.md +155 -155
- package/.agents/skills/workflow-creator/references/model-selection.md +24 -23
- package/backend/free_room.py +15 -8
- package/backend/schema.sql +3 -1
- package/backend/server.py +146 -17
- package/docs/THIRD_PARTY_NOTICES.md +721 -1
- package/docs/runner.md +4 -2
- package/docs/workflow.md +1 -1
- package/package.json +10 -3
- package/runner/adapters/api.mjs +33 -7
- package/runner/adapters/api_files.mjs +21 -0
- package/runner/adapters/api_images.mjs +245 -0
- package/runner/adapters/index.mjs +186 -186
- package/runner/adapters/profiles.mjs +152 -139
- package/runner/discussion_launch.mjs +49 -11
- package/runner/free_runner.mjs +1286 -1281
- package/runner/project_files.mjs +390 -330
- package/runner/relay_channel.mjs +326 -325
- package/runner/remote_launch.mjs +2 -2
- package/runner/stt.mjs +135 -111
- package/runner/tts.mjs +180 -172
- package/runner/tts_providers.mjs +479 -435
- package/runner/workflows.mjs +606 -606
- package/web/app.js +82 -12
- package/web/backup.js +1 -1
- package/web/markdown.css +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +663 -40
- package/web/office/assets/pptx-source-worker-559Vl2R3.mjs +446 -0
- package/web/office/assets/pptx_parser_bg-DON650C_.wasm +0 -0
- package/web/office/assets/render-worker-Ck21oePL-D_L2C4am.js +16 -0
- package/web/office/chunks/comment-ui-runtime-Bp37ytDC-CEDIeFBy.js +125 -0
- package/web/office/chunks/emf--QWY-UlT-D7lCNost.js +1 -0
- package/web/office/chunks/font-preload-demand-NqcVKIpX-_QhVEaPJ.js +1 -0
- package/web/office/chunks/plot-area-frame-DNYMd9Pf-B0ScWz_J.js +2 -0
- package/web/office/chunks/pptx-DbjWegUB-CU8ZIJEP.js +4 -0
- package/web/office/chunks/presentation-model-source-DLNioq7T-Demo5cCW.js +1 -0
- package/web/office/chunks/render-worker-host-CVr53kg0-DUcW76F6.js +1 -0
- package/web/office/chunks/slide-pull-client-3g6TxaKa-BohMnKOC.js +12 -0
- package/web/office/chunks/worker-source-ZQE9C1j6-B31UTbq3.js +1 -0
- package/web/office/docx.js +21 -0
- package/web/office/pptx.js +1 -0
- package/web/office/xlsx.js +64 -0
|
@@ -1,139 +1,152 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What each supported software is and can do, as plain data: the adapter layer's static facts. Imports nothing, so the
|
|
3
|
-
* runner, the launch settings and the web page (bundled by Vite) all read the same table; behaviour lives in each
|
|
4
|
-
* software's own module (see index.mjs). Product code reads these fields, never a software name (AGENTS.md red line 9).
|
|
5
|
-
*
|
|
6
|
-
* Fields of one profile:
|
|
7
|
-
* - `platform`: the AI platform it serves (`Codex`, `Claude`, `Antigravity`); '' serves any platform (model API).
|
|
8
|
-
* - `label`: display name. `kind`: `cli` (a process the runner starts), `app` (a desktop App) or `api` (the runner's own call).
|
|
9
|
-
* - `location`: the config field locating the installed software (`executable`, `ipc_directory`), or '' when none.
|
|
10
|
-
* - `fields`: further config fields the user may set for it.
|
|
11
|
-
* - `efforts`: thinking levels it accepts, or null when chosen inside the App; `efforts_per_model`: the levels are read
|
|
12
|
-
* from the software for the chosen model. `models`: whether its CLI lists models.
|
|
13
|
-
* - `access_levels`: project access levels it can enforce per run, or null when the App or API decides; `access_hints`
|
|
14
|
-
* says what each level does in it (measured headless on Claude Code 2.1.312, Codex CLI 0.163, agy 1.4.10; not yet
|
|
15
|
-
* rechecked on Claude Code 2.1.319 or agy 1.5.2) and
|
|
16
|
-
* `unsupported_hints` why a level it lacks is disabled.
|
|
17
|
-
* - `per_tool_allow`: a refused operation can be allowed one rule at a time.
|
|
18
|
-
* - `client`: the software a manual member says it runs in when it registers (`codex`, `claude`, `antigravity`).
|
|
19
|
-
* - `adopt`: an existing conversation can be taken over: `session`, or `own_cwd` when it must resume in the directory it
|
|
20
|
-
* was made in; '' when it cannot. `host_existing`: it may also host from, or be bound to, an existing conversation.
|
|
21
|
-
* `own_project_when_bound`: bound to an existing conversation, it keeps that conversation's project and permissions.
|
|
22
|
-
* `restore_manual`: a restored room keeps it manual, never taken over (a background resume would fork the session
|
|
23
|
-
* away from its original window).
|
|
24
|
-
* `resume_command(session_id)`: a command the owner can copy to reopen a restored manual conversation.
|
|
25
|
-
* - `defaults_by_query`: its default model is read by running it (seconds), so a quick read leaves it for later.
|
|
26
|
-
* - `capabilities`: `delivery` `{stoppable, progress}` of a usual delivery (each delivery reports its own); `rewind`: `cut`
|
|
27
|
-
* (the runner cuts the session), `fresh` (context rebuilt each time) or `kept` (cannot be cut here); `project` (works in
|
|
28
|
-
* a project directory); `access_env` (its process takes the credential file by environment); `enforces_read_only`
|
|
29
|
-
* (its sandbox enforces a read-only project); `ripgrep` (bundles rg for reading on Windows); `file_tools` (works on
|
|
30
|
-
* the project only through the runner's file tools, running no commands); `limits_directories` (a directory it may
|
|
31
|
-
* only read stays read-only even while it may write elsewhere and run commands: a sandbox or file tools, not rules
|
|
32
|
-
* that a command could bypass); `chat` (the owner's private chat runs as a turn of its own session and its reply is
|
|
33
|
-
* read from the software's output); `resume` (a stopped turn can go on in the same session, so the owner may pause
|
|
34
|
-
* a room execution from the private chat without ending it; not yet measured on real software).
|
|
35
|
-
* - `session_family`: profiles sharing one session store; switching among them keeps the conversation.
|
|
36
|
-
* - `windows_command`: how its shell names the codiscuss CLI on Windows.
|
|
37
|
-
* - `task_rules(cli, {runs_commands})`: fixed task text this software needs, added by the runner so no member prompt drops it.
|
|
38
|
-
*/
|
|
39
|
-
const ALL_ACCESS = ['read', 'write', 'auto', 'full'];
|
|
40
|
-
/** API slot defaults; identity and wire protocol stay independent, and a custom slot starts without a provider. */
|
|
41
|
-
export const API_PROVIDERS = {
|
|
42
|
-
Codex: { label: 'OpenAI', base_url: 'https://api.openai.com/v1', api_protocol: 'responses', models: ['gpt-6.1-sol', 'gpt-6-astra', 'gpt-6-luna'] },
|
|
43
|
-
Claude: { label: 'Anthropic', base_url: 'https://api.anthropic.com/v1', api_protocol: 'anthropic', models: ['claude-sonnet-5-5', 'claude-opus-5-5', 'claude-haiku-5-5', 'claude-fable-5-1'] },
|
|
44
|
-
Antigravity: { label: 'Google', base_url: 'https://generativelanguage.googleapis.com/v1beta', api_protocol: 'gemini', models: ['gemini-4-argon', 'gemini-3.8-flash'] },
|
|
45
|
-
DeepSeek: { label: 'DeepSeek', base_url: 'https://api.deepseek.com/v1', api_protocol: 'chat', models: ['deepseek-flash', 'deepseek-v4-pro'] },
|
|
46
|
-
Qwen: { label: '阿里云百炼', base_url: 'https://dashscope.aliyuncs.com/compatible-mode/v1', api_protocol: 'chat', models: ['qwen3.8-flash', 'qwen3.7-plus', 'qwen3.8-max'] },
|
|
47
|
-
Grok: { label: 'xAI', base_url: 'https://api.x.ai/v1', api_protocol: 'responses', models: ['grok-4.7'] },
|
|
48
|
-
OpenAI: { label: 'OpenAI', base_url: 'https://api.openai.com/v1', api_protocol: 'responses', models: ['gpt-6.1-sol', 'gpt-6-astra', 'gpt-6-luna'] },
|
|
49
|
-
Custom: { label: '自定义 API', base_url: '', api_protocol: 'chat', models: [] },
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
platform: 'Codex', label: 'Codex
|
|
68
|
-
efforts:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
client: '
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
capabilities: { delivery:
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
1
|
+
/**
|
|
2
|
+
* What each supported software is and can do, as plain data: the adapter layer's static facts. Imports nothing, so the
|
|
3
|
+
* runner, the launch settings and the web page (bundled by Vite) all read the same table; behaviour lives in each
|
|
4
|
+
* software's own module (see index.mjs). Product code reads these fields, never a software name (AGENTS.md red line 9).
|
|
5
|
+
*
|
|
6
|
+
* Fields of one profile:
|
|
7
|
+
* - `platform`: the AI platform it serves (`Codex`, `Claude`, `Antigravity`); '' serves any platform (model API).
|
|
8
|
+
* - `label`: display name. `kind`: `cli` (a process the runner starts), `app` (a desktop App) or `api` (the runner's own call).
|
|
9
|
+
* - `location`: the config field locating the installed software (`executable`, `ipc_directory`), or '' when none.
|
|
10
|
+
* - `fields`: further config fields the user may set for it.
|
|
11
|
+
* - `efforts`: thinking levels it accepts, or null when chosen inside the App; `efforts_per_model`: the levels are read
|
|
12
|
+
* from the software for the chosen model. `models`: whether its CLI lists models.
|
|
13
|
+
* - `access_levels`: project access levels it can enforce per run, or null when the App or API decides; `access_hints`
|
|
14
|
+
* says what each level does in it (measured headless on Claude Code 2.1.312, Codex CLI 0.163, agy 1.4.10; not yet
|
|
15
|
+
* rechecked on Claude Code 2.1.319 or agy 1.5.2) and
|
|
16
|
+
* `unsupported_hints` why a level it lacks is disabled.
|
|
17
|
+
* - `per_tool_allow`: a refused operation can be allowed one rule at a time.
|
|
18
|
+
* - `client`: the software a manual member says it runs in when it registers (`codex`, `claude`, `antigravity`).
|
|
19
|
+
* - `adopt`: an existing conversation can be taken over: `session`, or `own_cwd` when it must resume in the directory it
|
|
20
|
+
* was made in; '' when it cannot. `host_existing`: it may also host from, or be bound to, an existing conversation.
|
|
21
|
+
* `own_project_when_bound`: bound to an existing conversation, it keeps that conversation's project and permissions.
|
|
22
|
+
* `restore_manual`: a restored room keeps it manual, never taken over (a background resume would fork the session
|
|
23
|
+
* away from its original window).
|
|
24
|
+
* `resume_command(session_id)`: a command the owner can copy to reopen a restored manual conversation.
|
|
25
|
+
* - `defaults_by_query`: its default model is read by running it (seconds), so a quick read leaves it for later.
|
|
26
|
+
* - `capabilities`: `delivery` `{stoppable, progress}` of a usual delivery (each delivery reports its own); `rewind`: `cut`
|
|
27
|
+
* (the runner cuts the session), `fresh` (context rebuilt each time) or `kept` (cannot be cut here); `project` (works in
|
|
28
|
+
* a project directory); `access_env` (its process takes the credential file by environment); `enforces_read_only`
|
|
29
|
+
* (its sandbox enforces a read-only project); `ripgrep` (bundles rg for reading on Windows); `file_tools` (works on
|
|
30
|
+
* the project only through the runner's file tools, running no commands); `limits_directories` (a directory it may
|
|
31
|
+
* only read stays read-only even while it may write elsewhere and run commands: a sandbox or file tools, not rules
|
|
32
|
+
* that a command could bypass); `chat` (the owner's private chat runs as a turn of its own session and its reply is
|
|
33
|
+
* read from the software's output); `resume` (a stopped turn can go on in the same session, so the owner may pause
|
|
34
|
+
* a room execution from the private chat without ending it; not yet measured on real software).
|
|
35
|
+
* - `session_family`: profiles sharing one session store; switching among them keeps the conversation.
|
|
36
|
+
* - `windows_command`: how its shell names the codiscuss CLI on Windows.
|
|
37
|
+
* - `task_rules(cli, {runs_commands})`: fixed task text this software needs, added by the runner so no member prompt drops it.
|
|
38
|
+
*/
|
|
39
|
+
const ALL_ACCESS = ['read', 'write', 'auto', 'full'];
|
|
40
|
+
/** API slot defaults; identity and wire protocol stay independent, and a custom slot starts without a provider. */
|
|
41
|
+
export const API_PROVIDERS = {
|
|
42
|
+
Codex: { label: 'OpenAI', base_url: 'https://api.openai.com/v1', api_protocol: 'responses', models: ['gpt-6.1-sol', 'gpt-6-astra', 'gpt-6-luna'] },
|
|
43
|
+
Claude: { label: 'Anthropic', base_url: 'https://api.anthropic.com/v1', api_protocol: 'anthropic', models: ['claude-sonnet-5-5', 'claude-opus-5-5', 'claude-haiku-5-5', 'claude-fable-5-1'] },
|
|
44
|
+
Antigravity: { label: 'Google', base_url: 'https://generativelanguage.googleapis.com/v1beta', api_protocol: 'gemini', models: ['gemini-4-argon', 'gemini-3.8-flash'] },
|
|
45
|
+
DeepSeek: { label: 'DeepSeek', base_url: 'https://api.deepseek.com/v1', api_protocol: 'chat', models: ['deepseek-flash', 'deepseek-v4-pro'] },
|
|
46
|
+
Qwen: { label: '阿里云百炼', base_url: 'https://dashscope.aliyuncs.com/compatible-mode/v1', api_protocol: 'chat', models: ['qwen3.8-flash', 'qwen3.7-plus', 'qwen3.8-max'] },
|
|
47
|
+
Grok: { label: 'xAI', base_url: 'https://api.x.ai/v1', api_protocol: 'responses', models: ['grok-4.7'] },
|
|
48
|
+
OpenAI: { label: 'OpenAI', base_url: 'https://api.openai.com/v1', api_protocol: 'responses', models: ['gpt-6.1-sol', 'gpt-6-astra', 'gpt-6-luna'] },
|
|
49
|
+
Custom: { label: '自定义 API', base_url: '', api_protocol: 'chat', models: [] },
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Image models a model API member may call through the Images API (`image_model`), newest first: 2.6 adds complexity,
|
|
53
|
+
* SVG and GIF output; 2.5 and 2.6 take markup edits and the xhigh / max qualities (OpenAI docs, 2026-11-10). Any other
|
|
54
|
+
* ID may still be typed in. Only the protocols below share the Images API's address and Bearer authentication.
|
|
55
|
+
*/
|
|
56
|
+
export const IMAGE_MODELS = ['gpt-image-2.6-flare', 'gpt-image-2.6-sunburst', 'gpt-image-2.5-flare', 'gpt-image-2.5-sunburst',
|
|
57
|
+
'gpt-image-2', 'gpt-image-1.5', 'gpt-image-1-mini', 'chatgpt-image-latest'];
|
|
58
|
+
export const IMAGE_PROTOCOLS = ['responses', 'chat'];
|
|
59
|
+
/** Model requests one model-API execution may make unless the room sets its own; 0 means no limit, up to the maximum. */
|
|
60
|
+
export const DEFAULT_API_MAX_REQUESTS = 300;
|
|
61
|
+
export const MAX_API_MAX_REQUESTS = 1000;
|
|
62
|
+
const PROCESS = { stoppable: true, progress: true };
|
|
63
|
+
const IN_APP = { stoppable: false, progress: false };
|
|
64
|
+
|
|
65
|
+
export const ADAPTER_PROFILES = {
|
|
66
|
+
codex_cli: {
|
|
67
|
+
platform: 'Codex', label: 'Codex CLI', kind: 'cli', location: 'executable', fields: ['project_id', 'project_name'],
|
|
68
|
+
efforts: ['low', 'medium', 'high', 'xhigh', 'max', 'ultra'], models: true, access_levels: ALL_ACCESS, per_tool_allow: false,
|
|
69
|
+
access_hints: { read: '只读沙箱', write: '项目可写的沙箱,命令在沙箱内运行、可联网',
|
|
70
|
+
auto: '沙箱外的操作由模型申请提权,Codex 自动审核代替人工批准', full: '无沙箱、无审批(--dangerously-bypass-approvals-and-sandbox)' },
|
|
71
|
+
client: 'codex', adopt: 'session', host_existing: true, session_family: 'codex',
|
|
72
|
+
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, enforces_read_only: true, limits_directories: true, ripgrep: true, chat: true, resume: true },
|
|
73
|
+
},
|
|
74
|
+
codex: {
|
|
75
|
+
platform: 'Codex', label: 'Codex App', kind: 'app', location: 'executable', fields: ['source_thread_id', 'project_id', 'project_name'],
|
|
76
|
+
efforts: null, models: false, access_levels: null, per_tool_allow: false,
|
|
77
|
+
client: 'codex', adopt: 'session', host_existing: true, session_family: 'codex',
|
|
78
|
+
capabilities: { delivery: IN_APP, rewind: 'cut', project: true, chat: true },
|
|
79
|
+
},
|
|
80
|
+
claude: {
|
|
81
|
+
platform: 'Claude', label: 'Claude Code', kind: 'cli', location: 'executable', fields: ['allowed_tools'],
|
|
82
|
+
efforts: ['low', 'medium', 'high', 'xhigh', 'max'], models: true, access_levels: ALL_ACCESS, per_tool_allow: true,
|
|
83
|
+
access_hints: { read: '只放行网站命令与草稿,不改项目文件、不跑其他命令', write: '可改项目文件,Bash / PowerShell 命令全部放行(无沙箱)',
|
|
84
|
+
auto: 'Claude auto 模式:由分类器判断,实测项目外写入和联网都会放行', full: 'bypassPermissions:跳过全部权限检查' },
|
|
85
|
+
client: 'claude', adopt: 'own_cwd', host_existing: true, restore_manual: true,
|
|
86
|
+
resume_command: session_id => `claude --resume ${session_id}`,
|
|
87
|
+
// Claude Code runs commands through bash on Windows too, where the npm shim works without .cmd.
|
|
88
|
+
windows_command: 'codiscuss',
|
|
89
|
+
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, chat: true, resume: true },
|
|
90
|
+
},
|
|
91
|
+
antigravity_cli: {
|
|
92
|
+
platform: 'Antigravity', label: 'Antigravity CLI', kind: 'cli', location: 'executable', fields: ['project_id', 'project_name'],
|
|
93
|
+
efforts: ['low', 'medium', 'high', 'xhigh', 'max'], efforts_per_model: true, models: true, defaults_by_query: true,
|
|
94
|
+
// Headless agy refuses `--mode auto` ("not available for this account", 1.4.10–1.4.11), so 自动 is not offered.
|
|
95
|
+
access_levels: ['read', 'write', 'full'], per_tool_allow: true,
|
|
96
|
+
access_hints: { read: '只放行网站命令;碰到未放行的命令会直接结束本轮', write: '可写项目,命令全部放行(在 agy 沙箱内)',
|
|
97
|
+
full: '跳过全部权限确认(--dangerously-skip-permissions),并放开沙箱外命令与 MCP 工具' },
|
|
98
|
+
unsupported_hints: { auto: 'agy 只在交互窗口提供自动模式,后台运行(-p)不支持' },
|
|
99
|
+
// Only a conversation this tool created gets its discussion project; an existing one keeps its own project and permissions.
|
|
100
|
+
client: 'antigravity', adopt: 'session', host_existing: false, own_project_when_bound: true,
|
|
101
|
+
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, chat: true },
|
|
102
|
+
// A read-only agy project allows only codiscuss commands and headless agy ends the turn on a denied one; agy streams no
|
|
103
|
+
// thinking text, so without a word at each turning point the page cannot show how far it got.
|
|
104
|
+
task_rules: (cli, { runs_commands }) => (runs_commands ? ''
|
|
105
|
+
: `无人值守下 run_command 只能运行 ${cli} 的 subcommands 子命令,其他命令会被自动拒绝并使会话直接结束;列目录、搜索或读取文件用 list_dir、find_by_name、grep_search、view_file。`)
|
|
106
|
+
+ '多步任务中,在关键转折处用一句话写出进展再继续:agy 不输出思考过程,网页只能靠这些话显示你做到哪一步。',
|
|
107
|
+
},
|
|
108
|
+
antigravity: {
|
|
109
|
+
platform: 'Antigravity', label: 'Antigravity App', kind: 'app', location: 'ipc_directory', fields: ['project_id', 'project_name'],
|
|
110
|
+
efforts: null, models: false, access_levels: null, per_tool_allow: false,
|
|
111
|
+
client: 'antigravity', adopt: 'session', host_existing: true,
|
|
112
|
+
capabilities: { delivery: IN_APP, rewind: 'kept', project: true, chat: true },
|
|
113
|
+
},
|
|
114
|
+
api: {
|
|
115
|
+
platform: '', label: '模型 API', kind: 'api', location: '', fields: ['base_url', 'api_protocol', 'api_key_ref', 'image_model'],
|
|
116
|
+
efforts: null, models: false, access_levels: ['read', 'write'], per_tool_allow: false, adopt: '', host_existing: false,
|
|
117
|
+
access_hints: { read: '用接入程序的文件工具读取、搜索项目文件,可运行工作流登记的只读命令',
|
|
118
|
+
write: '还可新建、覆盖、局部编辑项目文件,可运行工作流登记的全部命令;没有通用命令行' },
|
|
119
|
+
unsupported_hints: { auto: 'API 成员没有通用命令行,没有需要软件审批的操作', full: 'API 成员没有通用命令行,没有需要软件审批的操作' },
|
|
120
|
+
capabilities: { delivery: PROCESS, rewind: 'fresh', project: true, file_tools: true, limits_directories: true, chat: true },
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** The image model a member's profile can generate images with: a model API on an OpenAI-style protocol; '' for none. */
|
|
125
|
+
export function image_model_of(profile) {
|
|
126
|
+
return ADAPTER_PROFILES[profile?.adapter]?.kind === 'api' && IMAGE_PROTOCOLS.includes(profile.api_protocol) ? profile.image_model || '' : '';
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Every configured `adapter` value this version supports. */
|
|
130
|
+
export const ADAPTER_IDS = Object.keys(ADAPTER_PROFILES);
|
|
131
|
+
|
|
132
|
+
/** The profile of one adapter with its defaults filled in, or null for a value this version does not support. */
|
|
133
|
+
export function adapter_profile(id) {
|
|
134
|
+
const profile = ADAPTER_PROFILES[id];
|
|
135
|
+
return profile ? { id, session_family: id, windows_command: 'codiscuss.cmd', ...profile } : null;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Whether two different adapters share one session store, so switching between them keeps the conversation. */
|
|
139
|
+
export function same_session_family(left, right) {
|
|
140
|
+
const [a, b] = [adapter_profile(left), adapter_profile(right)];
|
|
141
|
+
return Boolean(a && b && left !== right && a.session_family === b.session_family);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** The adapters serving one platform, in table order; a model API serves every platform. */
|
|
145
|
+
export function platform_adapters(platform) {
|
|
146
|
+
return ADAPTER_IDS.filter(id => ADAPTER_PROFILES[id].platform === platform || ADAPTER_PROFILES[id].platform === '');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** What an adapter can do; an unknown adapter can do nothing. */
|
|
150
|
+
export function adapter_capabilities(id) {
|
|
151
|
+
return ADAPTER_PROFILES[id]?.capabilities || { delivery: IN_APP, rewind: 'kept', project: false };
|
|
152
|
+
}
|
|
@@ -10,7 +10,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
10
10
|
import { parseArgs } from 'node:util';
|
|
11
11
|
|
|
12
12
|
import { atomic_json } from './files.mjs';
|
|
13
|
-
import { bundle_project_page, outside_directory, read_only_enforced, read_project_files, room_directories, search_project_roots } from './project_files.mjs';
|
|
13
|
+
import { bundle_project_markdown, bundle_project_page, outside_directory, project_media, read_only_enforced, read_project_files, room_directories, search_project_roots } from './project_files.mjs';
|
|
14
14
|
import { guard_remote_request, list_remote_directories } from './remote_policy.mjs';
|
|
15
15
|
import { list_devices, machine_fingerprint, revoke_device, start_pairing } from './device_auth.mjs';
|
|
16
16
|
import { setup_sidecar } from './adapters/antigravity_app.mjs';
|
|
@@ -48,7 +48,7 @@ function free_instance(name, taken) {
|
|
|
48
48
|
|
|
49
49
|
/** Supported local clients of an instance's platform. */
|
|
50
50
|
function clients_of(name) { return platform_adapters(platform_of(name)); }
|
|
51
|
-
const PROFILE_FIELDS = ['adapter', 'executable', 'model', 'effort', 'source_thread_id', 'ipc_directory', 'allowed_tools', 'cwd', 'project_name', 'project_id', 'base_url', 'api_protocol', 'api_key_ref', 'system_prompt'];
|
|
51
|
+
const PROFILE_FIELDS = ['adapter', 'executable', 'model', 'effort', 'source_thread_id', 'ipc_directory', 'allowed_tools', 'cwd', 'project_name', 'project_id', 'base_url', 'api_protocol', 'api_key_ref', 'image_model', 'system_prompt'];
|
|
52
52
|
const MAX_MINUTES = 1440;
|
|
53
53
|
const SESSION_ID_PATTERN = /^[0-9A-Za-z_-]{8,128}$/;
|
|
54
54
|
const LOCAL_MEMBERS_FORMAT = 'ai-codiscuss-local-members';
|
|
@@ -61,6 +61,7 @@ const HELP = `用法:codiscuss launch settings [--file FILE]
|
|
|
61
61
|
codiscuss launch room-models --file FILE
|
|
62
62
|
codiscuss launch room-files --file FILE
|
|
63
63
|
codiscuss launch room-page --file FILE
|
|
64
|
+
codiscuss launch room-media --file FILE
|
|
64
65
|
codiscuss launch execution-details --file FILE
|
|
65
66
|
codiscuss launch models --file FILE
|
|
66
67
|
codiscuss launch api-key --file FILE
|
|
@@ -97,13 +98,14 @@ start 使用启动 JSON 创建或接入房间并启动;--dry-run 只校验和
|
|
|
97
98
|
room-config 修正已暂停房间的软件路径或切换 Codex App / CLI,不启动讨论;须提供 site、room_id、token。
|
|
98
99
|
room-models 只读指定 site、room_id 的本机登记模型与思考强度,不启动讨论;quick 为 true 时不查询 agy 的默认模型(较慢),该成员标 defaults_pending。
|
|
99
100
|
room-files 只读房间已保存的项目目录,须提供 site、room_id、token,可选相对 path 和目录分页 offset;文件返回最多前 128 KiB 文本;给 query 时改为按名称搜索整个项目(含 / 时按路径),最多返回 50 项。
|
|
100
|
-
room-page 只读项目目录里的一个 HTML 文件(path,可选 root),把它按相对路径引用的样式、脚本、图片、字体与音视频内联为 data URL,以 base64 的 data 返回(最多 8 MiB
|
|
101
|
+
room-page 只读项目目录里的一个 HTML 文件(path,可选 root),把它按相对路径引用的样式、脚本、图片、字体与音视频内联为 data URL,以 base64 的 data 返回(最多 8 MiB);Markdown 文件则返回它按相对路径引用的项目图片 {项目路径: data URL} 的 JSON;其他设备经中转时分段返回,按 offset 续读并核对 version;未能载入的引用列在 missing(不存在或在项目目录外)与 skipped(超出大小)。
|
|
102
|
+
room-media 核对项目目录里的一个图片、视频或音频文件(path,可选 root)可读:本机网站凭它登记一个 10 分钟有效的播放地址,按 Range 直接读盘,网页拿不到文件路径;其他设备经中转时分段返回 base64 的 data(按 offset 续读并核对 version),最多 64 MB。
|
|
101
103
|
execution-details 只读房间某次执行的过程细节(中间说明、命令与输出、搜索、改动、工具调用),由本机日志还原,须提供 site、room_id、token、execution_id;细节只留在本机,不写入网站。
|
|
102
104
|
models 按 adapter、executable 或 API profile 读取模型目录,不启动讨论或生成回答。
|
|
103
105
|
api-key 将 base_url、api_key 保存于本机私有目录,只返回 api_key_ref。
|
|
104
106
|
api-check 用 API profile 向模型发送一次极短请求,核对地址、密钥、协议与模型是否可用。
|
|
105
107
|
scheduler-check 用智能调度配置(provider、model、api_key_ref)向决策模型发送一道是非题,核对供应商、模型与密钥是否可用。
|
|
106
|
-
tts-settings 读取朗读设置;内容非空时保存(语音服务 provider:volcengine / aliyun / azure /
|
|
108
|
+
tts-settings 读取朗读设置;内容非空时保存(语音服务 provider:local(本机,由 local-tts-setup 技能安装)/ volcengine / aliyun / azure / openai,语速 speech_rate,以及 providers.<服务> 的 api_key_ref、speaker、member_voices、file_voice,本机、火山引擎与 OpenAI 另有语气提示 context(各自默认不同),Azure 另有 region;语音输入服务 stt_provider:local / volcengine / openai)。
|
|
107
109
|
tts 用朗读设置把 text(不超过 300 字)合成为音频(本机服务为 m4a,其余为 MP3),返回 base64。
|
|
108
110
|
weixin 微信通知:action 为 status(默认,读取绑定状态)、login(生成扫码内容)、complete(等待扫码确认,约 20 秒)、test(发一条测试通知)或 unbind(解除本机绑定)。Goal 待确认 5 分钟仍未回复时通知房主,房主在微信回复即作为房主发言发回该房间;只用本机服务目录保存凭据。
|
|
109
111
|
tts-release 用户停止朗读:所选服务释放在这台电脑上占用的资源(本机语音在 5 秒内结束、释放显存),云端服务无操作。
|
|
@@ -416,7 +418,8 @@ export async function remote_room_files(home, input) {
|
|
|
416
418
|
const PAGE_PART_BYTES = 192 * 1024;
|
|
417
419
|
|
|
418
420
|
/**
|
|
419
|
-
* One HTML file of the room's project with the files it refers to inlined (see `bundle_project_page`),
|
|
421
|
+
* One HTML file of the room's project with the files it refers to inlined (see `bundle_project_page`), or the images a
|
|
422
|
+
* Markdown file shows (`bundle_project_markdown`), as base64
|
|
420
423
|
* `data` from `offset`. With `parts` (another device, through the relay) at most `PAGE_PART_BYTES` at a time; the
|
|
421
424
|
* caller asks again from where a part ended and checks `version` stays the same.
|
|
422
425
|
*/
|
|
@@ -427,11 +430,44 @@ export async function room_page(home, raw, { trust = false, parts = false } = {}
|
|
|
427
430
|
const offset = input.offset ?? 0;
|
|
428
431
|
if (!Number.isSafeInteger(root) || root < 0 || root >= Math.max(1, directories.length)) throw new Error('项目目录编号无效,请刷新后重试');
|
|
429
432
|
if (!Number.isSafeInteger(offset) || offset < 0) throw new Error('页面读取位置无效');
|
|
430
|
-
const
|
|
433
|
+
const bundle = /\.(md|markdown)$/i.test(String(input.path || '')) ? bundle_project_markdown : bundle_project_page;
|
|
434
|
+
const { bytes, ...page } = bundle(directories[root], input.path);
|
|
431
435
|
const part = bytes.subarray(offset, parts ? offset + PAGE_PART_BYTES : bytes.length);
|
|
432
436
|
return { room_id: input.room_id, root, ...page, total: bytes.length, offset, data: part.toString('base64') };
|
|
433
437
|
}
|
|
434
438
|
|
|
439
|
+
// Through the relay a media file comes whole, in parts, so another device plays at most this much.
|
|
440
|
+
export const REMOTE_MEDIA_MAX_BYTES = 64 * 1024 * 1024;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* One image, video or audio file of the room's project (see `project_media`). For the computer's own page it names
|
|
444
|
+
* the real file, which the local site streams by a ticket and never shows the page; with `parts` (another device,
|
|
445
|
+
* through the relay) it returns base64 `data` from `offset`, at most `PAGE_PART_BYTES` at a time, for files up to
|
|
446
|
+
* `REMOTE_MEDIA_MAX_BYTES`, and the caller checks `version` stays the same.
|
|
447
|
+
*/
|
|
448
|
+
export async function room_media(home, raw, { trust = false, parts = false } = {}) {
|
|
449
|
+
const { input, config } = await member_room_context(home, raw, { trust });
|
|
450
|
+
const directories = room_directories(config);
|
|
451
|
+
const root = input.root ?? 0;
|
|
452
|
+
const offset = input.offset ?? 0;
|
|
453
|
+
if (!Number.isSafeInteger(root) || root < 0 || root >= Math.max(1, directories.length)) throw new Error('项目目录编号无效,请刷新后重试');
|
|
454
|
+
if (!Number.isSafeInteger(offset) || offset < 0) throw new Error('文件读取位置无效');
|
|
455
|
+
const { file, ...media } = project_media(directories[root], input.path);
|
|
456
|
+
if (!parts) return { room_id: input.room_id, root, ...media, file };
|
|
457
|
+
if (media.size > REMOTE_MEDIA_MAX_BYTES) throw new Error(`文件 ${Math.ceil(media.size / 1024 / 1024)} MB,超过其他设备可播放的 ${REMOTE_MEDIA_MAX_BYTES / 1024 / 1024} MB 上限;请在这台电脑上打开`);
|
|
458
|
+
const part = Buffer.alloc(Math.max(0, Math.min(PAGE_PART_BYTES, media.size - offset)));
|
|
459
|
+
const handle = openSync(file, 'r');
|
|
460
|
+
try { readSync(handle, part, 0, part.length, offset); } finally { closeSync(handle); }
|
|
461
|
+
return { room_id: input.room_id, root, ...media, total: media.size, offset, data: part.toString('base64') };
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/** `room-media` asked for by another device, answered inside the relay's own process in parts. */
|
|
465
|
+
export async function remote_room_media(home, input) {
|
|
466
|
+
assert_shared_home(home);
|
|
467
|
+
guard_remote_request('room-media', input, { projects: launch_projects(home).projects, participants: launch_settings(home).participants, home });
|
|
468
|
+
return room_media(home, input, { trust: true, parts: true });
|
|
469
|
+
}
|
|
470
|
+
|
|
435
471
|
/** `room-page` asked for by another device, answered inside the relay's own process in parts, like `remote_room_files`. */
|
|
436
472
|
export async function remote_room_page(home, input) {
|
|
437
473
|
assert_shared_home(home);
|
|
@@ -563,7 +599,7 @@ const MAX_EXPERT_PRESETS = 30;
|
|
|
563
599
|
const MAX_PRESET_DESCRIPTION = 500;
|
|
564
600
|
const MAX_PRESET_FIELD = 200;
|
|
565
601
|
// name is the instance a preset adds (platform-suffix); label is the free name shown for it, on the add row and in the room.
|
|
566
|
-
const PRESET_FIELDS = ['name', 'label', 'description', 'system_prompt', 'project_access', 'model', 'effort'];
|
|
602
|
+
const PRESET_FIELDS = ['name', 'label', 'description', 'system_prompt', 'project_access', 'model', 'effort', 'image_model'];
|
|
567
603
|
const MAX_PRESET_LABEL = 32;
|
|
568
604
|
|
|
569
605
|
/**
|
|
@@ -594,7 +630,7 @@ export function expert_presets(home) {
|
|
|
594
630
|
|
|
595
631
|
/** Check one expert preset; a workflow's agent card is a preset and obeys the same rule. */
|
|
596
632
|
export function validate_preset(preset) {
|
|
597
|
-
if (!preset || typeof preset !== 'object' || Object.keys(preset).some(key => !PRESET_FIELDS.includes(key))) throw new Error('
|
|
633
|
+
if (!preset || typeof preset !== 'object' || Object.keys(preset).some(key => !PRESET_FIELDS.includes(key))) throw new Error('预设只能包含名称、显示名、描述、提示词、项目权限、模型、强度与图片模型');
|
|
598
634
|
if (!platform_of(preset.name) || !clients_of(preset.name)) throw new Error(`预设 ID 须为“平台名”或“平台名-后缀”,后缀只用英文、数字和下划线:${preset.name}`);
|
|
599
635
|
if (Object.values(preset).some(value => typeof value !== 'string')) throw new Error(`${preset.name} 的字段必须为文本`);
|
|
600
636
|
if ((preset.label || '').trim().length > MAX_PRESET_LABEL) throw new Error(`${preset.name} 的显示名最多 ${MAX_PRESET_LABEL} 字`);
|
|
@@ -602,6 +638,7 @@ export function validate_preset(preset) {
|
|
|
602
638
|
if ((preset.system_prompt || '').length > MAX_EXPERT_PROMPT) throw new Error(`${preset.name} 的提示词最多 ${MAX_EXPERT_PROMPT} 字`);
|
|
603
639
|
if (preset.project_access && !PROJECT_ACCESS.includes(preset.project_access)) throw new Error(`${preset.name} 的项目权限须为 read、write、auto 或 full`);
|
|
604
640
|
if ([preset.model, preset.effort].some(value => (value || '').length > MAX_PRESET_FIELD)) throw new Error(`${preset.name} 的模型或强度过长`);
|
|
641
|
+
if (preset.image_model && !/^[A-Za-z0-9][A-Za-z0-9._:/@-]*$/.test(preset.image_model)) throw new Error(`${preset.name} 的图片模型只能是模型 ID,例如 gpt-image-2.6-flare`);
|
|
605
642
|
}
|
|
606
643
|
|
|
607
644
|
/** Replace the user's presets, default descriptions or deleted built-ins (whichever the input carries); every field is checked first. */
|
|
@@ -641,7 +678,7 @@ function validate_profile(name, profile, binding = false) {
|
|
|
641
678
|
} else if (typeof value !== 'string') throw new Error(`${name}.${key} 必须为文本`);
|
|
642
679
|
if (['executable', 'cwd', 'ipc_directory'].includes(key) && value && !isAbsolute(value)) throw new Error(`${name}.${key} 必须为完整绝对路径`);
|
|
643
680
|
// The model is passed as one CLI argument, so it must not look like a flag or contain spaces.
|
|
644
|
-
if (
|
|
681
|
+
if (['model', 'image_model'].includes(key) && value && !/^[A-Za-z0-9][A-Za-z0-9._:/@[\]-]*$/.test(value)) throw new Error(`${name}.${key} 只能是模型名称,例如 gpt-6-astra、opus 或 gemini-4-argon-high`);
|
|
645
682
|
if (key === 'system_prompt' && value.length > MAX_EXPERT_PROMPT) throw new Error(`${name} 的专属提示词最多 ${MAX_EXPERT_PROMPT} 字`);
|
|
646
683
|
}
|
|
647
684
|
const facts = adapter_profile(profile.adapter);
|
|
@@ -1605,7 +1642,7 @@ async function room_cards(home, raw) {
|
|
|
1605
1642
|
taken.add(card.toLowerCase());
|
|
1606
1643
|
// A card names its member platform-card; the room member it came from may have another suffix.
|
|
1607
1644
|
return { card, name: `${platform_of(name)}-${card}`, label: room.labels?.[name] || '', description: room.descriptions?.[name] || '',
|
|
1608
|
-
...Object.fromEntries(['system_prompt', 'project_access', 'model', 'effort']
|
|
1645
|
+
...Object.fromEntries(['system_prompt', 'project_access', 'model', 'effort', 'image_model']
|
|
1609
1646
|
.filter(field => profile[field] && profile[field] !== 'own').map(field => [field, profile[field]])) };
|
|
1610
1647
|
}) };
|
|
1611
1648
|
}
|
|
@@ -1710,7 +1747,7 @@ async function join_workflow_cards(home, config, roster, workflow, members, card
|
|
|
1710
1747
|
const taken = new Set([...roster.map(member => member.name), ...Object.values(next)]);
|
|
1711
1748
|
const name = taken.has(agent.name) ? free_instance(agent.name, taken) : agent.name;
|
|
1712
1749
|
const api = card_api_profile(home, platform_of(agent.name));
|
|
1713
|
-
const card = Object.fromEntries(['project_access', 'model', 'effort'].filter(field => agent[field] && !(api && field === 'effort')).map(field => [field, agent[field]]));
|
|
1750
|
+
const card = Object.fromEntries(['project_access', 'model', 'effort', 'image_model'].filter(field => agent[field] && !(api && field === 'effort')).map(field => [field, agent[field]]));
|
|
1714
1751
|
// An API member has no command line, so a card asking for more than writing gets the most it allows.
|
|
1715
1752
|
if (api && card.project_access && !access_levels('api').includes(card.project_access)) card.project_access = 'write';
|
|
1716
1753
|
const profile = { ...api, ...card };
|
|
@@ -2058,6 +2095,7 @@ export async function launch_main(args = process.argv.slice(2), input_text) {
|
|
|
2058
2095
|
else if (positionals[0] === 'room-models' && input) result = await room_models(home, input);
|
|
2059
2096
|
else if (positionals[0] === 'room-files' && input) result = await room_files(home, input);
|
|
2060
2097
|
else if (positionals[0] === 'room-page' && input) result = await room_page(home, input, { parts: Boolean(values.remote) });
|
|
2098
|
+
else if (positionals[0] === 'room-media' && input) result = await room_media(home, input, { parts: Boolean(values.remote) });
|
|
2061
2099
|
else if (positionals[0] === 'execution-details' && input) result = await execution_details_command(home, input);
|
|
2062
2100
|
else if (positionals[0] === 'models' && adapter_profile(input?.adapter)?.kind === 'api') result = await api_models(home, input);
|
|
2063
2101
|
else if (positionals[0] === 'models' && input) {
|