ai_co_discuss 0.5.21 → 0.5.22
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/references/control.md +2 -2
- package/backend/free_room.py +20 -4
- package/backend/message_queue.py +9 -0
- package/backend/schema.sql +2 -1
- package/backend/server.py +44 -6
- package/docs/en/guide/remote.md +1 -1
- package/docs/en/guide/rooms.md +7 -2
- package/docs/guide/remote.md +1 -1
- package/docs/guide/rooms.md +6 -2
- package/frontend/locales/en/app.json +1 -0
- package/frontend/locales/en/backend.json +4 -0
- package/frontend/locales/en/room.json +7 -0
- package/package.json +1 -1
- package/runner/discussion_launch.mjs +54 -18
- package/runner/free_runner.mjs +28 -6
- package/runner/i18n_en.mjs +6 -0
- package/web/admin.js +1 -1
- package/web/app.js +49 -6
- package/web/i18n.js +3 -3
- package/web/markdown.css +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +58 -58
package/runner/free_runner.mjs
CHANGED
|
@@ -197,7 +197,12 @@ export async function user_request_texts(config, execution) {
|
|
|
197
197
|
for (const message_id of message_ids) {
|
|
198
198
|
try {
|
|
199
199
|
const message = await api(config, `/messages/${message_id}`);
|
|
200
|
-
if (message.
|
|
200
|
+
if (message.relay_room) {
|
|
201
|
+
for (const request of execution.requests.filter(item => item.message_id === message_id)) {
|
|
202
|
+
request.relay = { from_room: message.relay_room, title: message.relay_title, host: message.relay_host,
|
|
203
|
+
relation: message.relay_relation, note: '来自关联房间主持人的跨房消息,不代表用户本人新授权' };
|
|
204
|
+
}
|
|
205
|
+
} else if (message.author === '用户' && message.text) texts.push(message.text);
|
|
201
206
|
} catch { /* The host still reads the message itself. */ }
|
|
202
207
|
}
|
|
203
208
|
return texts;
|
|
@@ -284,8 +289,23 @@ export function room_goal(room) {
|
|
|
284
289
|
note: '这是整个房间的任务;一次 Goal 或讨论结束不等于它完成。Goal 完成后对照这里判断还剩什么,没有目标文字时读首条用户消息。' };
|
|
285
290
|
}
|
|
286
291
|
|
|
292
|
+
async function linked_room_summaries(config) {
|
|
293
|
+
const describe = async room_id => {
|
|
294
|
+
try {
|
|
295
|
+
const room = await api({ ...config, room: room_id }, '');
|
|
296
|
+
return { room_id, title: room.title, latest_id: room.latest_id,
|
|
297
|
+
running: (room.free?.members || []).some(member => ['started', 'dispatched'].includes(member.execution?.status)) };
|
|
298
|
+
} catch { return { room_id }; }
|
|
299
|
+
};
|
|
300
|
+
const [parent, children] = await Promise.all([
|
|
301
|
+
config.spawned_from ? describe(config.spawned_from) : null,
|
|
302
|
+
Promise.all((config.spawned_rooms || []).map(item => describe(item.room))),
|
|
303
|
+
]);
|
|
304
|
+
return { parent, children };
|
|
305
|
+
}
|
|
306
|
+
|
|
287
307
|
export function free_task_files(config, member, execution, binding, { session = null, suggestions = [], reviews = [], stopped = [], process_access = true,
|
|
288
|
-
workflow = null, room_members = [], goal = null, attachments = [], room = null, model_change = null, request_texts = [] } = {}) {
|
|
308
|
+
workflow = null, room_members = [], goal = null, attachments = [], room = null, model_change = null, request_texts = [], linked_rooms = null } = {}) {
|
|
289
309
|
const id = `free-${execution.id}`;
|
|
290
310
|
const draft_directory = member_drafts(config, member.name);
|
|
291
311
|
mkdirSync(draft_directory, { recursive: true });
|
|
@@ -359,14 +379,14 @@ export function free_task_files(config, member, execution, binding, { session =
|
|
|
359
379
|
if (member.role === 'host') {
|
|
360
380
|
if (requests.some(item => item.sequence || item.question?.task || item.question_needed)) skills.push('discuss-host/references/relay.md');
|
|
361
381
|
// A notice, or a hand-back where someone failed or was cancelled, is what calls for diagnosing and recovering.
|
|
362
|
-
if (requests.some(item => item.purpose === 'notice' || (item.outcome || []).some(entry => ['failed', 'cancelled'].includes(entry.status)))) {
|
|
382
|
+
if (linked_rooms || requests.some(item => item.purpose === 'notice' || (item.outcome || []).some(entry => ['failed', 'cancelled'].includes(entry.status)))) {
|
|
363
383
|
skills.push('discuss-host/references/control.md');
|
|
364
384
|
}
|
|
365
385
|
if (workflow_field || named?.workflows) skills.push('discuss-host/references/workflow.md');
|
|
366
386
|
if (reviews.length) skills.push('discuss-host/references/dev-flow.md');
|
|
367
387
|
}
|
|
368
388
|
atomic_json(task_path, { site: config.site, room: config.room, mode: 'free', member: member.name,
|
|
369
|
-
execution_id: execution.id, requests, request_messages: execution.requests.map(item => item.message_id),
|
|
389
|
+
execution_id: execution.id, requests, ...(linked_rooms ? { linked_rooms } : {}), request_messages: execution.requests.map(item => item.message_id),
|
|
370
390
|
...(attachments.length ? { attachments } : {}),
|
|
371
391
|
request_purposes: execution.requests.map(item => item.purpose || 'ask'),
|
|
372
392
|
...(discussion_request ? { discussion_request } : {}),
|
|
@@ -917,7 +937,7 @@ export class FreeRoomRunner {
|
|
|
917
937
|
// Manual members are listed apart; they are never delivered to but may host or be recommended.
|
|
918
938
|
const everyone = [...inbox.members, ...(inbox.observers || [])];
|
|
919
939
|
const host = everyone.find(member => member.role === 'host');
|
|
920
|
-
const waiting = host?.pending.filter(request => request.purpose === 'route' && !request.group_action
|
|
940
|
+
const waiting = host?.pending.filter(request => request.purpose === 'route' && !request.relay_room && !request.group_action
|
|
921
941
|
&& !this.routed.has(request.id) && !this.saved_suggestion(request.id)) || [];
|
|
922
942
|
for (const request of waiting) {
|
|
923
943
|
this.routed.add(request.id);
|
|
@@ -1122,9 +1142,11 @@ export class FreeRoomRunner {
|
|
|
1122
1142
|
const attachments = await request_attachments(this.config, execution, member_runtime(this.config, member.name));
|
|
1123
1143
|
const request_texts = member.role === 'host' ? await user_request_texts(this.config, execution) : [];
|
|
1124
1144
|
const model_change = this.model_change(member.name);
|
|
1145
|
+
const linked_rooms = member.role === 'host' && (this.config.spawned_from || this.config.spawned_rooms?.length)
|
|
1146
|
+
? await linked_room_summaries(this.config) : null;
|
|
1125
1147
|
const task = free_task_files(this.config, member, execution, binding, {
|
|
1126
1148
|
session, suggestions: scheduler_suggestions, reviews: review_handoffs, stopped, workflow, room_members: this.room?.members,
|
|
1127
|
-
goal: this.room?.goal_state?.goal || null, attachments, room: this.room, model_change, request_texts,
|
|
1149
|
+
goal: this.room?.goal_state?.goal || null, attachments, room: this.room, model_change, request_texts, linked_rooms,
|
|
1128
1150
|
});
|
|
1129
1151
|
this.store.db.prepare('DELETE FROM metadata WHERE key IN (?,?)').run(`recovery:${execution.id}`, `recovery-denied:${execution.id}`);
|
|
1130
1152
|
invoked = true;
|
package/runner/i18n_en.mjs
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** English CLI strings. */
|
|
2
2
|
export default {
|
|
3
|
+
"房间:create-room --title 标题 [--goal 目标] [--members 甲,乙] [--host 平台] [--host-model 模型] [--host-effort 档位] [--cwd 子目录] [--access read|write] [--text 首条消息 | --body-file FILE] [--submission-id ID]": "Rooms: create-room --title TITLE [--goal GOAL] [--members A,B] [--host PLATFORM] [--host-model MODEL] [--host-effort LEVEL] [--cwd SUBDIRECTORY] [--access read|write] [--text MESSAGE | --body-file FILE] [--submission-id ID]",
|
|
4
|
+
"room-post --room 房间编号 (--text 话 | --body-file FILE) [--interrupt] [--submission-id ID] 在关联房间(你新建的,或新建本房间的)发言,空闲时直达主持人,忙时排队;仅父房间可用 --interrupt 打断子房间;自用户上次发言起两边互传的条数受本机“关联房间互传上限”限制(默认不限);读它用平常的读取命令、房间编号写新房间的(跨房间只能读)。": "room-post --room ROOM (--text MESSAGE | --body-file FILE) [--interrupt] [--submission-id ID] sends to the linked host, queuing when busy. Only a parent may interrupt its child. The linked-room message limit counts both directions since the last owner message and defaults to unlimited. Use regular read commands with the linked room ID to follow progress.",
|
|
5
|
+
"正文文件须位于主持人的项目或草稿目录": "The message file must be in the host’s project or drafts directory.",
|
|
6
|
+
"--body-file 与 --text 只能选一项": "Choose either --body-file or --text.",
|
|
7
|
+
"仅父房间主持人可以打断子房间": "Only the parent room’s host can interrupt a child room.",
|
|
8
|
+
"须用 --text 或 --body-file 写明要发的消息": "Provide the message with --text or --body-file.",
|
|
3
9
|
"这个房间已有分享正在发布": "A share is already being published for this room.",
|
|
4
10
|
"本机没有登记这个房间": "This room is not registered on this computer.",
|
|
5
11
|
"分享请求失败(HTTP {status})": "Share request failed (HTTP {status}).",
|