ai_co_discuss 0.4.95 → 0.4.96

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.
@@ -529,9 +529,13 @@ def member_room_view(connection, room_id, member):
529
529
  room = connection.execute("SELECT r.id,r.title,r.goal,d.archived FROM rooms r JOIN room_directory d ON d.room_id=r.id WHERE r.id=?",
530
530
  (room_id,)).fetchone()
531
531
  labels = free_room.member_display_names(connection, room_id)
532
+ # An external member carries the vendor its computer reported (`platform`, display only), so the other computer's page
533
+ # can show it as this room does; local members are known by their platform names.
532
534
  members = [{"name": row["name"], "label": labels.get(row["name"], row["name"]), "role": row["role"], "status": row["status"],
533
- "external": row["access"] == "external"}
534
- for row in connection.execute(f"SELECT name,role,status,access FROM room_members WHERE room_id=? AND status<>'removed' AND {free_room.REGISTERED_MEMBER} ORDER BY id",
535
+ "external": row["access"] == "external", **({"platform": row["platform"] or ""} if row["access"] == "external" else {})}
536
+ for row in connection.execute(f"""SELECT room_members.name,room_members.role,room_members.status,room_members.access,ext.platform
537
+ FROM room_members LEFT JOIN external_members ext ON ext.member_id=room_members.id
538
+ WHERE room_members.room_id=? AND room_members.status<>'removed' AND {free_room.REGISTERED_MEMBER} ORDER BY room_members.id""",
535
539
  (room_id,))]
536
540
  latest = connection.execute("""SELECT COALESCE(MAX(id),0) FROM messages m WHERE room_id=?
537
541
  AND NOT EXISTS (SELECT 1 FROM internal_task_messages t WHERE t.message_id=m.id)""", (room_id,)).fetchone()[0]
package/backend/server.py CHANGED
@@ -3202,6 +3202,9 @@ class DiscussionHandler(BaseHTTPRequestHandler):
3202
3202
  connection.commit()
3203
3203
  if parts[3:4] == ["external-members"]:
3204
3204
  result, status = external_owner_api(connection, room_id, parts[4:], params, method, token, self.read_payload)
3205
+ # Revoking (or finding expired) the member that held the room frees it: messages queued behind it go now.
3206
+ if method == "POST":
3207
+ drain_room_queue(connection, room_id)
3205
3208
  connection.commit()
3206
3209
  return self.respond(result, status)
3207
3210
  if parts[3:] == ["discussion"]:
@@ -221,8 +221,6 @@
221
221
  "借出时间": "Lent for",
222
222
  "借出多久由你决定,最长 3 天;加入后可在外部房间里续期或改短。": "You decide how long to lend it, up to 3 days; after joining you can renew or shorten it in the external room.",
223
223
  "借出时间已更新": "Loan time updated",
224
- "由对方决定": "Set by the invitee",
225
- "借出多久由对方加入时决定,你可随时撤销。": "The invitee decides how long to lend its AI when joining; you can revoke at any time.",
226
224
  "对方设定": "set by the invitee",
227
225
  "借出到": "Lent until",
228
226
  "对方未说明": "Not stated",
@@ -232,5 +230,15 @@
232
230
  "借出多久由对方决定,你可随时撤销": "The invitee decides how long it is lent; you can revoke at any time",
233
231
  "由对方加入时决定": "Set by the invitee when joining",
234
232
  "不变": "Unchanged",
235
- "从现在起重新计算,最长 3 天": "Counted again from now, 3 days at most"
233
+ "从现在起重新计算,最长 3 天": "Counted again from now, 3 days at most",
234
+ "绑定了多个线上网站,生成链接时选择": "Several hosted sites connected; choose one when making the link",
235
+ "未绑定线上网站,无法生成链接": "No hosted site connected; a link cannot be made",
236
+ "目录": "Folders",
237
+ "读取": "Reads",
238
+ "只读 · 每小时 {hourly} · 共 {total}": "Read only · {hourly} per hour · {total} in all",
239
+ "中转": "Relay",
240
+ "调整「{room}」的设置": "Settings for “{room}”",
241
+ "只影响你这台电脑上的 AI,对方房间的开放范围由对方决定。": "Only affects your AI on this computer; what the other room opens is up to its owner.",
242
+ "当前借出到 {time}": "Currently lent until {time}",
243
+ "正在添加席位…": "Adding the seat…"
236
244
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.4.95",
3
+ "version": "0.4.96",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
@@ -2399,6 +2399,8 @@ export async function launch_main(args = process.argv.slice(2), input_text) {
2399
2399
  let result;
2400
2400
  if (positionals[0] === 'settings') result = { ...(input ? save_launch_settings(home, input) : launch_settings(home)), api_providers: API_PROVIDERS,
2401
2401
  scheduler_providers: SCHEDULER_PROVIDERS, scheduler_modes: SCHEDULER_MODES, scheduler_default_mode: DEFAULT_SCHEDULER_MODE, api_keys: saved_api_keys(home), managed_api_keys: restricted ? managed_api_keys(home) : [], projects: launch_projects(home).projects, projects_restricted: restricted, full_access_only: ADAPTER_IDS.filter(id => adapter_capabilities(id).no_sandbox), workspace: space.workspace, user_home: restricted ? homedir() : '', ...expert_presets(home), ...workflow_library(home) };
2402
+ // The online site an invitation would use, so an external expert's card says before the room exists whether a link can be made.
2403
+ if (positionals[0] === 'settings') result.invite_site = await (await import('./external_gateway.mjs')).invite_site_state(home);
2402
2404
  else if (positionals[0] === 'projects') result = input ? save_launch_projects(home, input) : launch_projects(home);
2403
2405
  else if (positionals[0] === 'presets') result = input ? save_expert_presets(home, input) : expert_presets(home);
2404
2406
  else if (positionals[0] === 'workflows') result = await workflows_command(home, input || {});
@@ -869,7 +869,10 @@ async function start_run(home, record, execution, { lockdown, software, end, res
869
869
  role: 'member', cwd: null, project_access: 'read', draft_directory: drafts, open_level: record.open_level, directories,
870
870
  skills: ['discuss-participant/SKILL.md', 'discuss-participant/references/room.md'].map(file => join(skills_directory, file)),
871
871
  cli, subcommands: TASK_SUBCOMMANDS, access_file: access_path, tool_lockdown: lockdown, instructions });
872
- const profile = { adapter: record.ai.adapter, ...software, model: record.ai.model || software.model || '', effort: record.ai.effort, cwd: workdir, project_access: 'read',
872
+ // 不受限 means the AI works on this computer as usual (全放开): a sandbox would run its commands as another Windows
873
+ // account, which cannot open the record's credential (DPAPI, current user), so its `codiscuss` calls would all fail.
874
+ // A locked-down run is confined by the tool rules instead and keeps read-only.
875
+ const profile = { adapter: record.ai.adapter, ...software, model: record.ai.model || software.model || '', effort: record.ai.effort, cwd: workdir, project_access: lockdown ? 'read' : 'full',
873
876
  ...(Object.hasOwn(record.ai, 'system_prompt') ? { system_prompt: record.ai.system_prompt } : {}) };
874
877
  const log_path = join(base, `external-${execution.id}.log`);
875
878
  const deliver = deps.deliver || (await import('./adapters/index.mjs')).deliver_task;
@@ -198,6 +198,12 @@ async function invite_site(home, site_url) {
198
198
  return { site: found[0], link: found[1] };
199
199
  }
200
200
 
201
+ /** The site an invite would name now: `{ site }`, or `{ problem }` (`site_missing` / `site_required`) when none can be picked. */
202
+ export async function invite_site_state(home) {
203
+ try { return { site: (await invite_site(home)).site }; }
204
+ catch (error) { return { problem: error.code || 'site_missing' }; }
205
+ }
206
+
201
207
  /**
202
208
  * Issue an invite for one room: a 12-character code valid ten minutes, kept here only as its hash, and the link that
203
209
  * carries it with this computer's key fingerprint. The code and link are returned this once.
package/web/app.js CHANGED
@@ -4110,7 +4110,7 @@ async function load_launch_settings({ relay_known = () => {} } = {}) {
4110
4110
  state.launch.create_preferences = { ...settings.create_preferences, ...create_preferences_pending };
4111
4111
  Object.assign(state.launch, { available: true, profiles: settings.participants, projects: settings.projects || [], projects_restricted: settings.projects_restricted === true, user_home: settings.user_home || "", api_providers: settings.api_providers || {}, api_keys: settings.api_keys || {}, managed_api_keys: settings.managed_api_keys || [],
4112
4112
  presets: settings.presets || [], builtin_presets: settings.builtin_presets || [], hidden_builtins: settings.hidden_builtins || [], workflows: settings.workflows || [], card_platforms: settings.platforms || [], description_templates: settings.description_templates || {},
4113
- scheduler_providers: settings.scheduler_providers || {}, scheduler_modes: settings.scheduler_modes || {}, scheduler_default_mode: settings.scheduler_default_mode || "", error: "",
4113
+ scheduler_providers: settings.scheduler_providers || {}, scheduler_modes: settings.scheduler_modes || {}, scheduler_default_mode: settings.scheduler_default_mode || "", invite_site: settings.invite_site || null, error: "",
4114
4114
  notice: relay_machine ? t('经电脑「{value1}」执行本机操作', { value1: relay_machine.name }) : local_connection ? t('已连接本机服务,讨论保存在当前网站') : "" });
4115
4115
  Object.values(state.launch.profiles).forEach(fill_api_key);
4116
4116
  move_browser_description_templates();
@@ -6525,7 +6525,7 @@ window.discuss_view = { snapshot: view_snapshot, write_field: write_view_field,
6525
6525
  sessions: admin_sessions, revoke: revoke_admin_sessions, change_password: change_admin_password },
6526
6526
  device: { request: device_request, pair: pair_this_device, take_scanned: take_scanned_pairing, invite: invite_device, renew: renew_this_device, forget: forget_pairing,
6527
6527
  label: device_label, prompt_confirm: () => state.device.prompt?.run(), prompt_cancel: () => state.device.prompt?.cancel() },
6528
- request: request_json, rewind_plan, identities: IDENTITIES, display_name, mention_handles, mentioned_members, render_room_markdown, sources: SOURCE_LABELS,
6528
+ request: request_json, rewind_plan, identities: IDENTITIES, platform_identity: name => PLATFORM_IDENTITIES[name], display_name, mention_handles, mentioned_members, render_room_markdown, sources: SOURCE_LABELS,
6529
6529
  set_member_access, set_member_model, allow_denials, set_member_adapter, reload_room_models, read_member_skills, read_room_files, read_room_page, read_room_media, read_execution_details, interject_execution, read_member_chat, send_member_chat, stop_member_chat, pause_execution, limits_label, stop_reason_label, participant_model, participant_files, participant_session_hint, participant_access,
6530
6530
  turn_label, turn_guidance, round_groups, limit_rounds, progress_speaker, brief_meta, max_message_length: MAX_MESSAGE_LENGTH, provenance: message_provenance, format_time };
6531
6531