ai_co_discuss 0.4.86 → 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.
@@ -15,7 +15,7 @@ import { parseArgs } from 'node:util';
15
15
  import { gunzipSync } from 'node:zlib';
16
16
 
17
17
  import { adapter_profile, API_PROVIDERS, lockdown_support } from './adapters/profiles.mjs';
18
- import { external_task_text, TASK_SUBCOMMANDS } from './expert_prompts.mjs';
18
+ import { correctable_refusals, external_task_text, MAX_EXPERT_PROMPT, MAX_REFUSAL_RETRIES, refusal_retry_prompt, TASK_SUBCOMMANDS, with_expert_prompt } from './expert_prompts.mjs';
19
19
  import { atomic_json } from './files.mjs';
20
20
  import { t } from './i18n.mjs';
21
21
 
@@ -28,10 +28,14 @@ export const POLL_MS = 5000;
28
28
  export const RENEW_MS = 30000;
29
29
  // What “完全借用” allows when the owner sets no limit of their own.
30
30
  const HISTORY_LIMIT = 50;
31
+ // The end of a run's output kept with a run that ended unanswered, so its owner can see why; it never leaves this computer.
32
+ const OUTPUT_TAIL = 2000;
31
33
  const MODEL_LIMIT = 120;
32
34
  // What this computer keeps of each request its AI received and each answer it gave, so the history still reads after the
33
35
  // inviting room can no longer be reached.
34
36
  const TEXT_LIMIT = 4000;
37
+ // How many of the inviting room's latest messages the invited room's page shows.
38
+ const ROOM_MESSAGE_WINDOW = 100;
35
39
  // How often a pass also reads the member's current grant (`/view`) when nothing is woken; a wake and the room view always read it.
36
40
  const VIEW_REFRESH_MS = 60000;
37
41
  // The website gives up on a relayed request after 9 seconds; ask for an answer within that.
@@ -115,10 +119,25 @@ function read_json(path, fallback) {
115
119
  return existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : fallback;
116
120
  }
117
121
 
122
+ // The secrets last opened, by file: opening them starts PowerShell on Windows (about half a second, blocking), and the
123
+ // service sends several relay requests every few seconds. A file changed by another process is opened again.
124
+ const opened_secrets = new Map();
125
+ const file_stamp = path => { try { const { mtimeMs, size } = statSync(path); return `${mtimeMs}:${size}`; } catch { return ''; } };
126
+
118
127
  function read_secrets(home) {
119
- const stored = read_json(join(external_home(home), SECRETS_FILE), null);
120
- if (!stored) return {};
121
- return JSON.parse(stored.dpapi ? DPAPI_CODEC.open(stored) : PLAIN_CODEC.open(stored));
128
+ const path = join(external_home(home), SECRETS_FILE), stamp = file_stamp(path), kept = opened_secrets.get(path);
129
+ if (!stamp) return {};
130
+ if (kept?.stamp === stamp) return structuredClone(kept.secrets);
131
+ const stored = read_json(path, null);
132
+ const secrets = JSON.parse(stored.dpapi ? DPAPI_CODEC.open(stored) : PLAIN_CODEC.open(stored));
133
+ opened_secrets.set(path, { stamp, secrets: structuredClone(secrets) });
134
+ return secrets;
135
+ }
136
+
137
+ function write_secrets(home, secrets) {
138
+ const path = join(external_home(home), SECRETS_FILE);
139
+ atomic_json(path, secret_codec.seal(JSON.stringify(secrets)));
140
+ opened_secrets.set(path, { stamp: file_stamp(path), secrets: structuredClone(secrets) });
122
141
  }
123
142
 
124
143
  /** Read the store without changing it. */
@@ -148,7 +167,7 @@ function with_store(home, task) {
148
167
  const access = { get: () => (secrets ||= read_secrets(home)), changed: false };
149
168
  const result = task(store, access, Date.now());
150
169
  atomic_json(join(directory, STORE_FILE), store);
151
- if (access.changed) atomic_json(join(directory, SECRETS_FILE), secret_codec.seal(JSON.stringify(secrets)));
170
+ if (access.changed) write_secrets(home, secrets);
152
171
  return result;
153
172
  } finally { rmSync(lock, { force: true }); }
154
173
  }
@@ -394,7 +413,9 @@ function check_ai(input) {
394
413
  // The AI reaches the other room only through this computer's codiscuss (a CLI) or this module (the model API's room
395
414
  // and repo tools); App windows do neither.
396
415
  if (!['cli', 'api'].includes(profile?.kind)) throw failure('ai_unsupported', '外部成员只能派命令行软件(如 Claude Code)或模型 API');
397
- return { adapter, model: String(input.model || ''), effort: String(input.effort || '') };
416
+ // The member's own prompt, as on a room member's card: present (even empty) replaces the software's preset, null drops it.
417
+ const prompt = input.system_prompt === undefined || input.system_prompt === null ? {} : { system_prompt: String(input.system_prompt).slice(0, MAX_EXPERT_PROMPT) };
418
+ return { adapter, model: String(input.model || ''), effort: String(input.effort || ''), ...prompt };
398
419
  }
399
420
 
400
421
  /** The saved model API this AI runs on, as `[participant name, settings]`; empty when this computer has none. */
@@ -420,6 +441,8 @@ function ai_identity(home, ai) {
420
441
  export async function join_invite(home, input, deps = {}) {
421
442
  const invite = parse_invite(input.invite, input);
422
443
  const ai = check_ai(input);
444
+ // A conversation this computer's software already holds, picked to carry its context into the room.
445
+ const session_id = String(input.session_id || '');
423
446
  const keys = await machine_keys(invite.site, invite.machine, deps);
424
447
  if (invite.fingerprint && invite.fingerprint !== keys.fingerprint) {
425
448
  throw failure('fingerprint_mismatch', '这不是邀请你的那台电脑:指纹不符,已停止加入。请向对方确认链接');
@@ -457,7 +480,8 @@ export async function join_invite(home, input, deps = {}) {
457
480
  member: joined.member.name, member_id: joined.member.id ?? null, key_id, open_level: joined.level || invite.level || 'read',
458
481
  directories: Array.isArray(joined.directories) ? joined.directories : [],
459
482
  expires_at: Number(joined.expires_at) ? Number(joined.expires_at) * 1000 : null, ai, ai_reported: JSON.stringify(identity),
460
- limits: null, paused: false, status: 'active', contact: { at: now, state: 'online', error: '' }, approvals: [], running: null };
483
+ limits: null, paused: false, status: 'active', contact: { at: now, state: 'online', error: '' }, approvals: [], running: null,
484
+ ...(session_id ? { session_id } : {}) };
461
485
  if (previous) {
462
486
  const { end_reason, leave_pending, ...kept } = previous;
463
487
  store.records[id] = { ...kept, ...fresh, rejoined_at: now };
@@ -632,26 +656,41 @@ function kept_messages(record) {
632
656
  return [...messages.values()].sort((a, b) => a.id - b.id);
633
657
  }
634
658
 
635
- /** The record with what the inviting room shows this member, when it can be reached. */
636
- export async function room_view(home, { id, cached = false }, deps = {}) {
659
+ /** One page of the inviting room's messages, oldest first: those numbered above `after`, at most `limit`. */
660
+ async function message_page(home, id, record, after, limit, deps) {
661
+ const path = `${MEMBER_API.messages(record.room)}?${new URLSearchParams({ after, limit })}`;
662
+ return (await member_api(home, id, 'GET', path, undefined, deps)).messages || [];
663
+ }
664
+
665
+ /**
666
+ * The record with what the inviting room shows this member (what it may read there anyway), when it can be reached:
667
+ * the room's latest messages, oldest first, or with `before`, the page just before that message. `earlier` says whether
668
+ * older messages remain.
669
+ */
670
+ export async function room_view(home, { id, cached = false, before }, deps = {}) {
637
671
  const record = find_record(read_store(home), id);
638
672
  // What this computer already knows, without the network: the page shows it at once while the real read is under way.
639
- if (cached) return { record: record_view(record, read_store(home)), room: null, messages: kept_messages(record) };
640
- let room = null, problem = null;
673
+ if (cached) return { record: record_view(record, read_store(home)), room: null, messages: kept_messages(record), earlier: false };
674
+ if (before !== undefined) {
675
+ const end = Math.max(0, Number(before) - 1), after = Math.max(0, end - ROOM_MESSAGE_WINDOW);
676
+ try {
677
+ const messages = end > after ? await message_page(home, id, record, after, end - after, deps) : [];
678
+ return { messages, earlier: after > 0 };
679
+ } catch (error) { return { messages: [], earlier: true, error: error.message, ...failure_fields(error) }; }
680
+ }
681
+ let room = null, problem = null, earlier = false;
641
682
  let messages = [];
642
683
  try {
643
- // What the page shows in the middle: requests naming this AI and this AI's own answers, oldest first. Sent together,
644
- // since each one crosses the relay and in turn they outlast the page's refresh.
645
- const query = field => `${MEMBER_API.messages(record.room)}?${new URLSearchParams({ [field]: record.member })}`;
646
- const [view, ...pages] = await Promise.all([refresh_grant(home, id, deps),
647
- ...['mention', 'author'].map(field => member_api(home, id, 'GET', query(field), undefined, deps))]);
684
+ // The view comes first for the room's latest message number.
685
+ const view = await refresh_grant(home, id, deps);
686
+ const after = Math.max(0, (Number(view?.latest_message_id) || 0) - ROOM_MESSAGE_WINDOW);
687
+ messages = await message_page(home, id, record, after, ROOM_MESSAGE_WINDOW, deps);
648
688
  room = view;
649
- const unique = new Map(pages.flatMap(page => page.messages || []).map(message => [message.id, message]));
650
- messages = [...unique.values()].sort((a, b) => a.id - b.id);
689
+ earlier = after > 0;
651
690
  } catch (error) { problem = error; messages = kept_messages(record); }
652
691
  const store = read_store(home);
653
692
  // Also under `room`, where the page (子Task6) looks for them.
654
- return { record: record_view(store.records[id], store), room: room ? { ...room, messages } : null, messages,
693
+ return { record: record_view(store.records[id], store), room: room ? { ...room, messages } : null, messages, earlier,
655
694
  ...(problem ? { error: problem.message, ...failure_fields(problem) } : {}) };
656
695
  }
657
696
 
@@ -751,18 +790,25 @@ export async function wake(home, id, request_ids, deps = {}, { only = false } =
751
790
  }
752
791
 
753
792
  /** Write this run's files and hand it to the adapter layer; the run ends through its callbacks or a failure here. */
754
- async function deliver_external(home, record, execution, { lockdown, software }, deps) {
755
- let settled = false;
793
+ async function deliver_external(home, record, execution, { lockdown, software, tried = { attempts: 0, refusals: [] } }, deps) {
794
+ let settled = false, refusals = [];
756
795
  const end = reason => {
757
796
  if (settled) return;
758
797
  settled = true;
759
- finish(home, record.id, execution.id, reason, deps).catch(error => deps.log?.(error.message));
798
+ // A command refused for something the AI can correct (shell symbols in an inline answer): the same session is
799
+ // resumed with every such refusal so far, up to MAX_REFUSAL_RETRIES times.
800
+ const next = { attempts: tried.attempts + 1, refusals: [...tried.refusals, ...refusals] };
801
+ const retry = refusals.length && tried.attempts < MAX_REFUSAL_RETRIES ? () => deliver_external(home, find_record(read_store(home), record.id), execution,
802
+ { lockdown, software, tried: next }, deps) : null;
803
+ finish(home, record.id, execution.id, reason, deps, retry).catch(error => deps.log?.(error.message));
760
804
  };
761
- try { await start_run(home, record, execution, { lockdown, software, end }, deps); }
805
+ const take_denials = denials => { refusals = correctable_refusals(denials); };
806
+ const resume = tried.attempts ? refusal_retry_prompt(execution.id, tried.refusals, tried.attempts) : '';
807
+ try { await start_run(home, record, execution, { lockdown, software, end, resume, take_denials }, deps); }
762
808
  catch (error) { end(error.message || t('执行失败')); }
763
809
  }
764
810
 
765
- async function start_run(home, record, execution, { lockdown, software, end }, deps) {
811
+ async function start_run(home, record, execution, { lockdown, software, end, resume, take_denials }, deps) {
766
812
  const base = join(external_home(home), 'runtime', record.id);
767
813
  // A fresh empty folder each run: nothing of this computer is in reach of the AI's own file tools. A locked-down run
768
814
  // works in its draft folder instead (子Task5 CONTRACT §1), which holds only its own drafts.
@@ -787,22 +833,26 @@ async function start_run(home, record, execution, { lockdown, software, end }, d
787
833
  role: 'member', cwd: null, project_access: 'read', draft_directory: drafts, open_level: record.open_level, directories,
788
834
  skills: ['discuss-participant/SKILL.md', 'discuss-participant/references/room.md'].map(file => join(skills_directory, file)),
789
835
  cli, subcommands: TASK_SUBCOMMANDS, access_file: access_path, tool_lockdown: lockdown, instructions });
790
- const profile = { adapter: record.ai.adapter, ...software, model: record.ai.model || software.model || '', effort: record.ai.effort, cwd: workdir, project_access: 'read' };
836
+ const profile = { adapter: record.ai.adapter, ...software, model: record.ai.model || software.model || '', effort: record.ai.effort, cwd: workdir, project_access: 'read',
837
+ ...(Object.hasOwn(record.ai, 'system_prompt') ? { system_prompt: record.ai.system_prompt } : {}) };
791
838
  const log_path = join(base, `external-${execution.id}.log`);
792
839
  const deliver = deps.deliver || (await import('./adapters/index.mjs')).deliver_task;
793
840
  const result = await deliver(profile, { session_id: record.session_id || '' }, {
794
841
  id: `external-${execution.id}`, participant: record.member, directory: base, member_directory: base, task_path, access_path,
795
- draft_directory: drafts, extra_directories: [], skill_directories: [skills_directory], prompt, profile, images: [],
842
+ draft_directory: drafts, extra_directories: [], skill_directories: [skills_directory], prompt: resume || with_expert_prompt(prompt, profile), profile, images: [],
796
843
  tool_lockdown: lockdown, room_title: record.room_title,
797
844
  // For the model API: its room and repo tools go through `proxy_request` / `repo_command` with `external_access`;
798
845
  // no member credential or key is passed (CONTRACT §5.1).
799
846
  api_context: { home, site: record.site, room: record.room, mode: 'free', role: 'member', execution_id: execution.id, requests,
800
847
  read_after: execution.read_until ?? null, cwd: null, project_access: 'read', extra_directories: [], external_access: access },
801
848
  on_binding: session => bind_session(home, record.id, session),
802
- on_process: () => {}, on_activity: () => {}, on_note: () => {}, on_edits: () => {}, on_denials: () => {},
849
+ on_process: handle => run_processes.set(execution.id, { handle, end }), on_activity: () => {}, on_note: () => {}, on_edits: () => {}, on_denials: take_denials,
803
850
  on_output: (path, chunk) => appendFileSync(log_path, chunk, { mode: 0o600 }),
804
851
  on_failure: error => end(String(error?.message || error || t('执行失败'))),
805
- on_exit: () => end(''),
852
+ // The adapter names an operation its rules refused (a run that cannot ask ends right after). The full text names
853
+ // this computer's paths and the refused command, so it stays here; the inviting room hears only that it was refused.
854
+ on_exit: denial => end(denial ? { local: t('{member} {denial},未提交本次回答', { member: record.member, denial }),
855
+ shared: t('{member} 的操作被本机权限规则拒绝,未提交本次回答', { member: record.member }) } : ''),
806
856
  });
807
857
  if (result?.session_id) bind_session(home, record.id, result.session_id);
808
858
  // This computer cannot pass on a stop from the inviting room, nor live progress.
@@ -810,6 +860,19 @@ async function start_run(home, record, execution, { lockdown, software, end }, d
810
860
  .catch(error => deps.log?.(error.message));
811
861
  }
812
862
 
863
+ // The software process of each run in this service, by execution: stopped when the inviting room has closed the execution
864
+ // while the process stays (it answered, or the run was cancelled there, yet the software never exits).
865
+ const run_processes = new Map();
866
+
867
+ /** The inviting room no longer has this execution open: stop what still runs here and settle it as it ended there. */
868
+ async function settle_closed_run(home, id, execution_id, deps) {
869
+ const run = run_processes.get(execution_id);
870
+ try { run?.handle?.kill?.(); } catch (error) { deps.log?.(error.message); }
871
+ // The run's own ending settles it once, whichever comes first; a run this service did not start is settled here.
872
+ if (run) run.end('');
873
+ else await finish(home, id, execution_id, '', deps);
874
+ }
875
+
813
876
  function bind_session(home, id, session_id) {
814
877
  if (!session_id) return;
815
878
  with_store(home, store => { if (store.records[id]) store.records[id].session_id = String(session_id); });
@@ -821,7 +884,16 @@ function bind_session(home, id, session_id) {
821
884
  * as a note); still open there → failed, and the room is told why, as the room runner does; closed there without an
822
885
  * answer (cancelled, retracted) → ended.
823
886
  */
824
- async function finish(home, id, execution_id, reason, deps) {
887
+ /** The last part of a run's output on this computer, without terminal colour codes; empty when it wrote nothing. */
888
+ function run_output(home, id, execution_id) {
889
+ const path = join(external_home(home), 'runtime', id, `external-${execution_id}.log`);
890
+ if (!existsSync(path)) return '';
891
+ const text = readFileSync(path, 'utf8').replace(/\u001b\[[0-9;?]*[A-Za-z]/g, '').trim();
892
+ return text.length > OUTPUT_TAIL ? `…${text.slice(-OUTPUT_TAIL)}` : text;
893
+ }
894
+
895
+ async function finish(home, id, execution_id, reason, deps, retry = null) {
896
+ run_processes.delete(execution_id);
825
897
  change_record(home, id, record => { if (record.running?.execution_id === execution_id) record.running = null; });
826
898
  const record = read_store(home).records[id];
827
899
  const answers = await member_api(home, id, 'GET', `${MEMBER_API.messages(record.room)}?${new URLSearchParams({ author: record.member })}`, undefined, deps)
@@ -831,13 +903,24 @@ async function finish(home, id, execution_id, reason, deps) {
831
903
  const inbox = answered ? null : await member_api(home, id, 'GET', MEMBER_API.inbox(record.room), undefined, deps).catch(() => null);
832
904
  // Unknown (the other computer not reachable) counts as open, so the failure is reported once it can be.
833
905
  const open = !answered && (!inbox || (inbox.executions || []).some(item => item.id === execution_id));
906
+ // Still open without an answer, and the AI can correct what was refused: it runs again in the same session first.
907
+ if (open && !answered && retry) {
908
+ change_record(home, id, (current, now) => {
909
+ current.running = { execution_id, started_at: now, last_renew: deps.now?.() ?? now };
910
+ remember(current, { execution_id, outcome: 'woken', message_ids: [], note: 'refusal_retry' }, now);
911
+ });
912
+ return retry();
913
+ }
834
914
  const outcome = answered ? 'answered' : open ? 'failed' : 'ended';
835
- const text = reason || t('{member} 会话已结束,但未提交本次回答', { member: record.member });
836
- change_record(home, id, (current, now) => remember(current, { execution_id, outcome,
915
+ // `reason` is one text for both sides, or `{ local, shared }` when what this computer keeps must not leave it.
916
+ const { local = reason, shared = reason } = reason && typeof reason === 'object' ? reason : {};
917
+ const text = local || t('{member} 会话已结束,但未提交本次回答', { member: record.member });
918
+ const output = answered ? '' : run_output(home, id, execution_id);
919
+ change_record(home, id, (current, now) => remember(current, { execution_id, outcome, ...(output ? { output } : {}),
837
920
  ...(answer ? { answer: { id: answer.id, author: String(answer.author || record.member), text: clip(answer.text) } } : {}),
838
- ...(reason ? { reason } : open ? { reason: text, reason_text: { template: '{member} 会话已结束,但未提交本次回答', params: { member: record.member } } } : {}) }, now));
921
+ ...(local ? { reason: local } : open ? { reason: text, reason_text: { template: '{member} 会话已结束,但未提交本次回答', params: { member: record.member } } } : {}) }, now));
839
922
  if (!open) return;
840
- try { await member_api(home, id, 'POST', MEMBER_API.execution(record.room, execution_id), { action: 'fail', reason: text.slice(0, 400) }, deps); }
923
+ try { await member_api(home, id, 'POST', MEMBER_API.execution(record.room, execution_id), { action: 'fail', reason: (shared || text).slice(0, 400) }, deps); }
841
924
  catch (error) { if (error.status !== 409) deps.log?.(t('未能向对方上报执行 #{execution} 的结束:{reason}', { execution: execution_id, reason: error.message })); }
842
925
  }
843
926
 
@@ -879,7 +962,13 @@ export async function poll_record(home, id, deps = {}) {
879
962
  await report_ai(home, record, deps);
880
963
  if (record.running) {
881
964
  if (now - record.running.last_renew < RENEW_MS) return { running: record.running.execution_id };
882
- await member_api(home, id, 'POST', MEMBER_API.execution(record.room, record.running.execution_id), { action: 'renew' }, deps);
965
+ try { await member_api(home, id, 'POST', MEMBER_API.execution(record.room, record.running.execution_id), { action: 'renew' }, deps); }
966
+ catch (error) {
967
+ // 409: the execution is closed there (answered, cancelled, retracted) while the process here never ended.
968
+ if (error.status !== 409) throw error;
969
+ await settle_closed_run(home, id, record.running.execution_id, deps);
970
+ return { running: null, settled: record.running.execution_id };
971
+ }
883
972
  change_record(home, id, current => { if (current.running) current.running.last_renew = now; });
884
973
  return { running: record.running.execution_id, renewed: true };
885
974
  }
@@ -909,15 +998,16 @@ export async function poll_record(home, id, deps = {}) {
909
998
  return { approval: approval.id };
910
999
  }
911
1000
 
912
- /** Pull for every active record in the service until stopped; one record's failure never holds up the others. */
1001
+ /**
1002
+ * Pull for every active record in the service until stopped. Records are pulled side by side, since each pull crosses
1003
+ * the relay several times; one record's failure never holds up the others.
1004
+ */
913
1005
  export function start_external_client(home, { log = () => {}, signal, deps = {} } = {}) {
914
1006
  const loop = async () => {
915
1007
  while (!signal?.aborted) {
916
1008
  const ids = Object.values(read_store(home).records).filter(record => record.status === 'active' || record.leave_pending).map(record => record.id);
917
- for (const id of ids) {
918
- try { await poll_record(home, id, { log, ...deps }); }
919
- catch (error) { if (!error.offline) log(t('被邀请房间 {id} 拉取失败:{reason}', { id, reason: error.message })); }
920
- }
1009
+ await Promise.all(ids.map(id => poll_record(home, id, { log, ...deps })
1010
+ .catch(error => { if (!error.offline) log(t('被邀请房间 {id} 拉取失败:{reason}', { id, reason: error.message })); })));
921
1011
  await new Promise(done => { const timer = setTimeout(done, POLL_MS); signal?.addEventListener('abort', () => { clearTimeout(timer); done(); }, { once: true }); });
922
1012
  }
923
1013
  };
@@ -960,7 +1050,7 @@ export function external_route(room, method, path, body) {
960
1050
  export async function proxy_request(home, request, deps = {}) {
961
1051
  const access = external_access(request.access);
962
1052
  const record = find_record(read_store(home), access.record);
963
- if (record.status !== 'active') return { status: 403, body: { error: t('已退出这个被邀请的房间') } };
1053
+ if (record.status !== 'active') return { status: 403, body: { error: t('已退出这个外部房间') } };
964
1054
  const path = String(request.path || '');
965
1055
  const target = access.room === record.room && !path.includes('..') && ['GET', 'POST'].includes(request.method)
966
1056
  ? external_route(record.room, request.method, path, request.body) : null;
@@ -1033,13 +1123,13 @@ function print_record(record) {
1033
1123
  return lines.join('\n');
1034
1124
  }
1035
1125
 
1036
- const HELP = () => t(`被邀请的房间(本机 AI 作为外部成员参加另一台电脑上的房间)
1126
+ const HELP = () => t(`外部房间(本机 AI 作为外部成员参加另一台电脑上的房间)
1037
1127
 
1038
1128
  用法:
1039
- codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E]
1129
+ codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E] [--session 会话] [--prompt 提示词]
1040
1130
  codiscuss invited list
1041
1131
  codiscuss invited trust ID auto|ask [--unconfined|--confined]
1042
- codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E]
1132
+ codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E] [--prompt 提示词]
1043
1133
  codiscuss invited pause ID | resume ID
1044
1134
  codiscuss invited approve ID 待确认编号 | refuse ID 待确认编号
1045
1135
  codiscuss invited leave ID
@@ -1047,7 +1137,8 @@ const HELP = () => t(`被邀请的房间(本机 AI 作为外部成员参加另
1047
1137
  codiscuss invited room ID
1048
1138
 
1049
1139
  被点名时:auto 直接回答;ask 每次先问你。
1050
- 在这台电脑上:默认只在房间里发言(只能运行共议命令);--unconfined 不受限,可读本机文件、联网。
1140
+ 本机权限:默认只在房间里发言(只能运行共议命令);--unconfined 不受限,可读本机文件、联网。
1141
+ --session 续接这个软件已有的会话(带着原上下文加入);--prompt 只发给它的专属提示词,空字符串表示不用软件预设。
1051
1142
  同意后由本机服务唤醒 AI,请保持 codiscuss 服务运行。加 --json 输出 JSON。
1052
1143
  `);
1053
1144
 
@@ -1066,6 +1157,7 @@ export async function external_main(command, args, { home, deps = {}, write = te
1066
1157
  const service = home || (await import('./discussion_service.mjs')).service_home();
1067
1158
  const { values, positionals } = parseArgs({ args, allowPositionals: true, options: {
1068
1159
  site: { type: 'string' }, machine: { type: 'string' }, adapter: { type: 'string' }, model: { type: 'string' }, effort: { type: 'string' },
1160
+ session: { type: 'string' }, prompt: { type: 'string' },
1069
1161
  label: { type: 'string' }, json: { type: 'boolean' }, help: { type: 'boolean', short: 'h' },
1070
1162
  unconfined: { type: 'boolean' }, confined: { type: 'boolean' },
1071
1163
  'access-file': { type: 'string' }, root: { type: 'string' }, offset: { type: 'string' }, limit: { type: 'string' }, 'max-bytes': { type: 'string' },
@@ -1083,9 +1175,10 @@ export async function external_main(command, args, { home, deps = {}, write = te
1083
1175
  return out(await repo_command(service, op, options, load_access(values['access-file']), deps));
1084
1176
  }
1085
1177
  if (values.help || (command === 'invited' && !positionals.length) || (command === 'join' && !positionals.length)) return write(HELP());
1086
- const ai = { ...(values.adapter ? { adapter: values.adapter } : {}), ...(values.model !== undefined ? { model: values.model } : {}), ...(values.effort !== undefined ? { effort: values.effort } : {}) };
1178
+ const ai = { ...(values.adapter ? { adapter: values.adapter } : {}), ...(values.model !== undefined ? { model: values.model } : {}), ...(values.effort !== undefined ? { effort: values.effort } : {}),
1179
+ ...(values.prompt !== undefined ? { system_prompt: values.prompt } : {}) };
1087
1180
  let result;
1088
- if (command === 'join') result = await join_invite(service, { invite: positionals[0], site: values.site, machine: values.machine, label: values.label, ...ai }, deps);
1181
+ if (command === 'join') result = await join_invite(service, { invite: positionals[0], site: values.site, machine: values.machine, label: values.label, ...(values.session ? { session_id: values.session } : {}), ...ai }, deps);
1089
1182
  else {
1090
1183
  const [verb, id, extra] = positionals;
1091
1184
  const action = { list: 'invited-list', trust: 'invited-trust', ai: 'invited-ai', pause: 'invited-pause', resume: 'invited-pause', approve: 'invited-approve',
@@ -1099,7 +1192,7 @@ export async function external_main(command, args, { home, deps = {}, write = te
1099
1192
  result = await invited_command(service, action, input, deps);
1100
1193
  }
1101
1194
  if (values.json) return out(result);
1102
- if (result.records) return write(`${result.records.length ? result.records.map(print_record).join('\n') : t('还没有被邀请的房间')}\n`);
1195
+ if (result.records) return write(`${result.records.length ? result.records.map(print_record).join('\n') : t('还没有外部房间')}\n`);
1103
1196
  if (result.removed) return write(`${t('已删除这条被邀请记录')}\n`);
1104
1197
  return write(`${print_record(result.record)}${result.record?.leave_pending ? `\n${t('暂时连不上对方电脑,常驻服务会继续通知它;通知送达或成员资格到期后删除本机密钥')}` : ''}${result.error ? `\n${t('读不到对方房间:{reason}', { reason: result.error })}` : ''}\n`);
1105
1198
  }
@@ -7,7 +7,7 @@ import { adapter_of, BRANCHABLE_ADAPTERS, branch_session, capabilities_of, clean
7
7
  import { api as raw_api, overlapping_directories, read_rule } from './discussion_runner.mjs';
8
8
  import { SegmentLog } from './execution_progress.mjs';
9
9
  import { capture_base, file_diffs } from './file_diff.mjs';
10
- import { free_task_text, TASK_SUBCOMMANDS, with_expert_prompt } from './expert_prompts.mjs';
10
+ import { correctable_refusals, free_task_text, MAX_REFUSAL_RETRIES, refusal_retry_prompt, TASK_SUBCOMMANDS, with_expert_prompt } from './expert_prompts.mjs';
11
11
  import { entry_access, site_fetch } from './entry_client.mjs';
12
12
  import { atomic_json } from './files.mjs';
13
13
  import { image_settings } from './image_service.mjs';
@@ -515,6 +515,10 @@ export class FreeRoomRunner {
515
515
  this.replies = new Map();
516
516
  // Executions whose software reported refused operations; their last remark is not captured.
517
517
  this.denied = new Set();
518
+ // Execution id -> its last turn's refusals the member can correct (`correctable_refusals`), and per execution how
519
+ // often it was resumed with them and every such refusal so far; past MAX_REFUSAL_RETRIES it fails as before.
520
+ this.refusal_hints = new Map();
521
+ this.refusal_retries = new Map();
518
522
  // Per execution, which delivery is current: a turn stopped by a pause may report its exit after the resumed one began.
519
523
  this.generations = new Map();
520
524
  // Executions whose software failed before any turn ran, as its adapter reported; safe to deliver again.
@@ -1163,6 +1167,9 @@ export class FreeRoomRunner {
1163
1167
  if (denials?.length && current()) {
1164
1168
  this.denied.add(live());
1165
1169
  this.store.db.prepare('INSERT OR REPLACE INTO metadata VALUES (?,?)').run(`recovery-denied:${live()}`, '1');
1170
+ // What the adapter says the member can correct itself; the turn's end resumes it with these.
1171
+ const refusals = correctable_refusals(denials);
1172
+ if (refusals.length) this.refusal_hints.set(live(), refusals);
1166
1173
  }
1167
1174
  api(this.config, `/executions/${live()}`, { action: 'denials', denials }).catch(() => {});
1168
1175
  },
@@ -1315,6 +1322,20 @@ export class FreeRoomRunner {
1315
1322
  if (this.exited.has(execution.id)) {
1316
1323
  const latest = await api(this.config, `/executions/${execution.id}`);
1317
1324
  const denial = this.exited.get(execution.id);
1325
+ const refusals = this.refusal_hints.get(execution.id);
1326
+ this.refusal_hints.delete(execution.id);
1327
+ const tried = this.refusal_retries.get(execution.id) || { attempts: 0, refusals: [] };
1328
+ // A command refused for something the member can correct (shell symbols in an inline answer): resume the same
1329
+ // session with what to change, up to MAX_REFUSAL_RETRIES times, rather than fail a turn whose answer was nearly sent.
1330
+ if (['dispatched', 'started'].includes(latest.status) && refusals && tried.attempts < MAX_REFUSAL_RETRIES) {
1331
+ const next = { attempts: tried.attempts + 1, refusals: [...tried.refusals, ...refusals] };
1332
+ this.refusal_retries.set(execution.id, next);
1333
+ this.exited.delete(execution.id);
1334
+ this.replies.delete(execution.id);
1335
+ this.denied.delete(execution.id);
1336
+ this.save(member.name, { status: 'delivering', error: '' });
1337
+ return this.invoke(member, latest, { resume: refusal_retry_prompt(execution.id, next.refusals, next.attempts) });
1338
+ }
1318
1339
  // Program notices alone (failure reminder, timed check) need no reply: with nothing to handle the turn just ends.
1319
1340
  if (['dispatched', 'started'].includes(latest.status) && !denial && latest.requests?.length
1320
1341
  && latest.requests.every(item => item.purpose === 'notice')) return this.end_quiet(member.name, execution.id);
@@ -1349,7 +1370,7 @@ export class FreeRoomRunner {
1349
1370
  */
1350
1371
  async carry_on(name, old, id) {
1351
1372
  this.continued.set(old, id);
1352
- for (const map of [this.generations, this.steers, this.activity, this.replies, this.exited, this.execution_processes]) {
1373
+ for (const map of [this.generations, this.steers, this.activity, this.replies, this.exited, this.execution_processes, this.refusal_hints, this.refusal_retries]) {
1353
1374
  if (map.has(old)) { map.set(id, map.get(old)); map.delete(old); }
1354
1375
  }
1355
1376
  for (const set of [this.denied, this.not_started, this.not_retryable, this.turn_ended]) if (set.delete(old)) set.add(id);
@@ -6,7 +6,7 @@ export default {
6
6
  "连不上 {host}:连接被断开({reason}),请检查这台电脑的网络或代理后重试": "Cannot connect to {host}: the connection was closed ({reason}). Check this computer's network or proxy and try again",
7
7
  "实例启动失败(退出码 {code})": "Instance failed to start (exit code {code})",
8
8
  "实例停止失败(退出码 {code})": "Instance failed to stop (exit code {code})",
9
- "AI CoDiscuss CLI\n\n用法:codiscuss [命令] [选项]\n\n (无命令) 在当前终端启动服务,Ctrl+C 停止\n install / setup 安装持久命令并配置 / 配置已有安装\n local COMMAND 管理本机网站,或 connect 连接线上站点\n token 生成线上网站的一次性管理员注册令牌\n panel [open|start|stop] 打开本机管理面板(托管用户、命令行登录、API 密钥)\n admin COMMAND 以命令行完成管理面板的全部操作(启动、退出、更新、托管账号等)\n launcher 生成“共议.exe”与桌面、开始菜单快捷方式,双击即可启动(Windows)\n service COMMAND 启动、停止、查询服务,或登记房间\n launch COMMAND 保存启动配置,或从 AI 对话启动讨论\n room COMMAND 创建、读取或更新讨论房间\n message COMMAND 检索原文、提交观点\n attachment COMMAND 上传、查询与下载讨论附件\n turn COMMAND 安排发言、读取待办与回答\n state COMMAND 读取或保存共享状态\n run COMMAND 配置、启动或暂停网站上的讨论\n execution COMMAND 进入或查询一次 AI 执行\n health 检查网站健康状态\n schema [COMMAND] 离线查看命令与参数\n api PATH 访问尚未封装的网站接口\n join LINK|CODE 用本机 AI 加入另一台电脑上的房间(外部成员)\n invited COMMAND 查看被邀请的房间,调整信任等级、同意或拒绝唤醒、退出\n repo COMMAND 外部成员只读查看对方电脑开放的项目\n\n codiscuss service --help\n codiscuss room --help\n codiscuss health --site http://127.0.0.1:8765\n\n网站操作使用 --site、DISCUSS_URL 或 --access-file 中的站点,并需要 Python 3.10+。\n原有 start、status、stop、add 等服务命令继续兼容。\n": "AI CoDiscuss CLI\n\nUsage: codiscuss [command] [options]\n\n (no command) Run the service in this terminal; Ctrl+C to stop\n install / setup Install the persistent command and configure / configure an existing installation\n local COMMAND Manage the local site, or connect to an online site\n token Generate a single-use admin registration token for an online site\n panel [open|start|stop] Open the local admin panel (hosting, CLI sign-ins, API keys)\n admin COMMAND Manage everything in the admin panel from the command line\n launcher Create “共议.exe” and desktop / Start menu shortcuts (Windows)\n service COMMAND Start, stop or inspect the service, or register a room\n launch COMMAND Save launch settings or start a discussion from an AI chat\n room COMMAND Create, read or update rooms\n message COMMAND Read original messages or submit a reply\n attachment COMMAND Upload, inspect or download room attachments\n turn COMMAND Schedule turns, read pending work and answer\n state COMMAND Read or save shared state\n run COMMAND Configure, start or pause discussions on the site\n execution COMMAND Enter or inspect an AI run\n health Check site health\n schema [COMMAND] View commands and arguments offline\n api PATH Access site endpoints without a dedicated command\n join LINK|CODE Join a room on another computer with this computer's AI (external member)\n invited COMMAND List invited rooms, set trust levels, approve or refuse wake-ups, leave\n repo COMMAND Read the project another computer opened to you (external members)\n\n codiscuss service --help\n codiscuss room --help\n codiscuss health --site http://127.0.0.1:8765\n\nSite commands use --site, DISCUSS_URL or the site in --access-file, and require Python 3.10+.\nLegacy service commands such as start, status, stop and add remain supported.\n",
9
+ "AI CoDiscuss CLI\n\n用法:codiscuss [命令] [选项]\n\n (无命令) 在当前终端启动服务,Ctrl+C 停止\n install / setup 安装持久命令并配置 / 配置已有安装\n local COMMAND 管理本机网站,或 connect 连接线上站点\n token 生成线上网站的一次性管理员注册令牌\n panel [open|start|stop] 打开本机管理面板(托管用户、命令行登录、API 密钥)\n admin COMMAND 以命令行完成管理面板的全部操作(启动、退出、更新、托管账号等)\n launcher 生成“共议.exe”与桌面、开始菜单快捷方式,双击即可启动(Windows)\n service COMMAND 启动、停止、查询服务,或登记房间\n launch COMMAND 保存启动配置,或从 AI 对话启动讨论\n room COMMAND 创建、读取或更新讨论房间\n message COMMAND 检索原文、提交观点\n attachment COMMAND 上传、查询与下载讨论附件\n turn COMMAND 安排发言、读取待办与回答\n state COMMAND 读取或保存共享状态\n run COMMAND 配置、启动或暂停网站上的讨论\n execution COMMAND 进入或查询一次 AI 执行\n health 检查网站健康状态\n schema [COMMAND] 离线查看命令与参数\n api PATH 访问尚未封装的网站接口\n join LINK|CODE 用本机 AI 加入另一台电脑上的房间(外部成员)\n invited COMMAND 查看外部房间,调整信任等级、同意或拒绝唤醒、退出\n repo COMMAND 外部成员只读查看对方电脑开放的项目\n\n codiscuss service --help\n codiscuss room --help\n codiscuss health --site http://127.0.0.1:8765\n\n网站操作使用 --site、DISCUSS_URL 或 --access-file 中的站点,并需要 Python 3.10+。\n原有 start、status、stop、add 等服务命令继续兼容。\n": "AI CoDiscuss CLI\n\nUsage: codiscuss [command] [options]\n\n (no command) Run the service in this terminal; Ctrl+C to stop\n install / setup Install the persistent command and configure / configure an existing installation\n local COMMAND Manage the local site, or connect to an online site\n token Generate a single-use admin registration token for an online site\n panel [open|start|stop] Open the local admin panel (hosting, CLI sign-ins, API keys)\n admin COMMAND Manage everything in the admin panel from the command line\n launcher Create “共议.exe” and desktop / Start menu shortcuts (Windows)\n service COMMAND Start, stop or inspect the service, or register a room\n launch COMMAND Save launch settings or start a discussion from an AI chat\n room COMMAND Create, read or update rooms\n message COMMAND Read original messages or submit a reply\n attachment COMMAND Upload, inspect or download room attachments\n turn COMMAND Schedule turns, read pending work and answer\n state COMMAND Read or save shared state\n run COMMAND Configure, start or pause discussions on the site\n execution COMMAND Enter or inspect an AI run\n health Check site health\n schema [COMMAND] View commands and arguments offline\n api PATH Access site endpoints without a dedicated command\n join LINK|CODE Join a room on another computer with this computer's AI (external member)\n invited COMMAND List external rooms, set trust levels, approve or refuse wake-ups, leave\n repo COMMAND Read the project another computer opened to you (external members)\n\n codiscuss service --help\n codiscuss room --help\n codiscuss health --site http://127.0.0.1:8765\n\nSite commands use --site, DISCUSS_URL or the site in --access-file, and require Python 3.10+.\nLegacy service commands such as start, status, stop and add remain supported.\n",
10
10
  "AI CoDiscuss 讨论服务\n\n用法:codiscuss service [命令] [选项]\n\n (无命令) / run 在当前终端运行,Ctrl+C 停止\n start 在后台启动,已运行时复用\n status 查看服务与房间状态\n stop 暂停托管中的讨论并停止服务\n add --config FILE 登记房间的私有接入配置\n remove --config FILE 移除已登记配置\n list 列出已登记配置\n clean 立即清理无房间使用的启动目录、草稿与超长日志(服务每 6 小时自动清理一次)\n open 后台启动并打开讨论网站\n shortcut 创建 Windows 桌面快捷方式\n autostart on|off 开启或关闭 Windows 登录自启\n\n --json 以 JSON 输出命令结果(前台运行除外)\n -h, --help 显示帮助\n\n登记或启动服务不会自动开始讨论,仍需在网页明确启动。\n": "AI CoDiscuss discussion service\n\nUsage: codiscuss service [command] [options]\n\n (no command) / run Run in this terminal; Ctrl+C to stop\n start Start in the background; reuse if already running\n status Show service and room status\n stop Pause managed discussions and stop the service\n add --config FILE Register a room's private connection configuration\n remove --config FILE Remove a registered configuration\n list List registered configurations\n clean Remove unused launch folders, drafts and oversized logs now (also runs every 6 hours)\n open Start in the background and open the discussion site\n shortcut Create a Windows desktop shortcut\n autostart on|off Enable or disable starting at Windows sign-in\n\n --json Output command results as JSON (except foreground runs)\n -h, --help Show help\n\nRegistering or starting the service does not start a discussion; start it explicitly on the site.\n",
11
11
  "运行中": "running",
12
12
  "已暂停": "paused",
@@ -443,7 +443,7 @@ export default {
443
443
  "被邀请房间 {id} 拉取失败:{reason}": "Pulling invited room {id} failed: {reason}",
444
444
  "被邀请房间拉取停止:{reason}": "Pulling invited rooms stopped: {reason}",
445
445
  "只有经另一台电脑加入的成员才能这样访问;请用任务给出的 --access-file": "Only a member that joined from another computer can access this; use the --access-file the task gives",
446
- "已退出这个被邀请的房间": "You have left this invited room",
446
+ "已退出这个外部房间": "You have left this external room",
447
447
  "这个房间还在进行中,请先退出再删除记录": "This room is still active. Leave it before deleting the record",
448
448
  "退出通知还没送达对方电脑,送达后才能删除记录": "The other computer hasn't received your leave notice yet. You can delete the record once it arrives",
449
449
  "已删除这条被邀请记录": "Deleted this invited room record",
@@ -465,7 +465,7 @@ export default {
465
465
  ";已暂停": "; paused",
466
466
  " 待确认 {approval}:消息 {messages}": " Pending {approval}: messages {messages}",
467
467
  " 已退出": " Left",
468
- "还没有被邀请的房间": "No invited rooms yet",
468
+ "还没有外部房间": "No external rooms yet",
469
469
  "暂时连不上对方电脑,常驻服务会继续通知它;通知送达或成员资格到期后删除本机密钥": "The other computer cannot be reached right now. The background service will keep telling it, and deletes the key here once it hears or the membership expires",
470
470
  "读不到对方房间:{reason}": "Cannot read the other room: {reason}",
471
471
  "该文件属于固定排除的敏感文件,不能读取": "This file is a fixed-excluded sensitive file and cannot be read",
@@ -521,9 +521,11 @@ export default {
521
521
  "对方站点连着多台电脑,请用 --machine 指定电脑编号:{ids}": "The other site has several computers; choose one with --machine: {ids}",
522
522
  "该软件不能收窄到只用 codiscuss 命令,只能在“信任设备”等级下服务:{reason}": "This software cannot be restricted to codiscuss commands only, so it can serve only at the Trusted device level: {reason}",
523
523
  "{member} 会话已结束,但未提交本次回答": "{member}'s session ended without submitting an answer for this run",
524
+ "{member} {denial},未提交本次回答": "{member}: {denial}; no answer was submitted for this run",
525
+ "{member} 的操作被本机权限规则拒绝,未提交本次回答": "An operation of {member} was refused by this computer's permission rules; no answer was submitted for this run",
524
526
  "外部成员只能读本房间消息与概况、提交自己的回答": "An external member can only read this room's messages and overview and submit its own answer",
525
527
  " 对方已结束你的成员资格({reason})": " The other side ended your membership ({reason})",
526
- "被邀请的房间(本机 AI 作为外部成员参加另一台电脑上的房间)\r\n\r\n用法:\r\n codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E]\r\n codiscuss invited list\r\n codiscuss invited trust ID auto|ask [--unconfined|--confined]\r\n codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E]\r\n codiscuss invited pause ID | resume ID\r\n codiscuss invited approve ID 待确认编号 | refuse ID 待确认编号\r\n codiscuss invited leave ID\r\n codiscuss invited remove ID\r\n codiscuss invited room ID\r\n\r\n被点名时:auto 直接回答;ask 每次先问你。\r\n在这台电脑上:默认只在房间里发言(只能运行共议命令);--unconfined 不受限,可读本机文件、联网。\r\n同意后由本机服务唤醒 AI,请保持 codiscuss 服务运行。加 --json 输出 JSON。\r\n": "Invited rooms (this computer's AI joins a room on another computer as an external member)\n\nUsage:\n codiscuss join <link|pairing code> [--site SITE] [--machine COMPUTER_ID] --adapter SOFTWARE [--model M] [--effort E]\n codiscuss invited list\n codiscuss invited trust ID auto|ask [--unconfined|--confined]\n codiscuss invited ai ID [--adapter SOFTWARE] [--model M] [--effort E]\n codiscuss invited pause ID | resume ID\n codiscuss invited approve ID APPROVAL_ID | refuse ID APPROVAL_ID\n codiscuss invited leave ID\n codiscuss invited remove ID\n codiscuss invited room ID\n\nWhen named: auto answers at once; ask asks you each time.\nOn this computer: by default it only speaks in the room (codiscuss commands only); --unconfined lifts that, so it can read local files and use the network.\nThe local service wakes the AI after you approve; keep the codiscuss service running. Add --json for JSON output.\n",
528
+ "外部房间(本机 AI 作为外部成员参加另一台电脑上的房间)\n\n用法:\n codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E] [--session 会话] [--prompt 提示词]\n codiscuss invited list\n codiscuss invited trust ID auto|ask [--unconfined|--confined]\n codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E] [--prompt 提示词]\n codiscuss invited pause ID | resume ID\n codiscuss invited approve ID 待确认编号 | refuse ID 待确认编号\n codiscuss invited leave ID\n codiscuss invited remove ID\n codiscuss invited room ID\n\n被点名时:auto 直接回答;ask 每次先问你。\n本机权限:默认只在房间里发言(只能运行共议命令);--unconfined 不受限,可读本机文件、联网。\n--session 续接这个软件已有的会话(带着原上下文加入);--prompt 只发给它的专属提示词,空字符串表示不用软件预设。\n同意后由本机服务唤醒 AI,请保持 codiscuss 服务运行。加 --json 输出 JSON。\n": "External rooms (this computer's AI joins a room on another computer as an external member)\n\nUsage:\n codiscuss join <link|pairing code> [--site SITE] [--machine COMPUTER_ID] --adapter SOFTWARE [--model M] [--effort E] [--session SESSION] [--prompt PROMPT]\n codiscuss invited list\n codiscuss invited trust ID auto|ask [--unconfined|--confined]\n codiscuss invited ai ID [--adapter SOFTWARE] [--model M] [--effort E] [--prompt PROMPT]\n codiscuss invited pause ID | resume ID\n codiscuss invited approve ID APPROVAL_ID | refuse ID APPROVAL_ID\n codiscuss invited leave ID\n codiscuss invited remove ID\n codiscuss invited room ID\n\nWhen named: auto answers at once; ask asks you each time.\nLocal access: by default it only speaks in the room (codiscuss commands only); --unconfined lifts that, so it can read local files and use the network.\n--session resumes a conversation this software already holds (joining with its context); --prompt sets the prompt sent only to it, and an empty string means no software preset.\nThe local service wakes the AI after you approve; keep the codiscuss service running. Add --json for JSON output.\n",
527
529
  "只读查看对方电脑开放的项目(仅外部成员的任务中可用)\n\n用法:\n codiscuss repo ls 列出开放目录(序号即 --root)\n codiscuss repo ls [目录] --root N [--offset N] [--limit N]\n codiscuss repo read 文件 --root N [--offset N] [--max-bytes N]\n codiscuss repo grep 关键词 --root N [--path 路径] [--case-sensitive] [--max-results N]\n凭据取自 --access-file 或 DISCUSS_ACCESS_FILE。\n": "Read the project another computer opened to you (only in an external member's task)\n\nUsage:\n codiscuss repo ls List the opened directories (their numbers are --root)\n codiscuss repo ls [DIRECTORY] --root N [--offset N] [--limit N]\n codiscuss repo read FILE --root N [--offset N] [--max-bytes N]\n codiscuss repo grep KEYWORD --root N [--path PATH] [--case-sensitive] [--max-results N]\nCredentials come from --access-file or DISCUSS_ACCESS_FILE.\n",
528
530
  "本次运行已收窄,不能使用 launch image(它会读取本机文件)": "This run is restricted and cannot use launch image (it reads local files)",
529
531
  "本次运行已收窄,不能从标准输入读取;请先把内容写进草稿目录,再用文件参数传入": "This run is restricted and cannot read standard input; write the content in the draft folder and pass its path",