ai_co_discuss 0.4.85 → 0.4.87
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 +1 -1
- package/.agents/skills/discuss-host/references/members.md +53 -0
- package/.agents/skills/discuss-host/references/workflow.md +2 -2
- package/.agents/skills/discuss-participant/SKILL.md +2 -1
- package/.agents/skills/discuss-participant/references/writing.md +1 -1
- package/backend/external_members.py +37 -4
- package/backend/free_room.py +18 -10
- package/docs/en/runner.md +9 -9
- package/docs/en/workflow.md +1 -1
- package/docs/runner.md +9 -9
- package/docs/workflow.md +1 -1
- package/frontend/locales/en/app.json +3 -1
- package/frontend/locales/en/backend.json +1 -1
- package/frontend/locales/en/discussion.json +2 -1
- package/frontend/locales/en/external.json +20 -9
- package/frontend/locales/en/room.json +3 -0
- package/frontend/locales/en/settings.json +2 -0
- package/package.json +2 -2
- package/runner/adapters/antigravity_app.mjs +42 -3
- package/runner/adapters/antigravity_cli.mjs +18 -2
- package/runner/adapters/api.mjs +1 -1
- package/runner/adapters/claude.mjs +56 -12
- package/runner/adapters/codex_app.mjs +45 -3
- package/runner/adapters/index.mjs +3 -1
- package/runner/adapters/profiles.mjs +6 -3
- package/runner/admin_cli.mjs +2 -0
- package/runner/admin_panel.mjs +12 -6
- package/runner/codiscuss.mjs +1 -1
- package/runner/discussion_launch.mjs +4 -2
- package/runner/discussion_runner.mjs +2 -1
- package/runner/expert_prompts.mjs +32 -4
- package/runner/external_client.mjs +158 -53
- package/runner/external_gateway.mjs +7 -1
- package/runner/free_runner.mjs +131 -26
- package/runner/i18n_en.mjs +6 -4
- package/runner/slash_names.mjs +19 -0
- package/web/admin.js +3 -3
- package/web/app.js +28 -4
- package/web/backup.js +1 -1
- package/web/i18n.js +3 -3
- package/web/join.html +2 -2
- package/web/modern.css +1 -1
- package/web/modern.js +62 -61
|
@@ -493,6 +493,8 @@
|
|
|
493
493
|
"保留全部记录;需要总结时可直接请主持人写一份。": "Keep all records; ask the host directly if you need a summary.",
|
|
494
494
|
"房间里还没有 AI 成员": "No AI members in this room yet",
|
|
495
495
|
"这位成员是手动接入的,请在它自己的窗口里对话": "This member is connected manually; talk in its own window",
|
|
496
|
+
"外部专家在对方电脑上运行,不能在这里私聊": "This external expert runs on the other computer; it cannot be chatted with privately here",
|
|
497
|
+
"它在对方电脑上运行,这里只显示它在房间里收到的任务和回答": "It runs on the other computer; only the room tasks it received and its answers show here",
|
|
496
498
|
"这位成员的接入方式看不到它的输出,暂不支持私聊窗": "This connection does not expose output, so private chat is unavailable",
|
|
497
499
|
"打断": "Interrupt",
|
|
498
500
|
"{value1} · 空闲": "{value1} · Idle",
|
|
@@ -739,6 +741,7 @@
|
|
|
739
741
|
"会话": "Session",
|
|
740
742
|
"为 {name} 选择历史会话": "Pick a past session for {name}",
|
|
741
743
|
"选中的会话由程序在后台续接,带着它已有的上下文加入房间;它工作时请不要在原窗口继续操作。": "The program resumes the picked session in the background, so it joins the room with the context it already has. While it is working, do not keep using it in its original window.",
|
|
744
|
+
"将从选中的会话分叉出新会话加入房间,保留已有上下文;原会话不变,在原软件里打开它看不到房间里的后续记录。": "A new session forked from the picked one joins the room with its existing context. The original is unchanged; opening it in the original software will not show what happens in the room.",
|
|
742
745
|
"搜索标题、目录或会话 ID": "Search by title, folder or session ID",
|
|
743
746
|
"搜索历史会话": "Search past sessions",
|
|
744
747
|
"会话范围": "Session scope",
|
|
@@ -137,6 +137,8 @@
|
|
|
137
137
|
"扫描电脑本机网页 设置 → 添加设备 的二维码,或输入配对码。": "Scan the QR code under Settings → Add device on the computer's local site, or enter the pairing code.",
|
|
138
138
|
"配对码": "Pairing code",
|
|
139
139
|
"扫码": "Scan code",
|
|
140
|
+
"这台设备没有相机,请输入配对码": "This device has no camera. Enter the pairing code.",
|
|
141
|
+
"这台设备没有相机,可选择或粘贴二维码图片": "This device has no camera. Pick or paste a QR code image.",
|
|
140
142
|
"正在打开相机…": "Opening camera…",
|
|
141
143
|
"相机画面": "Camera view",
|
|
142
144
|
"取消": "Cancel",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai_co_discuss",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.87",
|
|
4
4
|
"bin": {
|
|
5
5
|
"codiscuss": "runner/codiscuss.mjs"
|
|
6
6
|
},
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"dev": "npm run build && wrangler pages dev --ip 127.0.0.1 --port 8787",
|
|
9
9
|
"db:local": "wrangler d1 execute DB --local --file backend/schema.sql",
|
|
10
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/account_space.mjs && node --check runner/admin_account.mjs && node --check runner/admin_panel.mjs && node --check runner/admin_cli.mjs && node --check runner/os_users.mjs && node --check runner/tray.mjs && node --check runner/launcher.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/external_client.mjs && node --check runner/external_gateway.mjs && node --check runner/repo_read.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/weixin.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",
|
|
11
|
+
"check": "node --check backend/worker.mjs && node --check web/app.js && node --check runner/account_space.mjs && node --check runner/admin_account.mjs && node --check runner/admin_panel.mjs && node --check runner/admin_cli.mjs && node --check runner/os_users.mjs && node --check runner/tray.mjs && node --check runner/launcher.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/external_client.mjs && node --check runner/external_gateway.mjs && node --check runner/repo_read.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/slash_names.mjs && node --check runner/weixin.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
12
|
"runner": "node runner/discussion_runner.mjs",
|
|
13
13
|
"service": "node runner/discussion_service.mjs",
|
|
14
14
|
"build:ui": "vite build --config frontend/vite.config.mjs --mode i18n && 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 --mode office && vite build --config frontend/vite.config.mjs --mode video && vite build --config frontend/vite.config.mjs --mode admin && vite build --config frontend/vite.config.mjs",
|
|
@@ -49,10 +49,49 @@ function queue_request(config, request) {
|
|
|
49
49
|
|
|
50
50
|
/** Queue one immutable request for the official App-managed Sidecar. */
|
|
51
51
|
async function deliver(config, binding, task) {
|
|
52
|
-
ready_sidecar(config, binding, task);
|
|
52
|
+
const ready = ready_sidecar(config, binding, task);
|
|
53
|
+
const server = language_server(ready);
|
|
54
|
+
// Steps already in the conversation belong to earlier turns; an unreadable one is simply not watched.
|
|
55
|
+
let start = server ? 0 : null;
|
|
56
|
+
if (server && binding.session_id) start = await read_conversation(server, binding.session_id).then(item => item.steps.length, () => null);
|
|
53
57
|
queue_request(config, { id: task.id, event_id: Number(task.id.replace(/^free-/, '')), prompt: task.prompt,
|
|
54
58
|
session_id: binding.session_id || '', access_path: task.access_path });
|
|
55
|
-
return { session_id: binding.session_id || '', status: 'sidecar_pending', capabilities: IN_APP };
|
|
59
|
+
if (start === null) return { session_id: binding.session_id || '', status: 'sidecar_pending', capabilities: IN_APP };
|
|
60
|
+
watch_room_turn(config, server, { session_id: binding.session_id || '', start }, task).catch(() => {});
|
|
61
|
+
return { session_id: binding.session_id || '', status: 'sidecar_pending', capabilities: { ...IN_APP, ends: true } };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** The App's language server the Sidecar handed over, or null (an older Sidecar, or an App that no longer passes it). */
|
|
65
|
+
function language_server(ready) {
|
|
66
|
+
return ready.language_server?.address && ready.language_server?.csrf_token ? ready.language_server : null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// A room turn runs in the App and is not stopped from here; it is only watched for its end, so a stop the owner makes in
|
|
70
|
+
// the App lets the room deliver again at once. Tests shorten these.
|
|
71
|
+
export const ROOM_TIMING = { poll_ms: 2000, wait_ms: 2 * 60 * 60 * 1000, read_failures: 10 };
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Wait for the Sidecar's receipt (a new conversation's id), then read the conversation until it goes idle with new steps
|
|
75
|
+
* and nothing pending, and report `on_turn_end`. Gives up quietly on a refused delivery, an unreadable App or the
|
|
76
|
+
* ceiling; the room then falls back to the site's hold.
|
|
77
|
+
*/
|
|
78
|
+
export async function watch_room_turn(config, server, { session_id, start }, task) {
|
|
79
|
+
const finished = new Map(), until = Date.now() + ROOM_TIMING.wait_ms;
|
|
80
|
+
let failures = 0;
|
|
81
|
+
while (Date.now() < until) {
|
|
82
|
+
await sleep(ROOM_TIMING.poll_ms);
|
|
83
|
+
if (!session_id) {
|
|
84
|
+
const result = receipt(config, task.id);
|
|
85
|
+
if (result && result.status !== 'accepted') return;
|
|
86
|
+
session_id = result?.session_id || '';
|
|
87
|
+
if (!session_id) continue;
|
|
88
|
+
}
|
|
89
|
+
let conversation;
|
|
90
|
+
try { conversation = await read_conversation(server, session_id); failures = 0; }
|
|
91
|
+
catch { if (++failures >= ROOM_TIMING.read_failures) return; continue; }
|
|
92
|
+
const steps = conversation.steps.slice(start);
|
|
93
|
+
if (steps.length && conversation.idle && !turn_pending(steps, finished)) return task.on_turn_end?.();
|
|
94
|
+
}
|
|
56
95
|
}
|
|
57
96
|
|
|
58
97
|
/** Queue a chat message and wait for the Sidecar to pass it to the App; the conversation ID it went into. */
|
|
@@ -190,7 +229,7 @@ async function stop_turn(server, session_id) {
|
|
|
190
229
|
*/
|
|
191
230
|
async function chat(config, binding, task) {
|
|
192
231
|
const ready = ready_sidecar(config, binding, task);
|
|
193
|
-
const server =
|
|
232
|
+
const server = language_server(ready);
|
|
194
233
|
let start = 0;
|
|
195
234
|
if (server && binding.session_id) {
|
|
196
235
|
let conversation;
|
|
@@ -39,7 +39,23 @@ export function agy_denial(step) {
|
|
|
39
39
|
}
|
|
40
40
|
const command = String(parameters.CommandLine || '');
|
|
41
41
|
const rule = `${kind === 'unsandboxed' ? 'unsandboxed_command' : 'command'}(${command})`;
|
|
42
|
-
return { tool: step.tool_name || 'run_command', detail: command.slice(0, DENIAL_FIELD), rule: command && rule.length <= DENIAL_FIELD ? rule : ''
|
|
42
|
+
return { tool: step.tool_name || 'run_command', detail: command.slice(0, DENIAL_FIELD), rule: command && rule.length <= DENIAL_FIELD ? rule : '',
|
|
43
|
+
...symbol_hint(command) };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// What `agy_rule` refuses inside a codiscuss command: shell separators and expressions, and line breaks.
|
|
47
|
+
const SHELL_SYMBOLS = /[;&|<>$`()\r\n]/g;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A codiscuss command refused only for the shell symbols in it, most often an inline --body answer carrying backticks or
|
|
51
|
+
* brackets: `retry_hint` tells the member what to change, so the runner can let it correct the command (2026-11-19).
|
|
52
|
+
*/
|
|
53
|
+
function symbol_hint(command) {
|
|
54
|
+
if (!/^codiscuss(\.cmd)?\s/.test(command)) return {};
|
|
55
|
+
const symbols = [...new Set(command.match(SHELL_SYMBOLS) || [])].map(item => (item === '\n' || item === '\r' ? '换行' : item));
|
|
56
|
+
if (!symbols.length) return {};
|
|
57
|
+
return { retry_hint: `命令含有 ${[...new Set(symbols)].join(' ')},codiscuss 命令里不能出现反引号、英文括号、$、;、&、|、<、> 或换行,`
|
|
58
|
+
+ '会被当作拼接其他命令而拒绝。若是 --body 的正文含这些符号,把正文写进草稿目录的文件,改用 --body-file 提交;其他参数去掉这些符号再运行。' };
|
|
43
59
|
}
|
|
44
60
|
|
|
45
61
|
/** Allow only the discussion website commands, without shell separators or expressions. */
|
|
@@ -110,7 +126,7 @@ function skill_file(path) {
|
|
|
110
126
|
return value.startsWith("'") && value.endsWith("'") ? value.slice(1, -1).replaceAll("''", "'") : value;
|
|
111
127
|
};
|
|
112
128
|
const id = field('name'), description = field('description');
|
|
113
|
-
return id && description ? { id, label: id, description, prompt:
|
|
129
|
+
return id && description ? { id, label: id, description, prompt: `/${id} ` } : null;
|
|
114
130
|
} catch { return null; }
|
|
115
131
|
finally { if (descriptor !== undefined) closeSync(descriptor); }
|
|
116
132
|
}
|
package/runner/adapters/api.mjs
CHANGED
|
@@ -605,7 +605,7 @@ ${project_text(context.project, context.commands, context.image_input, context.n
|
|
|
605
605
|
// Nor can an API host open the host's occasional pages: a room host gets them all, a discussion host its own three
|
|
606
606
|
// (opening, roster, closing) and the two its page links to.
|
|
607
607
|
...(host && discussion ? ['host-opening.md', 'host-roster.md', 'host-closing.md'].map(file => skill_text('discuss-session', `references/${file}`)) : []),
|
|
608
|
-
...(host ? (discussion ? ['control.md', 'workflow.md'] : ['relay.md', 'control.md', 'workflow.md', 'dev-flow.md'])
|
|
608
|
+
...(host ? (discussion ? ['control.md', 'workflow.md'] : ['members.md', 'relay.md', 'control.md', 'workflow.md', 'dev-flow.md'])
|
|
609
609
|
.map(file => skill_text('discuss-host', `references/${file}`)) : []),
|
|
610
610
|
...(goal_host(context) ? [skill_text('discuss-goal'), skill_text('discuss-goal', 'references/start.md'), skill_text('discuss-goal', 'references/finish.md')] : []),
|
|
611
611
|
...(host && context.workflow ? [workflow_text(context.workflow)] : []),
|
|
@@ -381,19 +381,53 @@ async function post_inbox(inbox, text) {
|
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
|
|
385
|
-
|
|
384
|
+
// An interjection into a room task's window turn; the window shows it as a message from another session.
|
|
385
|
+
const ROOM_STEER_LEAD = 'CoDiscuss 本机服务代房间转达,这是对你当前房间任务的追加要求,不是其他会话的来信:请在本次任务的回答里一并处理,不要用 SendMessage 回复。';
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Post one task into an open Claude window; it starts a turn there, or between tool calls of the turn it is in. As in a
|
|
389
|
+
* private chat turn, an interjection is one more inbox message with its own marker, and the turn stops by an Esc key
|
|
390
|
+
* written into the window's console when that console can be reached; `options.console` replaces it in tests.
|
|
391
|
+
*/
|
|
392
|
+
async function inbox_delivery(config, window, task, options = {}) {
|
|
386
393
|
try { bind_access(task.access_path, config.session_id); }
|
|
387
394
|
catch (error) { throw not_sent(error); }
|
|
388
395
|
// Only what the window writes after this point can be the turn that takes this task.
|
|
389
396
|
const file = session_path(config.session_id);
|
|
390
397
|
const offset = file ? statSync(file).size : 0;
|
|
391
|
-
|
|
398
|
+
const log_path = resolve(task.directory, `claude-${task.id}.log`);
|
|
399
|
+
const console_of = options.console || window_console;
|
|
400
|
+
const reached = console_of(window.pid);
|
|
401
|
+
task.on_output?.(log_path, `${JSON.stringify({ type: 'codiscuss.window', terminal: reached.terminal, stoppable: reached.ok, reason: reached.reason })}\n`);
|
|
402
|
+
const handle = new EventEmitter();
|
|
403
|
+
// The turn's steps, read from the session log, are the execution's process log, so the private chat can show them.
|
|
404
|
+
const watcher = watch_window_turn({ file, offset, pid: window.pid, marker: `${task.id}.task.json`, log_path }, task, {
|
|
405
|
+
on_end: () => handle.emit('close', 0),
|
|
406
|
+
stop_key: () => {
|
|
407
|
+
const sent = console_of(window.pid, { escape: true });
|
|
408
|
+
task.on_output?.(log_path, `${JSON.stringify({ type: 'codiscuss.stop', terminal: sent.terminal, sent: sent.ok, reason: sent.reason })}\n`);
|
|
409
|
+
return sent;
|
|
410
|
+
} });
|
|
411
|
+
try { await post_inbox(window.inbox, `CoDiscuss 本机服务代房间转达(你已注册为该房间成员,这是房间分派给你的任务):\n${task.prompt}`); }
|
|
412
|
+
catch (error) { watcher.cancel(); throw error; }
|
|
392
413
|
// The discussion runner enters the execution once the session is known, as it does when a process reports it.
|
|
393
414
|
task.on_binding?.(config.session_id);
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
415
|
+
if (reached.ok) {
|
|
416
|
+
handle.kill = () => watcher.stop();
|
|
417
|
+
// The Esc key goes into the owner's own window; only the owner's stop sends it, never the runner's shutdown.
|
|
418
|
+
handle.stop_on_shutdown = false;
|
|
419
|
+
task.on_process?.(handle);
|
|
420
|
+
}
|
|
421
|
+
let count = 0;
|
|
422
|
+
const steer = async text => {
|
|
423
|
+
const tag = `[codiscuss:${task.id}+${++count}]`;
|
|
424
|
+
if (!watcher.expect(tag)) return false;
|
|
425
|
+
try { await post_inbox(window.inbox, `${tag} ${ROOM_STEER_LEAD}\n\n${text}`); }
|
|
426
|
+
catch { watcher.forget(tag); return false; }
|
|
427
|
+
task.on_output?.(log_path, `${JSON.stringify({ type: 'codiscuss.interjection', text })}\n`);
|
|
428
|
+
return true;
|
|
429
|
+
};
|
|
430
|
+
return { session_id: config.session_id, status: 'accepted', capabilities: { ...WINDOW, stoppable: reached.ok, progress: true }, steer };
|
|
397
431
|
}
|
|
398
432
|
|
|
399
433
|
/**
|
|
@@ -598,17 +632,27 @@ export function watch_window_turn({ file, offset, pid, marker, session_id = '',
|
|
|
598
632
|
function try_stop() {
|
|
599
633
|
const now = Date.now();
|
|
600
634
|
if (stop_sent) {
|
|
601
|
-
if (now - stop_sent >= stop_end_wait)
|
|
635
|
+
if (now - stop_sent >= stop_end_wait) unstopped('已向 Claude 窗口发送停止键,但这一轮仍未结束');
|
|
602
636
|
return;
|
|
603
637
|
}
|
|
604
638
|
const ready = taken && !open_tools.size && window_state(pid, env)?.status === 'busy';
|
|
605
639
|
if (!ready) {
|
|
606
|
-
if (now - stop_asked >= stop_tool_wait)
|
|
640
|
+
if (now - stop_asked >= stop_tool_wait) unstopped(open_tools.size ? '工具仍在执行,未能停止' : !taken ? '消息还在 Claude 窗口的队列里,未能停止' : 'Claude 窗口一直没有处于执行中,未能停止');
|
|
607
641
|
return;
|
|
608
642
|
}
|
|
609
643
|
stop_sent = now;
|
|
610
644
|
const sent = stop_key?.() || { ok: false, reason: '无法向 Claude 窗口发送停止键' };
|
|
611
|
-
if (!sent.ok)
|
|
645
|
+
if (!sent.ok) unstopped(sent.reason);
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* A stop that did not take: a chat turn fails with the reason. A room task's turn goes on in the window, so the watch
|
|
649
|
+
* keeps following it until it really ends (the runner's next stop request tries again), and only its log says why.
|
|
650
|
+
*/
|
|
651
|
+
function unstopped(reason) {
|
|
652
|
+
if (chat) return finish(reason);
|
|
653
|
+
clearInterval(stop_timer);
|
|
654
|
+
stop_timer = null; stop_asked = 0; stop_sent = 0;
|
|
655
|
+
if (log_path) task.on_output?.(log_path, `${JSON.stringify({ type: 'codiscuss.stop', sent: false, reason })}\n`);
|
|
612
656
|
}
|
|
613
657
|
return {
|
|
614
658
|
get done() { return done; },
|
|
@@ -651,10 +695,10 @@ function process_alive(pid) {
|
|
|
651
695
|
}
|
|
652
696
|
|
|
653
697
|
/** Use one official Claude process per turn and resume the persisted session, or post into the member's open window. */
|
|
654
|
-
async function deliver(config, binding, task, spawn_process = spawn) {
|
|
698
|
+
async function deliver(config, binding, task, spawn_process = spawn, user_home, options = {}) {
|
|
655
699
|
const window = held_window(config, binding);
|
|
656
700
|
// Only a task written for the window names its credential file; a background process gets it through its environment.
|
|
657
|
-
if (window?.inbox && task.inbox) return inbox_delivery(config, window, task);
|
|
701
|
+
if (window?.inbox && task.inbox) return inbox_delivery(config, window, task, options);
|
|
658
702
|
binding = adopted_fork(config, binding, Boolean(window));
|
|
659
703
|
const session_id = binding.session_id || randomUUID();
|
|
660
704
|
try { bind_access(task.access_path, session_id); }
|
|
@@ -867,7 +911,7 @@ function skills(profile, options = {}) {
|
|
|
867
911
|
const commands = reply.response.response?.commands;
|
|
868
912
|
if (reply.response.subtype !== 'success' || !Array.isArray(commands)) return finish(new Error('Claude 未返回技能目录'));
|
|
869
913
|
finish(null, commands.filter(command => !command.builtin).map(command => ({
|
|
870
|
-
id: command.name, label: command.name, description: command.description || '', prompt:
|
|
914
|
+
id: command.name, label: command.name, description: command.description || '', prompt: `/${command.name} `,
|
|
871
915
|
})));
|
|
872
916
|
},
|
|
873
917
|
}), { ...options, cwd: profile.cwd || homedir(), catalog_label: '技能' });
|
|
@@ -83,21 +83,63 @@ function app_steer(config, thread_id) {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// A room turn runs in the App, which the runner cannot stop; it only watches the chat for that turn to end, so a stop the
|
|
87
|
+
// owner makes in the App lets the room deliver again at once.
|
|
88
|
+
const ROOM_POLL_MS = 2000;
|
|
89
|
+
const ROOM_READ = { turnLimit: 3 };
|
|
90
|
+
|
|
91
|
+
/** The ids of the chat's latest turns before a task goes in, or null when the App cannot be read. */
|
|
92
|
+
async function turns_before(config, thread_id) {
|
|
93
|
+
const app = new CodexAppClient(config.pipe_path);
|
|
94
|
+
try { await app.open(); return new Set((await app.read_thread(thread_id, ROOM_READ)).turns.map(turn => turn.id)); }
|
|
95
|
+
catch { return null; }
|
|
96
|
+
finally { app.close(); }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Read the chat until a turn newer than `seen` has ended and the chat is idle, then report `on_turn_end`. Gives up quietly
|
|
101
|
+
* after the private chat's ceiling or when the App stays unreadable; the room then falls back to the site's hold.
|
|
102
|
+
* `options` (`connect`, `poll_ms`, `timeout_ms`) replace the App and the timings in tests.
|
|
103
|
+
*/
|
|
104
|
+
export async function watch_room_turn(config, thread_id, seen, task, options = {}) {
|
|
105
|
+
const connect = options.connect || (() => open_app(config));
|
|
106
|
+
const deadline = Date.now() + (options.timeout_ms ?? CHAT_TIMEOUT_MS);
|
|
107
|
+
let app = null, failures = 0;
|
|
108
|
+
try {
|
|
109
|
+
while (Date.now() < deadline) {
|
|
110
|
+
await sleep(options.poll_ms ?? ROOM_POLL_MS);
|
|
111
|
+
let snapshot;
|
|
112
|
+
try { app ||= await connect(); snapshot = await app.read_thread(thread_id, ROOM_READ); failures = 0; }
|
|
113
|
+
catch { app?.close(); app = null; if (++failures >= CHAT_READ_FAILURES) return; continue; }
|
|
114
|
+
const newest = snapshot.turns[0];
|
|
115
|
+
if (newest && !seen.has(newest.id) && newest.status !== 'inProgress' && snapshot.thread.status.type !== 'active') return task.on_turn_end?.();
|
|
116
|
+
}
|
|
117
|
+
} finally { app?.close(); }
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** What a room delivery into this chat can do: never stopped, its end heard when the chat could be read beforehand. */
|
|
121
|
+
function room_delivery(config, thread_id, seen, task) {
|
|
122
|
+
if (!seen) return IN_APP;
|
|
123
|
+
watch_room_turn(config, thread_id, seen, task).catch(() => {});
|
|
124
|
+
return { ...IN_APP, ends: true };
|
|
125
|
+
}
|
|
126
|
+
|
|
86
127
|
/** Deliver one task to Codex's real App, with the original chat reused afterward. */
|
|
87
128
|
async function deliver(config, binding, task, _spawn, user_home = homedir()) {
|
|
88
129
|
if (binding.session_id) {
|
|
89
130
|
try { bind_access(task.access_path, binding.session_id); }
|
|
90
131
|
catch (error) { throw not_sent(error); }
|
|
132
|
+
const seen = await turns_before(config, binding.session_id);
|
|
91
133
|
// `codex queue` reaches only a chat the App has loaded; a fork made after a rewind, or a chat after the App restarted,
|
|
92
134
|
// is not loaded until a message is sent through the App itself (tested on App tools, 2026-10).
|
|
93
135
|
if (await unloaded(config, binding.session_id)) {
|
|
94
136
|
const app = new CodexAppClient(config.pipe_path);
|
|
95
137
|
try { await app.open(); await app.send_message(binding.session_id, task.prompt); }
|
|
96
138
|
finally { app.close(); }
|
|
97
|
-
return { session_id: binding.session_id, status: 'accepted', capabilities:
|
|
139
|
+
return { session_id: binding.session_id, status: 'accepted', capabilities: room_delivery(config, binding.session_id, seen, task), steer: app_steer(config, binding.session_id) };
|
|
98
140
|
}
|
|
99
141
|
const receipt = await run_program(config.executable, ['queue', '--thread', binding.session_id, '--message', task.prompt], { timeout: CALL_TIMEOUT_MS });
|
|
100
|
-
return { session_id: binding.session_id, status: 'accepted', receipt, capabilities:
|
|
142
|
+
return { session_id: binding.session_id, status: 'accepted', receipt, capabilities: room_delivery(config, binding.session_id, seen, task), steer: app_steer(config, binding.session_id) };
|
|
101
143
|
}
|
|
102
144
|
const app = new CodexAppClient(config.pipe_path);
|
|
103
145
|
try {
|
|
@@ -110,7 +152,7 @@ async function deliver(config, binding, task, _spawn, user_home = homedir()) {
|
|
|
110
152
|
const result = await app.create_thread(source, task.prompt, `CoDiscuss · ${task.participant}`, target);
|
|
111
153
|
task.on_binding(result.thread_id);
|
|
112
154
|
bind_access(task.access_path, result.thread_id);
|
|
113
|
-
return { session_id: result.thread_id, status: 'accepted', capabilities:
|
|
155
|
+
return { session_id: result.thread_id, status: 'accepted', capabilities: room_delivery(config, result.thread_id, new Set(), task), steer: app_steer(config, result.thread_id) };
|
|
114
156
|
} finally { app.close(); }
|
|
115
157
|
}
|
|
116
158
|
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* the web page reads as well;
|
|
6
6
|
* - its behaviour in its own module, a descriptor with the same shape for every software:
|
|
7
7
|
* - `deliver(config, binding, task, spawn_process, user_home)` → `{session_id, status, capabilities, steer?}`, where
|
|
8
|
-
* `capabilities` `{stoppable, progress}` says what this one delivery can do
|
|
8
|
+
* `capabilities` `{stoppable, progress, ends?}` says what this one delivery can do (`ends`: a turn it can neither stop
|
|
9
|
+
* nor follow is still watched, and `task.on_turn_end()` reports when it ended, saying nothing about an answer; the
|
|
10
|
+
* runner uses it only to tell the site a voided turn is over), and `steer(text)` (when the running
|
|
9
11
|
* software can take an interjection without ending its turn) passes one in, resolving false once the turn is over;
|
|
10
12
|
* - `session`: `{path, exists, branch, settings}` for the software's own session store, or null; with `list(options)`
|
|
11
13
|
* and `preview(session_id, options)` when its stored conversations can be browsed (see `software_sessions`);
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
* `browse_sessions`: its stored conversations can be listed and previewed on this machine, so the owner picks the one a
|
|
26
26
|
* new member resumes from a browsing window instead of typing its ID; a picked conversation may be bound even without
|
|
27
27
|
* `host_existing`.
|
|
28
|
+
* `copy_bound`: a woken member bound to an existing conversation (picked in that window, given by ID or restored)
|
|
29
|
+
* works in a copy of it made at its first turn, so the original stays as it was: resuming it in the background beside
|
|
30
|
+
* a window still open on it would split it. A taken-over manual member (`own`) keeps its original conversation.
|
|
28
31
|
* - `defaults_by_query`: its default model is read by running it (seconds), so a quick read leaves it for later.
|
|
29
32
|
* - `capabilities`: `delivery` `{stoppable, progress}` of a usual delivery (each delivery reports its own); `rewind`: `cut`
|
|
30
33
|
* (the runner cuts the session), `fresh` (context rebuilt each time) or `kept` (cannot be cut here); `project` (works in
|
|
@@ -89,7 +92,7 @@ export const ADAPTER_PROFILES = {
|
|
|
89
92
|
efforts: ['low', 'medium', 'high', 'xhigh', 'max', 'ultra'], models: true, access_levels: ALL_ACCESS, per_tool_allow: false,
|
|
90
93
|
access_hints: { read: '只读沙箱', write: '项目可写的沙箱,命令在沙箱内运行、可联网',
|
|
91
94
|
auto: '沙箱外的操作由模型申请提权,Codex 自动审核代替人工批准', full: '无沙箱、无审批(--dangerously-bypass-approvals-and-sandbox)' },
|
|
92
|
-
client: 'codex', adopt: 'session', host_existing: true, session_family: 'codex', browse_sessions: true,
|
|
95
|
+
client: 'codex', adopt: 'session', host_existing: true, session_family: 'codex', browse_sessions: true, copy_bound: true,
|
|
93
96
|
lockdown_hint: '沙箱只读档仍可读整个磁盘、运行任意只读命令,无法只放行 codiscuss 命令',
|
|
94
97
|
sandbox_needs_desktop: true,
|
|
95
98
|
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, enforces_read_only: true, limits_directories: true, ripgrep: true, chat: true, resume: true, images: true, capture: FINAL_REMARK,
|
|
@@ -109,7 +112,7 @@ export const ADAPTER_PROFILES = {
|
|
|
109
112
|
efforts: ['low', 'medium', 'high', 'xhigh', 'max'], models: true, access_levels: ALL_ACCESS, per_tool_allow: true,
|
|
110
113
|
access_hints: { read: '只放行网站命令与草稿,不改项目文件、不跑其他命令', write: '可改项目文件,Bash / PowerShell 命令全部放行(无沙箱)',
|
|
111
114
|
auto: 'Claude auto 模式:由分类器判断,实测项目外写入和联网都会放行', full: 'bypassPermissions:跳过全部权限检查' },
|
|
112
|
-
client: 'claude', adopt: 'own_cwd', host_existing: true, restore_manual: true, browse_sessions: true,
|
|
115
|
+
client: 'claude', adopt: 'own_cwd', host_existing: true, restore_manual: true, browse_sessions: true, copy_bound: true,
|
|
113
116
|
resume_command: session_id => `claude --resume ${session_id}`,
|
|
114
117
|
// Claude Code runs commands through bash on Windows too, where the npm shim works without .cmd.
|
|
115
118
|
windows_command: 'codiscuss',
|
|
@@ -125,7 +128,7 @@ export const ADAPTER_PROFILES = {
|
|
|
125
128
|
full: '跳过全部权限确认(--dangerously-skip-permissions),并放开沙箱外命令与 MCP 工具' },
|
|
126
129
|
unsupported_hints: { auto: 'agy 只在交互窗口提供自动模式,后台运行(-p)不支持' },
|
|
127
130
|
// Only a conversation this tool created gets its session rules; an existing one keeps its own project and permissions.
|
|
128
|
-
client: 'antigravity', adopt: 'session', host_existing: false, own_project_when_bound: true, browse_sessions: true,
|
|
131
|
+
client: 'antigravity', adopt: 'session', host_existing: false, own_project_when_bound: true, browse_sessions: true, copy_bound: true,
|
|
129
132
|
// Confined by session rules that allow only the codiscuss commands and deny MCP and web reads (agy_lockdown_grants).
|
|
130
133
|
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, chat: true, capture: FINAL_REMARK, tool_lockdown: true },
|
|
131
134
|
// A read-only agy session allows only codiscuss commands and headless agy ends the turn on a denied one; agy streams no
|
package/runner/admin_cli.mjs
CHANGED
|
@@ -414,6 +414,8 @@ export async function admin_cli(args, { client = panel_client, print = text => p
|
|
|
414
414
|
const commands = {
|
|
415
415
|
status: async () => {
|
|
416
416
|
const { login_methods: _methods, providers: _providers, ...state } = await call('state');
|
|
417
|
+
// The state leaves out the entry's checks over the network; they are asked apart.
|
|
418
|
+
if (state.hosting) state.entry = await call('entry');
|
|
417
419
|
return values.full ? state : summary(state);
|
|
418
420
|
},
|
|
419
421
|
service: () => call(`service/${need(rest[0], 'start|stop|restart')}`, {}),
|
package/runner/admin_panel.mjs
CHANGED
|
@@ -666,9 +666,11 @@ export function create_panel({ data, key, port, ops = {}, sessions = new Set() }
|
|
|
666
666
|
const windows = process.platform === 'win32';
|
|
667
667
|
return { hosting, version: VERSION, service: op.service_overview(data), online_site: bound_site(data)?.site || '', platform: process.platform,
|
|
668
668
|
launcher: windows && existsSync(launcher_path(data)), autostart: windows && op.autostart_enabled(), login_methods: LOGIN_METHODS, providers: API_PROVIDERS,
|
|
669
|
-
...(hosting ? { accounts: await op.list_accounts(data), clis: op.shared_cli_state(), entry: await op.entry_overview(data) }
|
|
669
|
+
...(hosting ? { accounts: await op.list_accounts(data), clis: op.shared_cli_state(), entry: await op.entry_overview(data, { reach: false }) }
|
|
670
670
|
: { accounts: [], clis: {}, entry: null }) };
|
|
671
671
|
}
|
|
672
|
+
// The entry with what needs the network (the relay's reach, the tunnel's connection), asked apart so the state is quick.
|
|
673
|
+
if (method === 'GET' && section === 'entry' && !name) return hosting ? op.entry_overview(data) : null;
|
|
672
674
|
// This computer: the owner's own service, its updates and login autostart.
|
|
673
675
|
// The owner's site opens in the default browser (not the panel's own window), through a signed link while it is protected.
|
|
674
676
|
if (method === 'POST' && section === 'service' && name === 'open') { open_browser(signed_site_url(site_url(data), data)); return { ok: true }; }
|
|
@@ -865,16 +867,20 @@ function relay_problem(relay, entry_running, service_running) {
|
|
|
865
867
|
return '';
|
|
866
868
|
}
|
|
867
869
|
|
|
868
|
-
|
|
870
|
+
/**
|
|
871
|
+
* The entry and its ways from outside. With `reach` off it leaves out what needs asking the relay over the network and
|
|
872
|
+
* cloudflared (`checked: false`), so the panel's state answers at once; the page then asks `GET entry` for the rest.
|
|
873
|
+
*/
|
|
874
|
+
async function entry_overview(data, { reach = true } = {}) {
|
|
869
875
|
const { port, public_url, tunnel, relay_enabled, tunnel_enabled, relay_url } = entry_settings(data), status = await entry_status(data);
|
|
870
876
|
const bound = bound_site(data);
|
|
871
877
|
const relay = { url: relay_url, site: bound?.site || '', link: relay_url && bound ? `${relay_url}/?m=${bound.machine}` : '',
|
|
872
|
-
...(relay_enabled && relay_url && bound ? await relay_status(relay_url, bound.machine) : {}) };
|
|
873
|
-
if (relay_enabled) relay.problem = relay_problem(relay, status.running, Boolean(local_status(data).running));
|
|
878
|
+
...(reach && relay_enabled && relay_url && bound ? await relay_status(relay_url, bound.machine) : {}) };
|
|
879
|
+
if (reach && relay_enabled) relay.problem = relay_problem(relay, status.running, Boolean(local_status(data).running));
|
|
874
880
|
// The address handed to people: the owner's domain when it is on (direct, and outside the Workers quota), else the relay.
|
|
875
881
|
const address = tunnel_enabled && public_url ? public_url : relay_enabled ? relay.link : '';
|
|
876
|
-
return { running: status.running, port: status.running ? status.port : port, public_url, relay_enabled, tunnel_enabled, address, relay,
|
|
877
|
-
tunnel: tunnel ? { host: tunnel.host, name: tunnel.name, ...(await tunnel_status(data)) } : null };
|
|
882
|
+
return { running: status.running, port: status.running ? status.port : port, public_url, relay_enabled, tunnel_enabled, address, relay, checked: reach,
|
|
883
|
+
tunnel: tunnel ? { host: tunnel.host, name: tunnel.name, ...(reach ? await tunnel_status(data) : {}) } : null };
|
|
878
884
|
}
|
|
879
885
|
|
|
880
886
|
/** Make sure what a way from outside needs is there before it is turned on. */
|
package/runner/codiscuss.mjs
CHANGED
|
@@ -35,7 +35,7 @@ const HELP = t(`AI CoDiscuss CLI
|
|
|
35
35
|
schema [COMMAND] 离线查看命令与参数
|
|
36
36
|
api PATH 访问尚未封装的网站接口
|
|
37
37
|
join LINK|CODE 用本机 AI 加入另一台电脑上的房间(外部成员)
|
|
38
|
-
invited COMMAND
|
|
38
|
+
invited COMMAND 查看外部房间,调整信任等级、同意或拒绝唤醒、退出
|
|
39
39
|
repo COMMAND 外部成员只读查看对方电脑开放的项目
|
|
40
40
|
|
|
41
41
|
codiscuss service --help
|
|
@@ -1596,8 +1596,10 @@ function switch_codex_adapter(context, name, profile, adapter) {
|
|
|
1596
1596
|
const store = new DiscussionStore(current.directory);
|
|
1597
1597
|
try {
|
|
1598
1598
|
const binding = store.binding(name).session_id;
|
|
1599
|
-
|
|
1600
|
-
|
|
1599
|
+
// A member invited with a conversation the CLI copies works in that copy, and keeps naming the original it came from.
|
|
1600
|
+
const copied = Boolean(session && binding && session !== binding && adapter_profile(profile.adapter)?.copy_bound);
|
|
1601
|
+
if (session && binding && session !== binding && !copied) throw new Error('原会话绑定不一致,请先核对原会话');
|
|
1602
|
+
if (!copied) session = binding || session;
|
|
1601
1603
|
} finally { store.close(); }
|
|
1602
1604
|
}
|
|
1603
1605
|
if (!session) throw new Error('尚无实际 Codex 会话,不能切换;请先完成首次接入');
|
|
@@ -168,8 +168,9 @@ export class DiscussionStore {
|
|
|
168
168
|
const next = entries[index];
|
|
169
169
|
if (JSON.stringify(item) === JSON.stringify(next)) return true;
|
|
170
170
|
const session = this.binding(item[0]).session_id || item[6];
|
|
171
|
+
// A member working in a copy of its invited conversation keeps naming the original, so that may stay as it was.
|
|
171
172
|
return item[0] === next[0] && same_session_family(item[1], next[1])
|
|
172
|
-
&& session && next[6] === session && (!item[6] || item[6] === session)
|
|
173
|
+
&& (next[6] === item[6] || session && next[6] === session && (!item[6] || item[6] === session))
|
|
173
174
|
&& JSON.stringify(item.slice(2, 6)) === JSON.stringify(next.slice(2, 6));
|
|
174
175
|
});
|
|
175
176
|
// Experts invited during a run only add entries; every existing binding must stay as it was.
|
|
@@ -81,6 +81,34 @@ export function access_label(level) { return level === 'own' ? '自行决定' :
|
|
|
81
81
|
*/
|
|
82
82
|
export const TASK_SUBCOMMANDS = ['room', 'message', 'turn', 'state', 'goal', 'mode', 'review', 'sequence', 'question', 'execution', 'health', 'schema', 'launch workflow-adopt', 'launch workflow-join', 'launch workflow-leave', 'launch host-control', 'attachment', 'launch image', 'repo'];
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* The limit on a quick answer given inline with --body: a run allowed only codiscuss commands refuses a command line
|
|
86
|
+
* carrying shell symbols, and PowerShell rewrites `$` and backticks inside quotes. The participant skill says the same.
|
|
87
|
+
*/
|
|
88
|
+
export const INLINE_BODY_RULE = '--body 的正文不能含反引号、英文括号、$、;、&、|、<、> 或换行,含这些时写草稿再用 --body-file';
|
|
89
|
+
|
|
90
|
+
// How many times one execution is resumed to correct commands it can fix itself (2026-11-19 user: three).
|
|
91
|
+
export const MAX_REFUSAL_RETRIES = 3;
|
|
92
|
+
const REFUSED_COMMAND_SHOWN = 200;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Which refusals a member can correct itself: the adapter's denials carrying a `retry_hint`, as `{command, hint}`.
|
|
96
|
+
*/
|
|
97
|
+
export const correctable_refusals = denials => (denials || []).filter(item => item.retry_hint)
|
|
98
|
+
.map(item => ({ command: String(item.detail || '').slice(0, REFUSED_COMMAND_SHOWN), hint: item.retry_hint }));
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* What a member hears when the program resumes its session after refused commands: every refusal so far in this
|
|
102
|
+
* execution, oldest first, each with what to change, and how many corrections are left.
|
|
103
|
+
*/
|
|
104
|
+
export function refusal_retry_prompt(execution_id, refusals, attempt = 1) {
|
|
105
|
+
const listed = refusals.map((item, index) => `${index + 1}. 命令「${item.command}」被拒:${item.hint}`).join('\n');
|
|
106
|
+
const left = MAX_REFUSAL_RETRIES - attempt;
|
|
107
|
+
return `你在这次房间任务(执行 #${execution_id},仍在进行)里的命令被本机安全规则拒绝,回答还没有提交(第 ${attempt} 次提醒,`
|
|
108
|
+
+ `${left ? `之后还有 ${left} 次改正机会` : '这是最后一次改正机会'}):\n\n${listed}\n\n`
|
|
109
|
+
+ '按上面改正后接着完成,已经做完的部分不必重做,最后提交这次执行的回答。';
|
|
110
|
+
}
|
|
111
|
+
|
|
84
112
|
/**
|
|
85
113
|
* The task text for a member woken on this computer for a room on another computer (an external member): the project
|
|
86
114
|
* lives over there and is read only through `repo`; a locked-down run (`lockdown`) may run only codiscuss subcommands and
|
|
@@ -96,8 +124,8 @@ export function external_task_text({ name, messages, requests = [], cli, access_
|
|
|
96
124
|
const limits = lockdown ? `本次只能运行 ${cli} 子命令,只能在 ${draft_directory} 写草稿,不能读写其他本机文件或联网。` : '';
|
|
97
125
|
const instructions = `你作为外部成员参加另一台电脑上的房间,只读对方开放的项目,不修改任何文件。命令只用 subcommands 列出的 ${cli} 子命令。${limits}${reading}`;
|
|
98
126
|
const prompt = `${wake_opening(requests, name)}(来自另一台电脑上的房间),对应消息 ${messages}。${instructions}`
|
|
99
|
-
+ `用 ${cli} message view 消息编号${access} 看原文,${cli} room
|
|
100
|
-
+ `做完用 ${cli} message post --body-file 草稿${access} 提交一次回答(简短回答可用 --body "回答")。房间按 Markdown 显示回答,内容较多时用分段、标题或列表排版。先读任务文件 ${task_path} 与其中列出的技能。`;
|
|
127
|
+
+ `用 ${cli} message view 消息编号${access} 看原文,${cli} room view${access} 看房间概况。`
|
|
128
|
+
+ `做完用 ${cli} message post --body-file 草稿${access} 提交一次回答(简短回答可用 --body "回答";${INLINE_BODY_RULE})。房间按 Markdown 显示回答,内容较多时用分段、标题或列表排版。先读任务文件 ${task_path} 与其中列出的技能。`;
|
|
101
129
|
return { instructions, prompt };
|
|
102
130
|
}
|
|
103
131
|
|
|
@@ -158,10 +186,10 @@ export function free_task_text({ name, discussion, discussion_request, profile,
|
|
|
158
186
|
}
|
|
159
187
|
// A greeting deserves a quick answer, and reading the skills first costs it one or two model rounds.
|
|
160
188
|
const access = access_file ? ` --access-file ${access_file}` : '';
|
|
161
|
-
// A one-line answer goes inline: a draft file guards long or quoted text and retries, which a greeting does not need.
|
|
162
189
|
// The credential already names the room, the member and this execution, so the commands carry only what changes.
|
|
163
190
|
// The message numbers are already known, so the original is one `message view` away instead of a list (#3129).
|
|
164
|
-
|
|
191
|
+
// A one-line answer goes inline: a draft file guards long or symbol-laden text and retries, which a greeting does not need.
|
|
192
|
+
const quick = `问候、致谢等简单消息可跳过技能:${cli} message view 上面的消息编号${access} 看原文,${cli} message post --body "回答"${access} 回复(${INLINE_BODY_RULE})。`;
|
|
165
193
|
const opening = `${wake_opening(requests, name, discussion)},对应消息 ${messages}。`;
|
|
166
194
|
// Choosing a sub-workflow was left to the host's memory and got skipped, so every host task now asks for it (#4487).
|
|
167
195
|
const route = workflow ? '本房间启用了工作流:派活或改文件之前,先读 workflow.skill_path,把这次请求对照主线和 workflow.sub_workflows 每一项的 description;命中就读它的 SKILL.md 并照做,不问要不要用,回答开头写明走的哪条;都不命中就写明按普通请求处理。' : '';
|