ai_co_discuss 0.6.1 → 0.6.2

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.
Files changed (92) hide show
  1. package/.agents/skills/discuss-host/references/experience.md +4 -9
  2. package/.agents/skills/screen-acceptance/SKILL.md +9 -7
  3. package/.agents/steward-skills/dispatch-analysis/SKILL.md +10 -3
  4. package/backend/server.py +31 -8
  5. package/docs/en/guide/admin.md +3 -3
  6. package/docs/en/guide/members.md +7 -5
  7. package/docs/en/guide/rooms.md +1 -1
  8. package/docs/en/guide/steward.md +1 -1
  9. package/docs/en/guide/working.md +2 -1
  10. package/docs/guide/admin.md +3 -3
  11. package/docs/guide/members.md +7 -5
  12. package/docs/guide/rooms.md +1 -1
  13. package/docs/guide/steward.md +1 -1
  14. package/docs/guide/working.md +2 -1
  15. package/frontend/locales/en/admin.json +15 -5
  16. package/frontend/locales/en/backend.json +1 -1
  17. package/frontend/locales/en/discussion.json +1 -0
  18. package/frontend/locales/en/room.json +4 -0
  19. package/frontend/locales/en/settings.json +33 -0
  20. package/package.json +1 -1
  21. package/runner/adapters/api.mjs +5 -3
  22. package/runner/discuss.py +3 -1
  23. package/runner/discussion_launch.mjs +79 -11
  24. package/runner/free_runner.mjs +12 -8
  25. package/runner/host_experience.mjs +267 -47
  26. package/runner/i18n_en.mjs +17 -4
  27. package/runner/steward.mjs +4 -3
  28. package/runner/wakeup_text.mjs +20 -0
  29. package/web/admin.css +1 -1
  30. package/web/admin.js +8 -8
  31. package/web/app.js +8 -5
  32. package/web/guest.js +1 -1
  33. package/web/i18n.js +3 -3
  34. package/web/modern.css +1 -1
  35. package/web/modern.js +83 -83
  36. package/workflows/human-writing/SKILL.md +68 -0
  37. package/workflows/human-writing/experts/writer/skills/human-writing/LICENSE +21 -0
  38. package/workflows/human-writing/experts/writer/skills/human-writing/SKILL.md +167 -0
  39. package/workflows/human-writing/experts/writer/skills/human-writing/VERSION +1 -0
  40. package/workflows/human-writing/experts/writer/skills/human-writing/agents/openai.yaml +4 -0
  41. package/workflows/human-writing/experts/writer/skills/human-writing/dist/human-writing-lite.md +25 -0
  42. package/workflows/human-writing/experts/writer/skills/human-writing/references/fiction.md +119 -0
  43. package/workflows/human-writing/experts/writer/skills/human-writing/references/formats.md +99 -0
  44. package/workflows/human-writing/experts/writer/skills/human-writing/references/forum-prose.md +349 -0
  45. package/workflows/human-writing/experts/writer/skills/human-writing/references/reality.md +119 -0
  46. package/workflows/human-writing/experts/writer/skills/human-writing/references/revision.md +206 -0
  47. package/workflows/human-writing/experts/writer/skills/human-writing/scripts/check_prose.py +731 -0
  48. package/workflows/human-writing/experts/writer/writer.md +33 -0
  49. package/workflows/human-writing/flow.json +156 -0
  50. package/workflows/story-serial/SKILL.md +2 -0
  51. package/workflows/story-serial/workflows/aigc-reduce/flow.json +27 -27
  52. package/workflows/story-serial/workflows/character-play/SKILL.md +1 -1
  53. package/workflows/story-serial/workflows/character-play/flow.json +35 -35
  54. package/workflows/story-serial/workflows/jack-sparrow/flow.json +15 -15
  55. package/workflows/story-serial/workflows/luke-nichols/flow.json +15 -15
  56. package/workflows/story-serial/workflows/revise-episodes/flow.json +27 -27
  57. package/workflows/story-serial/workflows/story-illust/SKILL.md +124 -0
  58. package/workflows/story-serial/workflows/story-illust/experts/illust_writer.md +25 -0
  59. package/workflows/story-serial/workflows/story-illust/experts/rev_codex.md +18 -0
  60. package/workflows/story-serial/workflows/story-illust/experts/rev_cont.md +27 -0
  61. package/workflows/story-serial/workflows/story-illust/experts/rev_gemini.md +20 -0
  62. package/workflows/story-serial/workflows/story-illust/flow.json +917 -0
  63. package/workflows/story-serial/workflows/story-illust/references//347/224/237/345/233/276/346/226/271/346/263/225.md +72 -0
  64. package/workflows/story-serial/workflows/story-illust/scripts/batch_check.py +338 -0
  65. package/workflows/story-serial/workflows/story-illust/scripts/book.py +105 -0
  66. package/workflows/story-serial/workflows/story-illust/scripts/check.py +463 -0
  67. package/workflows/story-serial/workflows/story-illust/scripts/contact.py +599 -0
  68. package/workflows/story-serial/workflows/story-illust/scripts/md_tables.py +298 -0
  69. package/workflows/story-serial/workflows/story-illust/scripts/room_verify.py +546 -0
  70. package/workflows/story-serial/workflows/story-illust/scripts/sheet.py +210 -0
  71. package/workflows/story-serial/workflows/story-illust/templates//346/211/271/346/254/241/345/267/245/344/275/234/345/215/225.md +86 -0
  72. package/workflows/story-serial/workflows/story-illust/templates//350/247/206/350/247/211/350/256/276/345/256/232/350/241/250.md +142 -0
  73. package/workflows/story-serial/workflows/tidy-docs/flow.json +39 -39
  74. /package/workflows/story-serial/{agents → experts}/critic.md +0 -0
  75. /package/workflows/story-serial/{agents → experts}/critic_people.md +0 -0
  76. /package/workflows/story-serial/{agents → experts}/reader.md +0 -0
  77. /package/workflows/story-serial/{agents → experts}/recorder.md +0 -0
  78. /package/workflows/story-serial/{agents → experts}/screenwriter.md +0 -0
  79. /package/workflows/story-serial/{agents → experts}/writer.md +0 -0
  80. /package/workflows/story-serial/workflows/character-play/{agents → experts}/character.md +0 -0
  81. /package/workflows/story-serial/workflows/jack-sparrow/{agents → experts}/jack_sparrow/jack_sparrow.md +0 -0
  82. /package/workflows/story-serial/workflows/jack-sparrow/{agents → experts}/jack_sparrow/skills/coastal-sailing/SKILL.md +0 -0
  83. /package/workflows/story-serial/workflows/jack-sparrow/{agents → experts}/jack_sparrow/skills/coastal-sailing/references/catamaran-and-crew.md +0 -0
  84. /package/workflows/story-serial/workflows/jack-sparrow/{agents → experts}/jack_sparrow/skills/coastal-sailing/references/emergency-and-navigation.md +0 -0
  85. /package/workflows/story-serial/workflows/jack-sparrow/{agents → experts}/jack_sparrow/skills/coastal-sailing/references/resources-and-systems.md +0 -0
  86. /package/workflows/story-serial/workflows/jack-sparrow/{agents → experts}/jack_sparrow/skills/coastal-sailing/references/weather-and-anchoring.md +0 -0
  87. /package/workflows/story-serial/workflows/luke-nichols/{agents → experts}/luke_nichols/luke_nichols.md +0 -0
  88. /package/workflows/story-serial/workflows/luke-nichols/{agents → experts}/luke_nichols/skills/cold-survival/SKILL.md +0 -0
  89. /package/workflows/story-serial/workflows/luke-nichols/{agents → experts}/luke_nichols/skills/cold-survival/references/fire-and-fuel.md +0 -0
  90. /package/workflows/story-serial/workflows/luke-nichols/{agents → experts}/luke_nichols/skills/cold-survival/references/luke-videos.md +0 -0
  91. /package/workflows/story-serial/workflows/luke-nichols/{agents → experts}/luke_nichols/skills/cold-survival/references/shelter-and-warmth.md +0 -0
  92. /package/workflows/story-serial/workflows/luke-nichols/{agents → experts}/luke_nichols/skills/cold-survival/references/travel-and-ice.md +0 -0
package/runner/discuss.py CHANGED
@@ -2284,7 +2284,9 @@ def text_output(value):
2284
2284
  if isinstance(item, (dict, list)):
2285
2285
  lines.append(f"{key}:\n{text_output(item)}")
2286
2286
  else:
2287
- lines.append(f"{key}: {item if item is not None else '—'}")
2287
+ # Indent continuation lines so a multi-line body stays visibly part of its field.
2288
+ rendered = str(item if item is not None else '—').replace("\n", "\n ")
2289
+ lines.append(f"{key}: {rendered}")
2288
2290
  return "\n".join(lines)
2289
2291
  if isinstance(value, list):
2290
2292
  return "\n\n".join(text_output(item) for item in value) or "(空)"
@@ -15,6 +15,7 @@ import { parseArgs } from 'node:util';
15
15
  import { account_projects, account_space, create_or_restore_account_project, draft_folder, hide_account_projects, listed_account_projects } from './account_space.mjs';
16
16
  import { request_share_job, sharing_available } from './share_service.mjs';
17
17
  import { atomic_json } from './files.mjs';
18
+ import { read_wakeup_text } from './wakeup_text.mjs';
18
19
  import { MODEL_CACHE_MS, model_catalog_key, model_catalog_reader, unknown_model } from './model_catalog.mjs';
19
20
  export { unknown_model } from './model_catalog.mjs';
20
21
  import { builtin_room_templates, default_room_template, read_room_templates, room_templates_command } from './room_templates.mjs';
@@ -41,7 +42,7 @@ import { stt_part } from './stt.mjs';
41
42
  import { image_check, image_settings, MODEL_ID, room_image, save_image_settings, validate_image_limits } from './image_service.mjs';
42
43
  import { open_project } from './adapters/api_files.mjs';
43
44
  import { redact_media_text, run_image_tool } from './adapters/api_images.mjs';
44
- import { active_suggestions, change_experience, experiences, legacy_text, replace_legacy } from './host_experience.mjs';
45
+ import { active_suggestions, admission_view, change_managed_experience, experiences, legacy_text, queue_legacy_experience } from './host_experience.mjs';
45
46
  import { access_levels, BUILTIN_EXPERT_PRESETS, BUILTIN_HOST_STRATEGIES, CODEX_IMAGE_PRESET, MAX_EXPERT_PROMPT, PROJECT_ACCESS } from './expert_prompts.mjs';
46
47
  import { acquire_lock, api, check_extra_directories, DiscussionStore, overlapping_directories, room_media_fields, service_drafts, validate_config } from './discussion_runner.mjs';
47
48
  import { room_video, save_video_settings, validate_video_limits, video_check, video_settings } from './video_service.mjs';
@@ -222,6 +223,8 @@ const help_text = () => `用法:codiscuss launch settings [--file FILE]
222
223
  codiscuss launch experience list|add|edit|remove|enable|disable|accept|reject|dismiss|go|refine [--id ID] [--file JSON]
223
224
  codiscuss launch experience-propose --message ID --file JSON
224
225
  codiscuss launch experience review on|off [--at HH:MM]
226
+ ${t('所有经验均为全局。添加或编辑时,JSON 文件填 text。')}
227
+ codiscuss launch experience confirm|resolve|direct-enable|retry|revoke-source|distill --id ID [--file JSON]
225
228
  codiscuss launch experience-moss --file JSON
226
229
  codiscuss launch prompts [list [--builtin] | get program|host|平台 | set program|host|平台 --file FILE]
227
230
  codiscuss launch machine-link --file FILE
@@ -1346,13 +1349,17 @@ const DETAIL_LOG_TAIL_BYTES = 4 * 1024 * 1024;
1346
1349
  * `available: false` when the execution kept no such log (an App or manual member, or an API member).
1347
1350
  */
1348
1351
  export async function execution_details_command(home, raw, { trust = false } = {}) {
1349
- const { input, config } = await member_room_context(home, raw, { trust });
1352
+ const wakeup_text = raw?.wakeup_text === true;
1353
+ const { input, config, path } = await member_room_context(home, wakeup_text ? { ...raw, _moss_owner: false } : raw,
1354
+ { trust: trust && !wakeup_text });
1350
1355
  // A private chat turn (`chat_id`) keeps its log the same way as an execution.
1351
1356
  const chat = input.chat_id !== undefined;
1352
1357
  const execution_id = Number(chat ? input.chat_id : input.execution_id);
1353
1358
  if (!Number.isSafeInteger(execution_id) || execution_id <= 0) throw new Error(chat ? '私聊编号无效' : '执行编号无效');
1354
- const suffix = `-${chat ? 'chat' : 'free'}-${execution_id}.log`;
1355
- const directory = config.directory;
1359
+ const turn = `${chat ? 'chat' : 'free'}-${execution_id}`;
1360
+ const directory = resolve(config.data_directory || join(dirname(path), `discussion-${input.room_id}`));
1361
+ if (wakeup_text) return { wakeup_text: read_wakeup_text(directory, turn) };
1362
+ const suffix = `-${turn}.log`;
1356
1363
  const log = () => {
1357
1364
  const name = existsSync(directory) ? readdirSync(directory).find(file => file.endsWith(suffix)) : undefined;
1358
1365
  const info = name && statSync(join(directory, name), { throwIfNoEntry: false });
@@ -1363,7 +1370,7 @@ export async function execution_details_command(home, raw, { trust = false } = {
1363
1370
  }
1364
1371
  const { name, revision } = log();
1365
1372
  if (input.wait === true && revision === input.revision) return { revision, unchanged: true };
1366
- const parsed = name ? execution_details(name.slice(0, -suffix.length), read_log_tail(join(config.directory, name))) : null;
1373
+ const parsed = name ? execution_details(name.slice(0, -suffix.length), read_log_tail(join(directory, name))) : null;
1367
1374
  return { room_id: input.room_id, [chat ? 'chat_id' : 'execution_id']: execution_id, available: Boolean(parsed), revision, ...parsed };
1368
1375
  }
1369
1376
 
@@ -1505,7 +1512,8 @@ function experience_view(home, state) {
1505
1512
  usage = db.prepare('SELECT experience_id, count(*) AS uses,max(m.created_at) AS last_used_at,count(w.redirect_message_id) AS redirects FROM message_host_experience e JOIN messages m ON m.id=e.message_id LEFT JOIN dispatch_withdrawals w ON m.id=w.message_id GROUP BY experience_id').all();
1506
1513
  } finally { db.close(); }
1507
1514
  }
1508
- return { revision: state.revision || 0, entries: state.entries.map(item => ({ ...item, ...usage.find(row => row.experience_id === item.id) })), suggestions: active_suggestions(state), reviews: state.reviews || [], history: state.history || [], seen_reviews: state.seen_reviews || [], review: experience_review_status(home) };
1515
+ const review = experience_review_status(home);
1516
+ return { revision: state.revision || 0, ...admission_view(state, review.configured), entries: state.entries.map(item => ({ ...item, scope: 'global', ...usage.find(row => row.experience_id === item.id) })), suggestions: active_suggestions(state).map(item => ({ ...item, scope: 'global' })), reviews: state.reviews || [], history: state.history || [], seen_reviews: state.seen_reviews || [], review };
1509
1517
  }
1510
1518
 
1511
1519
  function has_expired_experience(state) { return active_suggestions(state).length !== state.suggestions.length; }
@@ -1524,6 +1532,7 @@ function account_experiences(home, input) {
1524
1532
  */
1525
1533
  export async function start_intent(home, id) {
1526
1534
  const intent = account_experiences(home, { action: 'list' }).suggestions.find(item => item.id === id);
1535
+ if (intent?.kind !== 'workflow') return account_experiences(home, { action: 'go', id });
1527
1536
  if (!intent || intent.stage !== 'intent' || intent.complete || !(['pending', 'failed'].includes(intent.status) || intent.unconfirmed)) throw new Error(t('找不到要完成的意图。'));
1528
1537
  const path = read_registry(home).find(item => registered_identity(item)?.room === intent.source.room_id);
1529
1538
  if (!path) throw new Error(t('本机没有登记这个房间。'));
@@ -1562,6 +1571,7 @@ export async function refine_send(home, input) {
1562
1571
  }
1563
1572
 
1564
1573
  const verified_source = Symbol();
1574
+ const internal_admission = Symbol();
1565
1575
 
1566
1576
  /** Read schedule state from the same duty list MOSS manages. */
1567
1577
  function experience_review_status(home) {
@@ -1615,6 +1625,7 @@ export async function moss_experience(home, access_file, input) {
1615
1625
  if (!current || current.config.room !== access.room || current.config.site !== access.site ||
1616
1626
  !Object.values(current.config.members).some(member => member.token === access.token))
1617
1627
  throw new Error(t('只有主理人能跨房间提交经验建议。'));
1628
+ if (['admission-read', 'admission-result'].includes(input.action)) return moss_admission(home, current, access, input);
1618
1629
  if (input.action === 'data') {
1619
1630
  const data = account_experiences(home, { action: 'list' });
1620
1631
  const records = await experience_dispatches(home, current.config.site, access.token, input);
@@ -1659,6 +1670,60 @@ export async function moss_experience(home, access_file, input) {
1659
1670
  { extra, review_id: await current_review(current.config, access) });
1660
1671
  }
1661
1672
 
1673
+ function write_admission(home, input) {
1674
+ return save_launch_settings(home, { experience: input, [internal_admission]: true }).host_experience;
1675
+ }
1676
+
1677
+ async function moss_admission(home, current, access, input) {
1678
+ const job = admission_view(experiences(launch_settings(home))).admissions.find(row => row.id === input.id);
1679
+ if (!job || job.status !== 'checking' || job.attempt !== input.attempt)
1680
+ throw new Error(t('这次经验检查已失效,请重新读取。'));
1681
+ const member = current.room.host || current.config.host;
1682
+ const requests = (current.room.free?.requests || []).filter(row =>
1683
+ row.execution_id === access.execution_id && row.status === 'delivering');
1684
+ const live = current.room.free?.members?.find(row => row.name === member)?.execution;
1685
+ if (!Number.isSafeInteger(access.execution_id) || current.config.members?.[member]?.token !== access.token ||
1686
+ live?.id !== access.execution_id || !['dispatched', 'started'].includes(live?.status) || !requests.length)
1687
+ throw new Error(t('只能由主理人主窗口的本次检查回交。'));
1688
+ const messages = await Promise.all(requests.map(row => api(current.config, '/messages/' + row.message_id)));
1689
+ if (!messages.some(row => row.submission_id === 'experience-admission-' + job.attempt))
1690
+ throw new Error(t('只能由主理人主窗口的本次检查回交。'));
1691
+ if (input.action === 'admission-read') {
1692
+ const state = experiences(launch_settings(home));
1693
+ const view = admission_view(state);
1694
+ const fresh = view.admissions.find(row => row.id === job.id);
1695
+ if (fresh?.attempt !== job.attempt || fresh?.status !== 'checking') return { superseded: true };
1696
+ if (job.entries_revision !== view.entries_revision) {
1697
+ write_admission(home, { ...input, action: 'admission-refresh' });
1698
+ return { superseded: true };
1699
+ }
1700
+ return { job: fresh, entries: state.entries, organized: view.organized, entries_revision: view.entries_revision };
1701
+ }
1702
+ const updated = write_admission(home, input);
1703
+ return { job: admission_view(updated).admissions.find(row => row.id === job.id) };
1704
+ }
1705
+
1706
+ /** Use the same primary-window request as the management panel; deterministic submission IDs make recovery safe. */
1707
+ export async function deliver_experience_admission(home, deliver = steward_command) {
1708
+ const settings = launch_settings(home);
1709
+ const view = admission_view(experiences(settings));
1710
+ if (view.admissions.some(row => row.status === 'checking' && row.submitted_at)) return;
1711
+ const job = view.admissions.find(row => row.status === 'checking' && !row.submitted_at);
1712
+ if (!job) return;
1713
+ const base = { action: 'admission-delivery', id: job.id, attempt: job.attempt };
1714
+ write_admission(home, { ...base, begin: true });
1715
+ try {
1716
+ await deliver(home, 'steward-request', { skill: 'dispatch-analysis', lang: settings.channel_locale,
1717
+ submission_id: 'experience-admission-' + job.attempt,
1718
+ context: { mode: 'admission', id: job.id, attempt: job.attempt } }, { queue: true });
1719
+ write_admission(home, base);
1720
+ } catch (error) {
1721
+ // A missing reply may still have queued the request. Only definite refusal settles it as failed.
1722
+ if ([409, 429].includes(error.status) || ['ECONNRESET', 'ETIMEDOUT', 'UND_ERR_SOCKET'].includes(error.cause?.code || error.code)) return;
1723
+ write_admission(home, { ...base, failure: error.code === 'steward_not_configured' ? 'not_configured' : 'delivery' });
1724
+ }
1725
+ }
1726
+
1662
1727
  /** The daily-review trigger this MOSS execution is answering, so its suggestions join that report and no other. */
1663
1728
  async function current_review(config, access) {
1664
1729
  if (!Number.isSafeInteger(access.execution_id)) return null;
@@ -1690,7 +1755,8 @@ function verified_message_source(message, config, number, kind, input = {}) {
1690
1755
  }
1691
1756
 
1692
1757
  function save_experience_review(home, config, message, number, input, kind, { execution_id = null, extra = [], review_id = null } = {}) {
1693
- const source = { ...verified_message_source(message, config, number, kind, input), ...(execution_id ? { execution_id } : {}), ...(review_id ? { review_id } : {}) };
1758
+ const source = { ...verified_message_source(message, config, number, kind, input),
1759
+ ...(input.stage === 'intent' && input.kind !== 'workflow' ? { full_text: String(message.text || '').slice(0, 4000) } : {}), ...(execution_id ? { execution_id } : {}), ...(review_id ? { review_id } : {}) };
1694
1760
  // Only fields the program verified travel with the suggestion: further sources are replaced by the checked list.
1695
1761
  const { extra_sources: _unchecked, ...fields } = input;
1696
1762
  const experience = { ...fields, action: input.action === 'record' ? 'record' : 'propose', ...(extra.length ? { extra_sources: extra } : {}) };
@@ -1732,8 +1798,9 @@ export function save_launch_settings(home, input, steward_patch = null, update_s
1732
1798
  if (Object.hasOwn(prompts || {}, 'host') || input.experience) {
1733
1799
  settings.host_experience = experiences(previous);
1734
1800
  const expired = has_expired_experience(settings.host_experience);
1735
- if (Object.hasOwn(prompts || {}, 'host')) replace_legacy(settings.host_experience, prompts.host);
1736
- if (input.experience) change_experience(settings.host_experience, input.experience, input[verified_source]);
1801
+ if (Object.hasOwn(prompts || {}, 'host')) queue_legacy_experience(settings.host_experience, prompts.host);
1802
+ if (input.experience) change_managed_experience(settings.host_experience, input.experience, input[verified_source],
1803
+ input[internal_admission] === true, Boolean(settings.steward?.adapter));
1737
1804
  if (expired || input.experience?.action !== 'list') settings.host_experience.revision = (settings.host_experience.revision || 0) + 1;
1738
1805
  }
1739
1806
  if (prompts) settings.system_prompts = merge_system_prompts(previous.system_prompts, prompts);
@@ -6081,6 +6148,7 @@ export async function poll_steward_proactive(home) {
6081
6148
  const settings = launch_settings(home).steward;
6082
6149
  const proactive = current();
6083
6150
  const registration = proactive.duties.some(item => item.schedule || proactive.enabled) ? await registered_steward(home, settings?.room_id) : null;
6151
+ await deliver_experience_admission(home);
6084
6152
  await steward_proactive_tick(home, registration?.config, proactive, { current });
6085
6153
  }
6086
6154
 
@@ -6356,7 +6424,7 @@ export async function steward_command(home, action, input = {}, options = {}) {
6356
6424
  if (current) rmSync(join(home, 'steward-launch.json'), { force: true });
6357
6425
  if (current && existsSync(steward_renew_path(current.path))) {
6358
6426
  const { config, busy } = await renew_steward(home, current);
6359
- if (action === 'steward-request') return await post_steward_request(config, input);
6427
+ if (action === 'steward-request') return await post_steward_request(config, input, options.queue === true);
6360
6428
  return { ...steward_status(home, settings, config.room), busy };
6361
6429
  }
6362
6430
  if (current && !switched && action === 'steward') return steward_status(home, settings, current.config.room);
@@ -6365,7 +6433,7 @@ export async function steward_command(home, action, input = {}, options = {}) {
6365
6433
  current ||= await create_steward(home, view, prepared, { ...options, lang: input.lang });
6366
6434
  const { config, busy } = await configure_steward(current, view, prepared);
6367
6435
  if (action === 'steward') return { ...steward_status(home, settings, current.config.room), ...(busy ? { busy: true } : {}) };
6368
- return await post_steward_request(config, input);
6436
+ return await post_steward_request(config, input, options.queue === true);
6369
6437
  } finally { release?.(); }
6370
6438
  }
6371
6439
 
@@ -16,6 +16,7 @@ import { adapter_profile, API_PROVIDERS, host_model_rules, managed_project_acces
16
16
  import { account_quota, adapter_of, BRANCHABLE_ADAPTERS, lockdown_support, branch_session, capabilities_of, chosen_settings, cleanup_room, deliver_task, delivery_model_identity, project_skill_directories, delivery_receipt, preflight_stoppable, readonly_artifact_directories, reads_quota, recover_turn, session_exists, observe_session, software_defaults_stamp, stored_delivery, takes_images } from './adapters/index.mjs';
17
17
  import { acquire_lock, api as raw_api, overlapping_directories, read_rule, room_draft_key } from './discussion_runner.mjs';
18
18
  import { SegmentLog } from './execution_progress.mjs';
19
+ import { record_wakeup_text } from './wakeup_text.mjs';
19
20
  import { cwd_key } from './file_diff.mjs';
20
21
  import { capture_workspace, commit_workspace_checkpoint, diff_workspace, discard_workspace } from './workspace_worker.mjs';
21
22
  import { cleanup_room_checkpoints, inspect_checkpoint_root, observe_checkpoint_write, restore_rewound_checkpoints } from './file_checkpoint.mjs';
@@ -493,7 +494,7 @@ export async function request_attachments(config, execution, member_directory =
493
494
  options.signal?.throwIfAborted();
494
495
  const number = Number.isInteger(file.number) ? file.number : index + 1;
495
496
  const entry = { message_id, number, placeholder: attachment_placeholder(file, number), file_name: file.file_name,
496
- content_type: file.content_type, size: file.size, id: file.id, path: '' };
497
+ content_type: file.content_type, size: file.size, id: file.id, actor: file.actor, path: '' };
497
498
  // The owner freed this file's bytes; say so instead of failing a download.
498
499
  if (file.cleared_at) { entry.error = '附件已被房主清理,原文件不可用'; result.push(entry); continue; }
499
500
  try {
@@ -787,9 +788,10 @@ export function free_task_files(config, member, execution, binding, { session =
787
788
  { from: previous_access, to: profile.project_access });
788
789
  const prompt = [task_text.prompt, access_note, recent, from_guest ? GUEST_SOURCE_NOTE : '', task_room_note, window_note,
789
790
  config.steward_private ? steward_note : '', memory_note, continuation_note].filter(Boolean).join('\n\n');
790
- // Software that declares it takes images gets them with the prompt, like a screenshot pasted into its own window.
791
+ // Keep member handoffs out of the user-input history. Members can open the file or read the attachment by ID.
791
792
  const images = takes_images(profile) && !inbox
792
- ? attachments.filter(item => item.path && item.storage !== 'object' && IMAGE_TYPES.has(item.content_type)).map(item => ({ path: item.path, content_type: item.content_type, size: item.size }))
793
+ ? attachments.filter(item => (!item.actor || item.actor === '用户') && item.path && item.storage !== 'object' && IMAGE_TYPES.has(item.content_type))
794
+ .map(item => ({ path: item.path, content_type: item.content_type, size: item.size }))
793
795
  : [];
794
796
  const skills = discussion_request || direct_question
795
797
  ? ['discuss-participant/SKILL.md', 'discuss-session/SKILL.md',
@@ -935,10 +937,10 @@ export function member_platform(name) {
935
937
  }
936
938
 
937
939
  /** The owner's prompts for every member and for each platform, kept in launch-settings.json (never on the website). */
938
- export function prompt_layers(home, cwd) {
940
+ export function prompt_layers(home) {
939
941
  try {
940
942
  const settings = JSON.parse(readFileSync(join(home, 'launch-settings.json'), 'utf8'));
941
- return { ...settings.system_prompts, host: applicable_text(experiences(settings), cwd) };
943
+ return { ...settings.system_prompts, host: applicable_text(experiences(settings)) };
942
944
  } catch { return {}; }
943
945
  }
944
946
 
@@ -1083,9 +1085,9 @@ export function chat_task_files(config, member, chat, binding, { protection = ''
1083
1085
  const relaunched = !group && Boolean(adapter?.capabilities.system_prompt) && profile.project_access !== 'own';
1084
1086
  const shares_host_history = prompt_record?.host_rule && prompt_record.session_id === binding.session_id;
1085
1087
  const delivery = builtin || shares_host_history ? expert_prompt_delivery(prompt, profile, adapter, binding, false, prompt_record, {
1086
- layers: prompt_layers(config.api_home, config.cwd), platform, role, builtin,
1088
+ layers: prompt_layers(config.api_home), platform, role, builtin,
1087
1089
  }) : { prompt, ...(relaunched ? {
1088
- system_text: system_text(profile, prompt_layers(config.api_home, config.cwd), platform, PLATFORM_LABELS[platform], role) || undefined,
1090
+ system_text: system_text(profile, prompt_layers(config.api_home), platform, PLATFORM_LABELS[platform], role) || undefined,
1089
1091
  } : {}) };
1090
1092
  return { id, participant: member.name, directory: config.directory, member_directory, draft_directory, extra_directories, attachment_directories,
1091
1093
  ...(knowledge_directory && !readonly_knowledge ? { knowledge_directory } : {}),
@@ -2193,7 +2195,7 @@ export class FreeRoomRunner {
2193
2195
  session, suggestions: scheduler_suggestions, reviews: review_handoffs, stopped, workflow, room_members: this.room?.members,
2194
2196
  goal: this.room?.goal_state?.goal || null, attachments, room: this.room, model_change, request_texts, linked_rooms,
2195
2197
  host_strategy, host_strategy_record: this.prompt_record(member.name, 'host-strategy'), roster_runtime,
2196
- prompt_record, prompt_layers: prompt_layers(this.config.api_home, this.config.cwd), protection, attachment_cache_lease, steward_continuation,
2198
+ prompt_record, prompt_layers: prompt_layers(this.config.api_home), protection, attachment_cache_lease, steward_continuation,
2197
2199
  host_rule_text: prior_strategy ? prior_strategy.host_rule_text || '' : resume ? '' : undefined,
2198
2200
  editable_text: prior_strategy?.editable_text, retained_prompt_hash,
2199
2201
  model_observation: this.session_observations.get(member.name), recent,
@@ -2223,6 +2225,7 @@ export class FreeRoomRunner {
2223
2225
  const workflow_binding = workflow_execution_binding(workflow, member, Boolean(task.workflow));
2224
2226
  this.record_diagnostics(execution.id, { workflow: workflow_binding });
2225
2227
  if (warning) this.note(execution.id, warning);
2228
+ record_wakeup_text(task.directory, task.id, delivery_prompt);
2226
2229
  const result = await this.timed_delivery_step(execution.id, 'adapter_delivery', () => this.deliver(review_request ? structuredClone(task.profile) : task.profile, binding, { ...task, child_environment: () => model_environment(this.config, member), prompt: delivery_prompt, ...(resume ? { images: [] } : {}), room_title: this.room_title,
2227
2230
  ...(review_request || network_binding ? { before_model_start: async () => {
2228
2231
  if (review_request) await this.timed_delivery_step(execution.id, 'review_before_model', () => this.check_review_delivery(member, review_request));
@@ -3937,6 +3940,7 @@ export class FreeRoomRunner {
3937
3940
  const history = chats
3938
3941
  .filter(item => item.id !== chat.id && item.status === 'answered' && item.kind !== 'compact').map(item => ({ text: item.text, reply: item.reply }));
3939
3942
  turn.delivery_started = true;
3943
+ record_wakeup_text(task.directory, task.id, task.prompt);
3940
3944
  const result = await this.deliver(task.profile, binding, { ...task, child_environment: () => model_environment(this.config, null), room_title: this.room_title, chat: true, chat_history: history,
3941
3945
  api_context: { site: this.config.site, room: this.config.room, token: this.config.members[member.name].token,
3942
3946
  home: this.config.api_home, mode: 'free', role: task.role,