ai_co_discuss 0.6.3 → 0.6.4
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/screen-acceptance/SKILL.md +1 -1
- package/docs/en/guide/cli.md +2 -1
- package/docs/en/guide/external-members.md +3 -1
- package/docs/en/guide/members.md +1 -1
- package/docs/en/guide/rooms.md +1 -1
- package/docs/en/guide/steward.md +3 -3
- package/docs/en/guide/workflows.md +1 -0
- package/docs/guide/cli.md +2 -1
- package/docs/guide/external-members.md +3 -1
- package/docs/guide/members.md +1 -1
- package/docs/guide/rooms.md +1 -1
- package/docs/guide/steward.md +3 -3
- package/docs/guide/workflows.md +1 -0
- package/frontend/locales/en/room.json +4 -0
- package/frontend/locales/en/steward.json +2 -2
- package/package.json +2 -1
- package/runner/discussion_launch.mjs +147 -52
- package/runner/external_client.mjs +29 -9
- package/runner/i18n_en.mjs +5 -4
- package/runner/moss_windows.mjs +3 -3
- package/runner/steward.mjs +15 -13
- package/runner/steward_proactive.mjs +30 -5
- package/web/app.js +23 -1
- package/web/i18n.js +1 -1
- package/web/modern.css +1 -1
- package/web/modern.js +90 -90
|
@@ -57,7 +57,7 @@ import { site_fetch } from './entry_client.mjs';
|
|
|
57
57
|
import { channel_locale, t, with_channel_locale } from './i18n.mjs';
|
|
58
58
|
import { EXPERIENCE_REVIEW_DUTY, edit_steward_memory, move_steward_memory, post_steward_request, require_steward_skill, require_steward_software, steward_access, steward_defaults, steward_private_defaults, steward_private_patch, steward_profile, steward_room_permissions, steward_settings_patch, steward_site, steward_software, steward_status, sync_steward_platform_skills } from './steward.mjs';
|
|
59
59
|
import { duty_schedule_options } from './steward.mjs';
|
|
60
|
-
import { proactive_settings, revise_proactive_list, steward_proactive_tick } from './steward_proactive.mjs';
|
|
60
|
+
import { occurrence, proactive_settings, revise_proactive_list, steward_proactive_tick } from './steward_proactive.mjs';
|
|
61
61
|
import { HOST_MODEL_FIELDS, host_configure_items, host_room_limit, without_host_item } from './host_permissions.mjs';
|
|
62
62
|
import { guest_protection, guest_state_of, guest_withheld, HOST_ACTION_ITEMS, HOST_ITEMS, HOST_LEGACY_ITEMS, host_allowed, host_permission_fields, host_permissions, host_refusal, normalize_host_permissions } from './host_permissions.mjs';
|
|
63
63
|
|
|
@@ -222,7 +222,7 @@ const help_text = () => `用法:codiscuss launch settings [--file FILE]
|
|
|
222
222
|
codiscuss launch templates [--file FILE]
|
|
223
223
|
codiscuss launch experience list|add|edit|remove|enable|disable|accept|reject|dismiss|go|refine [--id ID] [--file JSON]
|
|
224
224
|
codiscuss launch experience-propose --message ID --file JSON
|
|
225
|
-
codiscuss launch experience review on|off [--at HH:MM]
|
|
225
|
+
codiscuss launch experience review on|off [--at HH:MM [--timezone IANA]]
|
|
226
226
|
${t('所有经验均为全局。添加或编辑时,JSON 文件填 text。')}
|
|
227
227
|
codiscuss launch experience confirm|resolve|direct-enable|retry|revoke-source|distill --id ID [--file JSON]
|
|
228
228
|
codiscuss launch experience-moss --file JSON
|
|
@@ -1578,7 +1578,8 @@ const internal_admission = Symbol();
|
|
|
1578
1578
|
function experience_review_status(home) {
|
|
1579
1579
|
const steward = launch_settings(home).steward;
|
|
1580
1580
|
const duty = steward?.proactive?.duties?.find(item => item.id === EXPERIENCE_REVIEW_DUTY);
|
|
1581
|
-
return { configured: Boolean(steward?.adapter), enabled: Boolean(steward?.adapter && duty), at: duty?.schedule.at || '08:00'
|
|
1581
|
+
return { configured: Boolean(steward?.adapter), enabled: Boolean(steward?.adapter && duty), at: duty?.schedule.at || '08:00',
|
|
1582
|
+
...(duty ? { timezone: duty.schedule.timezone || null, next_run: occurrence(duty.schedule, new Date(), 1).toISOString() } : {}) };
|
|
1582
1583
|
}
|
|
1583
1584
|
|
|
1584
1585
|
/** Change the account's daily inspection duty. No separate switch is stored. */
|
|
@@ -1598,7 +1599,7 @@ export async function experience_review(home, input) {
|
|
|
1598
1599
|
if (!experience_review_status(home).configured) throw new Error(t('请先配置 MOSS。'));
|
|
1599
1600
|
const text = t('执行主持人经验每日排查。先读 dispatch-analysis 技能的“每日排查”一节。');
|
|
1600
1601
|
const [entry] = revise_proactive_list({ duties: [] }, 'duties', 'add', { text,
|
|
1601
|
-
schedule: { at: input.at ?? old?.schedule.at ?? '08:00' } });
|
|
1602
|
+
schedule: { at: input.at ?? old?.schedule.at ?? '08:00', timezone: input.timezone || (input.at ? undefined : old?.schedule.timezone) } });
|
|
1602
1603
|
duties = [...duties, { ...entry, id: EXPERIENCE_REVIEW_DUTY, created_at: old?.created_at ?? entry.created_at }];
|
|
1603
1604
|
}
|
|
1604
1605
|
save_launch_settings(home, {}, { proactive: { ...previous, duties } });
|
|
@@ -1793,7 +1794,11 @@ export function save_launch_settings(home, input, steward_patch = null, update_s
|
|
|
1793
1794
|
if (update_strategies) settings.host_strategies = validate_host_strategies(update_strategies(previous.host_strategies));
|
|
1794
1795
|
if (['zh-CN', 'en'].includes(input.channel_locale) && (!input.channel_locale_default || !settings.channel_locale))
|
|
1795
1796
|
settings.channel_locale = input.channel_locale;
|
|
1796
|
-
if (steward_patch)
|
|
1797
|
+
if (steward_patch) {
|
|
1798
|
+
settings.steward = merge_steward_settings(previous.steward, steward_patch);
|
|
1799
|
+
if (steward_patch.adapter !== undefined && settings.steward.adapter !== previous.steward?.adapter)
|
|
1800
|
+
clear_following_group_speeds(settings);
|
|
1801
|
+
}
|
|
1797
1802
|
if (patch.create_preferences) settings.create_preferences = { ...previous.create_preferences, ...patch.create_preferences };
|
|
1798
1803
|
if (choices) settings.participants = merge_participant_choices(settings.participants, choices);
|
|
1799
1804
|
if (Object.hasOwn(prompts || {}, 'host') || input.experience) {
|
|
@@ -2485,17 +2490,40 @@ function save_moss_room_preferences(home, window, patch) {
|
|
|
2485
2490
|
}
|
|
2486
2491
|
|
|
2487
2492
|
function moss_room_preferences_patch(home, settings, window, patch) {
|
|
2488
|
-
if (window === 'main') return
|
|
2493
|
+
if (window === 'main') return steward_preferences_patch(home, settings, patch);
|
|
2489
2494
|
if (window === 'private') {
|
|
2490
|
-
const validated =
|
|
2495
|
+
const validated = steward_preferences_patch(home, settings, patch, true);
|
|
2491
2496
|
if (validated.extra_directories !== undefined) check_extra_directories(steward_private_defaults(home, settings).cwd, validated.extra_directories);
|
|
2492
2497
|
return { private: validated };
|
|
2493
2498
|
}
|
|
2494
2499
|
const windows = settings.steward?.windows || {};
|
|
2495
|
-
const preferences = validate_moss_group_preferences(home, settings, window, { ...windows[window], ...patch });
|
|
2500
|
+
const preferences = validate_moss_group_preferences(home, settings, window, { ...windows[window], ...patch }, patch.service_tier !== undefined);
|
|
2496
2501
|
return { windows: { ...windows, [window]: preferences } };
|
|
2497
2502
|
}
|
|
2498
2503
|
|
|
2504
|
+
/** Drop an old override when switching to software without speed settings. */
|
|
2505
|
+
function moss_speed_reset(patch) {
|
|
2506
|
+
return patch.adapter !== undefined && patch.service_tier === undefined && !adapter_profile(patch.adapter)?.service_tiers
|
|
2507
|
+
? { service_tier: '' } : {};
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
/** Validate the pending speed against the effective window software and model. */
|
|
2511
|
+
function steward_preferences_patch(home, settings, input, private_window = false) {
|
|
2512
|
+
const patch = (private_window ? steward_private_patch : steward_settings_patch)({ ...input, ...moss_speed_reset(input) });
|
|
2513
|
+
if (['adapter', 'preset', 'model', 'service_tier'].some(key => Object.hasOwn(patch, key))) {
|
|
2514
|
+
const steward = merge_steward_settings(settings.steward, private_window ? { private: patch } : patch);
|
|
2515
|
+
const view = (private_window ? steward_private_defaults : steward_defaults)(home, { ...settings, steward });
|
|
2516
|
+
const [, software] = steward_software(settings, view.adapter, view.preset);
|
|
2517
|
+
validate_moss_speed(home, { ...software, ...view });
|
|
2518
|
+
}
|
|
2519
|
+
return patch;
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
function validate_moss_speed(home, profile) {
|
|
2523
|
+
assert_service_tier(adapter_profile(profile.adapter), profile.service_tier);
|
|
2524
|
+
assert_model_speed(home, profile);
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2499
2527
|
async function moss_room_settings(home, input, path, config, window) {
|
|
2500
2528
|
const { cwd, extra_directories: dirs } = input;
|
|
2501
2529
|
const group = Boolean(config.moss_window);
|
|
@@ -2643,11 +2671,14 @@ export async function room_member_model(home, raw, headers = {}, { keep_omitted
|
|
|
2643
2671
|
try {
|
|
2644
2672
|
const config = configuration_snapshot(path).config;
|
|
2645
2673
|
profile = config.participants?.[name];
|
|
2646
|
-
const
|
|
2674
|
+
const speed_only = window && Object.hasOwn(input, 'service_tier') && input.model === undefined && input.effort === undefined;
|
|
2675
|
+
const planned = member_model_profile(home, profile, input, { keep_omitted: keep_omitted || speed_only, defaults: config.moss_window });
|
|
2647
2676
|
next = planned.next;
|
|
2648
2677
|
const updated = { ...config, participants: { ...config.participants, [name]: next } };
|
|
2649
2678
|
validate_config(updated, dirname(path));
|
|
2650
|
-
if (window) save_moss_room_preferences(home, window, { model: planned.model, effort: planned.effort })
|
|
2679
|
+
if (window) save_moss_room_preferences(home, window, { ...(speed_only ? {} : { model: planned.model, effort: planned.effort }),
|
|
2680
|
+
...(Object.hasOwn(input, 'service_tier') || (next.service_tier || '') !== (profile.service_tier || '')
|
|
2681
|
+
? { service_tier: next.service_tier || '' } : {}) });
|
|
2651
2682
|
atomic_json(path, updated);
|
|
2652
2683
|
saved = member_model_receipt(config, path, name, next, planned.facts);
|
|
2653
2684
|
} finally { release(); }
|
|
@@ -2739,7 +2770,7 @@ export async function room_member_adapter(home, raw, { host } = {}) {
|
|
|
2739
2770
|
if (window) moss_project_access(window, adapter, next.project_access);
|
|
2740
2771
|
const updated = { ...config, ...(window ? { project_access: next.project_access } : {}), participants: { ...config.participants, [name]: next } };
|
|
2741
2772
|
validate_config(updated, dirname(path));
|
|
2742
|
-
if (window) save_moss_room_preferences(home, window, { adapter, model: next.model || '', effort: next.effort || '' });
|
|
2773
|
+
if (window) save_moss_room_preferences(home, window, { adapter, model: next.model || '', effort: next.effort || '', service_tier: next.service_tier || '' });
|
|
2743
2774
|
atomic_json(path, updated);
|
|
2744
2775
|
return { room_id: input.room_id, member: name, adapter };
|
|
2745
2776
|
} finally { release(); }
|
|
@@ -5234,8 +5265,9 @@ async function finish_spawn_setup(path, room, setup, options) {
|
|
|
5234
5265
|
function steward_task_member(config, host, access = 'write') {
|
|
5235
5266
|
const host_name = platform_of(host);
|
|
5236
5267
|
const source = config.participants[host];
|
|
5237
|
-
const profile = Object.fromEntries(['adapter', 'model', 'effort', 'executable', 'ipc_directory', 'base_url', 'api_protocol', 'api_key_ref']
|
|
5268
|
+
const profile = Object.fromEntries(['adapter', 'model', 'effort', 'service_tier', 'executable', 'ipc_directory', 'base_url', 'api_protocol', 'api_key_ref']
|
|
5238
5269
|
.filter(field => source[field] !== undefined).map(field => [field, source[field]]));
|
|
5270
|
+
profile.service_tier ??= '';
|
|
5239
5271
|
return { host_name, names: [host_name], access, participants: { [host_name]: { ...profile, project_access: access } } };
|
|
5240
5272
|
}
|
|
5241
5273
|
|
|
@@ -5821,7 +5853,7 @@ async function create_steward(home, view, prepared, options, private_window = fa
|
|
|
5821
5853
|
const saved = existsSync(pending) ? JSON.parse(readFileSync(pending, 'utf8')) : null;
|
|
5822
5854
|
const raw = saved?.room?.host === platform && saved.site === steward_site(home) ? saved : {
|
|
5823
5855
|
entry: 'web', site: steward_site(home), cwd: view.cwd, project_access: profile.project_access, extra_directories: view.extra_directories,
|
|
5824
|
-
without_saved_tools: true, participants: { [platform]: profile }, steward_skills: view.skills,
|
|
5856
|
+
without_saved_tools: true, participants: { [platform]: { ...profile, service_tier: view.service_tier || '' } }, steward_skills: view.skills,
|
|
5825
5857
|
room: { title: private_window ? t('MOSS 私信') : 'MOSS', mode: 'free', host: platform,
|
|
5826
5858
|
system_kind: private_window ? 'steward_private' : 'steward', members: [platform], submission_id: randomUUID() },
|
|
5827
5859
|
};
|
|
@@ -5833,9 +5865,37 @@ async function create_steward(home, view, prepared, options, private_window = fa
|
|
|
5833
5865
|
return { path: result.config_path, config, room: result.room };
|
|
5834
5866
|
}
|
|
5835
5867
|
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5868
|
+
/** Follow the main software when it can run read-only. Keep a registered group's safe software otherwise. */
|
|
5869
|
+
function moss_group_software(settings, preferences, config) {
|
|
5870
|
+
if (preferences.adapter) return { adapter: preferences.adapter, preset: preferences.preset || '' };
|
|
5871
|
+
const { adapter = '', preset = '' } = settings.steward || {};
|
|
5872
|
+
const [name, profile] = Object.entries(config?.participants || {})[0] || [];
|
|
5873
|
+
if (profile && !main_group_software_ready(settings))
|
|
5874
|
+
return { adapter: profile.adapter, preset: platform_of(name) };
|
|
5875
|
+
return { adapter, preset };
|
|
5876
|
+
}
|
|
5877
|
+
|
|
5878
|
+
function moss_group_speed(adapter, service_tier) {
|
|
5879
|
+
return adapter_profile(adapter)?.service_tiers ? service_tier || '' : '';
|
|
5880
|
+
}
|
|
5881
|
+
|
|
5882
|
+
function main_group_software_ready(settings) {
|
|
5883
|
+
const { adapter, preset } = settings.steward || {};
|
|
5884
|
+
return lockdown_support(adapter, { project_access: 'read' }).supported && Boolean(steward_software(settings, adapter, preset)[1]);
|
|
5885
|
+
}
|
|
5886
|
+
|
|
5887
|
+
/** Clear saved follower overrides as part of the same settings write as a compatible main-software switch. */
|
|
5888
|
+
function clear_following_group_speeds(settings) {
|
|
5889
|
+
const { steward } = settings;
|
|
5890
|
+
const { adapter, windows } = steward;
|
|
5891
|
+
if (!windows || !main_group_software_ready(settings) || adapter_profile(adapter)?.service_tiers) return;
|
|
5892
|
+
steward.windows = Object.fromEntries(Object.entries(windows).map(([key, preferences]) => [key,
|
|
5893
|
+
!preferences.adapter && preferences.service_tier ? { ...preferences, service_tier: '' } : preferences]));
|
|
5894
|
+
}
|
|
5895
|
+
|
|
5896
|
+
function moss_group_profile(home, settings, channel, chat_id, preferences, config) {
|
|
5897
|
+
const { adapter, preset } = moss_group_software(settings, preferences, config);
|
|
5898
|
+
const [platform, saved] = steward_software(settings, adapter, preset);
|
|
5839
5899
|
if (!saved || !lockdown_support(adapter, { project_access: 'read' }).supported) throw new Error(t('当前 MOSS 软件无法按群窗口要求以只读档运行。'));
|
|
5840
5900
|
const cwd = moss_group_cwd(home, moss_window_key(channel, chat_id));
|
|
5841
5901
|
const { executable, ipc_directory, base_url, api_protocol, api_key_ref } = saved;
|
|
@@ -5844,7 +5904,9 @@ function moss_group_profile(home, settings, channel, chat_id, preferences) {
|
|
|
5844
5904
|
? provider.models.find(model => /(?:^|[-.])(?:flash|haiku|luna|mini|nano|lite)(?:$|[-.])/i.test(model)) : '';
|
|
5845
5905
|
const defaults = { model: light_model || saved.model, effort: adapter_profile(adapter)?.efforts?.[0] || '' };
|
|
5846
5906
|
const profile = { adapter, executable, ipc_directory, base_url, api_protocol, api_key_ref,
|
|
5847
|
-
model: preferences.model || defaults.model, effort: preferences.effort || defaults.effort,
|
|
5907
|
+
model: preferences.model || defaults.model, effort: preferences.effort || defaults.effort,
|
|
5908
|
+
service_tier: moss_group_speed(adapter, preferences.service_tier), cwd, project_access: 'read' };
|
|
5909
|
+
validate_moss_speed(home, profile);
|
|
5848
5910
|
return { platform, cwd, defaults, profile: Object.fromEntries(Object.entries(profile).filter(([, value]) => value !== undefined)) };
|
|
5849
5911
|
}
|
|
5850
5912
|
|
|
@@ -5854,13 +5916,42 @@ function moss_group_cwd(home, key) {
|
|
|
5854
5916
|
|
|
5855
5917
|
const group_read_directories = paths => paths.map(path => ({ path, access: 'read' }));
|
|
5856
5918
|
|
|
5857
|
-
function
|
|
5919
|
+
function moss_group_config(home, room_id) {
|
|
5920
|
+
const path = room_id && registered_room_path(home, steward_site(home), room_id);
|
|
5921
|
+
return path ? configuration_snapshot(path).config : undefined;
|
|
5922
|
+
}
|
|
5923
|
+
|
|
5924
|
+
function validate_moss_group_preferences(home, settings, key, input, strict_speed = false) {
|
|
5858
5925
|
const preferences = moss_windows_patch({ [key]: moss_window_preferences(input) })[key];
|
|
5859
5926
|
check_extra_directories(moss_group_cwd(home, key), preferences.read_directories);
|
|
5860
|
-
if (preferences.adapter
|
|
5927
|
+
if (!preferences.adapter && !preferences.service_tier) return preferences;
|
|
5928
|
+
const config = !preferences.adapter && moss_group_config(home, moss_windows(home)[key]?.room);
|
|
5929
|
+
const { adapter } = moss_group_software(settings, preferences, config);
|
|
5930
|
+
const tier = moss_group_speed(adapter, preferences.service_tier);
|
|
5931
|
+
if (strict_speed) assert_service_tier(adapter_profile(adapter), preferences.service_tier);
|
|
5932
|
+
if (preferences.adapter || tier) moss_group_profile(home, settings, ...key.split(':'), preferences, config);
|
|
5933
|
+
preferences.service_tier = tier;
|
|
5861
5934
|
return preferences;
|
|
5862
5935
|
}
|
|
5863
5936
|
|
|
5937
|
+
function moss_group_view(home, settings, preferences, room_id) {
|
|
5938
|
+
const config = !preferences.adapter && !main_group_software_ready(settings)
|
|
5939
|
+
? moss_group_config(home, room_id) : undefined;
|
|
5940
|
+
const { adapter, preset } = moss_group_software(settings, preferences, config);
|
|
5941
|
+
const [selected] = steward_software(settings, adapter, preset);
|
|
5942
|
+
return { ...preferences, service_tier: moss_group_speed(adapter, preferences.service_tier), window_software: { adapter, preset: selected || preset } };
|
|
5943
|
+
}
|
|
5944
|
+
|
|
5945
|
+
/** Window settings keep the selection separate from the software resolved for the next group delivery. */
|
|
5946
|
+
function steward_status_with_groups(home, settings, room_id) {
|
|
5947
|
+
const status = steward_status(home, settings, room_id);
|
|
5948
|
+
const windows = status.settings.windows;
|
|
5949
|
+
for (const [key, group] of Object.entries(moss_windows(home))) {
|
|
5950
|
+
if (group.room) windows[key] = moss_group_view(home, settings, windows[key] || {}, group.room);
|
|
5951
|
+
}
|
|
5952
|
+
return status;
|
|
5953
|
+
}
|
|
5954
|
+
|
|
5864
5955
|
function steward_window(home, window = 'main') {
|
|
5865
5956
|
const settings = launch_settings(home);
|
|
5866
5957
|
if (window === 'main' || window === 'steward') return { kind: 'steward', cwd: steward_defaults(home, settings).cwd, room_id: settings.steward?.room_id };
|
|
@@ -5967,17 +6058,17 @@ export async function moss_group_command(home, input, options = {}) {
|
|
|
5967
6058
|
const channel = (options.channels || CHANNELS).find(candidate => candidate.id === channel_id);
|
|
5968
6059
|
if (!channel?.capabilities?.groups) throw new Error(t('此通知渠道不支持 MOSS 群窗口。'));
|
|
5969
6060
|
if (action === 'groups') {
|
|
5970
|
-
const settings = launch_settings(home)
|
|
6061
|
+
const settings = launch_settings(home);
|
|
5971
6062
|
const windows = moss_windows(home);
|
|
5972
6063
|
const groups = channel.ready(home) ? await channel.groups(home) : [];
|
|
5973
|
-
return { bound: channel.ready(home), supported: lockdown_support(settings?.adapter, { project_access: 'read' }).supported,
|
|
5974
|
-
confines_reads: adapter_capabilities(settings?.adapter).confines_reads === true,
|
|
6064
|
+
return { bound: channel.ready(home), supported: lockdown_support(settings.steward?.adapter, { project_access: 'read' }).supported,
|
|
6065
|
+
confines_reads: adapter_capabilities(settings.steward?.adapter).confines_reads === true,
|
|
5975
6066
|
groups: groups.map(group => {
|
|
5976
6067
|
const key = moss_window_key(channel_id, group.id);
|
|
5977
6068
|
const window = windows[key] || {};
|
|
5978
|
-
const preferences = moss_window_preferences(settings?.windows?.[key]);
|
|
6069
|
+
const preferences = moss_group_view(home, settings, moss_window_preferences(settings.steward?.windows?.[key]), window.room);
|
|
5979
6070
|
return { ...group, enabled: window.enabled === true, room: window.room || null, tasks_used_today: moss_group_task_usage(window).submissions.length,
|
|
5980
|
-
...preferences, adapter: preferences.adapter
|
|
6071
|
+
...preferences, adapter: preferences.window_software.adapter, used_today: moss_window_usage(window).used,
|
|
5981
6072
|
silent_count: window.silent_count || 0, last_failure: window.last_failure || null, pending_owner: Boolean(window.pending_owner) };
|
|
5982
6073
|
}) };
|
|
5983
6074
|
}
|
|
@@ -6006,23 +6097,26 @@ export async function moss_group_command(home, input, options = {}) {
|
|
|
6006
6097
|
const saved = all[key];
|
|
6007
6098
|
const merged = { ...saved, ...input.settings };
|
|
6008
6099
|
if (Object.hasOwn(input.settings || {}, 'read_directory') && !Object.hasOwn(input.settings, 'read_directories')) delete merged.read_directories;
|
|
6009
|
-
const preferences = validate_moss_group_preferences(home, settings, key, merged);
|
|
6100
|
+
const preferences = validate_moss_group_preferences(home, settings, key, merged, input.settings?.service_tier !== undefined);
|
|
6010
6101
|
if (action === 'group-settings') {
|
|
6011
6102
|
if (!current) throw new Error(t('请先开启此 MOSS 群窗口。'));
|
|
6012
6103
|
save_launch_settings(home, {}, { windows: { ...all, [key]: preferences } });
|
|
6013
|
-
return { ...preferences, enabled: current.enabled, room_id: current.room };
|
|
6104
|
+
return { ...moss_group_view(home, settings, preferences, current.room), enabled: current.enabled, room_id: current.room };
|
|
6014
6105
|
}
|
|
6015
6106
|
if (!channel.ready(home)) throw new Error(t('请先在通知渠道绑定房主账号。'));
|
|
6016
6107
|
const group = (await channel.groups(home, { check_owner: false })).find(item => item.id === chat_id);
|
|
6017
6108
|
if (!group) throw new Error(t('找不到此账号所在的群。'));
|
|
6018
6109
|
const create = options.create || create_moss_group;
|
|
6019
|
-
moss_group_profile(home, launch_settings(home), channel.id, group.id, preferences);
|
|
6110
|
+
moss_group_profile(home, launch_settings(home), channel.id, group.id, preferences, moss_group_config(home, current?.room));
|
|
6020
6111
|
const room = current?.room || await create(home, channel, group, preferences, options);
|
|
6021
|
-
|
|
6112
|
+
const latest = launch_settings(home);
|
|
6113
|
+
const { service_tier, window_software } = moss_group_view(home, latest, preferences, room);
|
|
6114
|
+
if (input.settings || (saved?.service_tier || '') !== service_tier)
|
|
6115
|
+
save_launch_settings(home, {}, { windows: { ...latest.steward?.windows, [key]: { ...preferences, service_tier } } });
|
|
6022
6116
|
change_moss_window(home, key, saved => ({ ...saved, enabled: true, room, title: group.title }));
|
|
6023
6117
|
const introduction = input.introduce === true && !current?.enabled;
|
|
6024
6118
|
const introduction_sent = introduction ? await introduce_moss_group(home, channel, group, key, options.log) : undefined;
|
|
6025
|
-
return { enabled: true, room_id: room, title: group.title, group: { ...group, enabled: true, room },
|
|
6119
|
+
return { enabled: true, room_id: room, title: group.title, group: { ...group, enabled: true, room, window_software },
|
|
6026
6120
|
...(introduction ? { introduction_sent } : {}) };
|
|
6027
6121
|
} finally { release(); }
|
|
6028
6122
|
}
|
|
@@ -6071,7 +6165,9 @@ async function launch_steward_with_recovery(home, raw, options) {
|
|
|
6071
6165
|
|
|
6072
6166
|
/** Replace the execution member when software changes, keeping its room and conversation. */
|
|
6073
6167
|
async function save_steward_settings(home, input) {
|
|
6074
|
-
|
|
6168
|
+
let settings = launch_settings(home);
|
|
6169
|
+
const patch = steward_preferences_patch(home, settings, input);
|
|
6170
|
+
if (Object.hasOwn(input, 'private')) patch.private = steward_preferences_patch(home, settings, input.private, true);
|
|
6075
6171
|
const roster = input.create_preferences;
|
|
6076
6172
|
if (Object.hasOwn(input, 'create_preferences')) {
|
|
6077
6173
|
validate_create_preferences(roster);
|
|
@@ -6080,7 +6176,6 @@ async function save_steward_settings(home, input) {
|
|
|
6080
6176
|
throw new Error(t('MOSS 建房成员设置无效,主持人须在成员名单中'));
|
|
6081
6177
|
}
|
|
6082
6178
|
}
|
|
6083
|
-
let settings = launch_settings(home);
|
|
6084
6179
|
const view_for_patch = steward_defaults(home, { ...settings, steward: { ...settings.steward, ...patch } });
|
|
6085
6180
|
check_extra_directories(view_for_patch.cwd, patch.extra_directories ?? settings.steward?.extra_directories ?? []);
|
|
6086
6181
|
const previous_cwd = steward_defaults(home, settings).cwd;
|
|
@@ -6088,11 +6183,8 @@ async function save_steward_settings(home, input) {
|
|
|
6088
6183
|
const main = { kind: 'steward', cwd: view_for_patch.cwd };
|
|
6089
6184
|
if (moving) window_memory_directory(home, main);
|
|
6090
6185
|
if (patch.private?.extra_directories !== undefined) check_extra_directories(steward_private_defaults(home, settings).cwd, patch.private.extra_directories);
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
check_extra_directories(moss_group_cwd(home, key), saved.read_directories || []);
|
|
6094
|
-
if (saved.adapter) moss_group_profile(home, settings, channel, chat_id, saved);
|
|
6095
|
-
}
|
|
6186
|
+
const group_settings = { ...settings, steward: merge_steward_settings(settings.steward, patch) };
|
|
6187
|
+
for (const [key, saved] of Object.entries(patch.windows || {})) patch.windows[key] = validate_moss_group_preferences(home, group_settings, key, saved);
|
|
6096
6188
|
const current = await registered_steward(home, settings.steward?.room_id);
|
|
6097
6189
|
settings = record_steward_software(home, settings, current);
|
|
6098
6190
|
if (patch.proactive || patch.adapter === '') {
|
|
@@ -6112,7 +6204,7 @@ async function save_steward_settings(home, input) {
|
|
|
6112
6204
|
const save = () => save_launch_settings(home, roster ? { create_preferences: roster } : {}, patch);
|
|
6113
6205
|
const { settings: result, memory_move } = moving ? move_steward_memory(
|
|
6114
6206
|
window_memory_directory(home, { ...main, cwd: previous_cwd }), window_memory_directory(home, main), save) : { settings: save() };
|
|
6115
|
-
return { ...
|
|
6207
|
+
return { ...steward_status_with_groups(home, result, current?.config.room), ...(memory_move ? { memory_move } : {}),
|
|
6116
6208
|
...(roster ? { create_preferences: roster } : {}), ...(busy ? { busy: true } : {}) };
|
|
6117
6209
|
}
|
|
6118
6210
|
|
|
@@ -6165,7 +6257,8 @@ function steward_delivery_changed(config, view, settings) {
|
|
|
6165
6257
|
return steward_software_changed(config, view, settings) || profile?.project_access !== view.project_access ||
|
|
6166
6258
|
config.cwd !== view.cwd ||
|
|
6167
6259
|
JSON.stringify(config.extra_directories || []) !== JSON.stringify(view.extra_directories || []) ||
|
|
6168
|
-
(profile?.model || '') !== view.model || (profile?.effort || '') !== view.effort
|
|
6260
|
+
(profile?.model || '') !== view.model || (profile?.effort || '') !== view.effort ||
|
|
6261
|
+
(profile?.service_tier || '') !== (view.service_tier || '');
|
|
6169
6262
|
}
|
|
6170
6263
|
|
|
6171
6264
|
function steward_renew_path(path) { return join(dirname(path), 'steward-renew.json'); }
|
|
@@ -6218,8 +6311,7 @@ function prepare_group_delivery(home, config, settings) {
|
|
|
6218
6311
|
const { channel, chat_id } = config.moss_window;
|
|
6219
6312
|
const key = moss_window_key(channel, chat_id);
|
|
6220
6313
|
const preferences = moss_window_preferences(settings.steward?.windows?.[key]);
|
|
6221
|
-
|
|
6222
|
-
const prepared = moss_group_profile(home, settings, channel, chat_id, preferences);
|
|
6314
|
+
const prepared = moss_group_profile(home, settings, channel, chat_id, preferences, config);
|
|
6223
6315
|
return { prepared, view: { cwd: prepared.cwd, group_defaults: prepared.defaults,
|
|
6224
6316
|
extra_directories: group_read_directories(preferences.read_directories) } };
|
|
6225
6317
|
}
|
|
@@ -6237,7 +6329,7 @@ function prepare_steward_renewal(home, config, settings, changed) {
|
|
|
6237
6329
|
|
|
6238
6330
|
/** Save only supplied choices, then replace the member using the latest window settings. */
|
|
6239
6331
|
async function renew_steward(home, current, input = {}) {
|
|
6240
|
-
const selection = Object.fromEntries(['adapter', 'preset', 'model', 'effort'].filter(key => Object.hasOwn(input, key)).map(key => [key, input[key]]));
|
|
6332
|
+
const selection = Object.fromEntries(['adapter', 'preset', 'model', 'effort', 'service_tier'].filter(key => Object.hasOwn(input, key)).map(key => [key, input[key]]));
|
|
6241
6333
|
let settings = launch_settings(home);
|
|
6242
6334
|
const patch = Object.keys(selection).length ? moss_room_preferences_patch(home, settings, moss_room_selector(current.config), selection) : null;
|
|
6243
6335
|
if (patch) settings = { ...settings, steward: merge_steward_settings(settings.steward, patch) };
|
|
@@ -6299,10 +6391,11 @@ function group_delivery_changed(home, config, key) {
|
|
|
6299
6391
|
const settings = launch_settings(home);
|
|
6300
6392
|
const preferences = moss_window_preferences(settings.steward?.windows?.[key]);
|
|
6301
6393
|
const [name, profile] = Object.entries(config.participants)[0];
|
|
6302
|
-
|
|
6303
|
-
const [platform] = steward_software(settings,
|
|
6304
|
-
if (
|
|
6394
|
+
const { adapter, preset } = moss_group_software(settings, preferences, config);
|
|
6395
|
+
const [platform] = steward_software(settings, adapter, preset);
|
|
6396
|
+
if (adapter === profile.adapter && (!platform || platform === platform_of(name)) && (profile.model || '') === (preferences.model || config.moss_window.default_model || '') &&
|
|
6305
6397
|
(profile.effort || '') === (preferences.effort || config.moss_window.default_effort || '') &&
|
|
6398
|
+
(profile.service_tier || '') === moss_group_speed(adapter, preferences.service_tier) &&
|
|
6306
6399
|
JSON.stringify(config.extra_directories || []) === JSON.stringify(group_read_directories(preferences.read_directories))) return null;
|
|
6307
6400
|
return settings;
|
|
6308
6401
|
}
|
|
@@ -6398,7 +6491,9 @@ export async function steward_command(home, action, input = {}, options = {}) {
|
|
|
6398
6491
|
try {
|
|
6399
6492
|
const current = registered_room_config(home, steward_site(home), window.room_id);
|
|
6400
6493
|
const busy = (await renew_steward(home, { ...current, room: await api(current.config, '') }, input)).busy;
|
|
6401
|
-
|
|
6494
|
+
const settings = launch_settings(home);
|
|
6495
|
+
const preferences = settings.steward?.windows?.[window.key] || {};
|
|
6496
|
+
return { room_id: window.room_id, busy, ...moss_group_view(home, settings, preferences, window.room_id) };
|
|
6402
6497
|
} finally { release(); }
|
|
6403
6498
|
}
|
|
6404
6499
|
const writing = ['steward-settings', 'steward-request', 'steward-duty', 'steward-mute', 'steward-renew'].includes(action) || input.open === true;
|
|
@@ -6413,11 +6508,11 @@ export async function steward_command(home, action, input = {}, options = {}) {
|
|
|
6413
6508
|
if (action === 'steward-renew') {
|
|
6414
6509
|
if (!current) throw new Error(t('请先打开 MOSS 对话,再开始新会话'));
|
|
6415
6510
|
const { busy } = await renew_steward(home, current, input);
|
|
6416
|
-
return { ...
|
|
6511
|
+
return { ...steward_status_with_groups(home, launch_settings(home), current.config.room), busy };
|
|
6417
6512
|
}
|
|
6418
6513
|
const view = steward_defaults(home, settings);
|
|
6419
6514
|
const switched = current && steward_software_changed(current.config, view, settings);
|
|
6420
|
-
if (!writing) return
|
|
6515
|
+
if (!writing) return steward_status_with_groups(home, settings, current?.config.room);
|
|
6421
6516
|
require_steward_software(view);
|
|
6422
6517
|
sync_steward_platform_skills(home, undefined, false);
|
|
6423
6518
|
if (action === 'steward-request') {
|
|
@@ -6427,14 +6522,14 @@ export async function steward_command(home, action, input = {}, options = {}) {
|
|
|
6427
6522
|
if (current && existsSync(steward_renew_path(current.path))) {
|
|
6428
6523
|
const { config, busy } = await renew_steward(home, current);
|
|
6429
6524
|
if (action === 'steward-request') return await post_steward_request(config, input, options.queue === true);
|
|
6430
|
-
return { ...
|
|
6525
|
+
return { ...steward_status_with_groups(home, settings, config.room), busy };
|
|
6431
6526
|
}
|
|
6432
|
-
if (current && !switched && action === 'steward') return
|
|
6527
|
+
if (current && !switched && action === 'steward') return steward_status_with_groups(home, settings, current.config.room);
|
|
6433
6528
|
const prepared = steward_profile(home, settings, view, participant_profile);
|
|
6434
6529
|
assert_model_available(home, prepared.platform, prepared.profile);
|
|
6435
6530
|
current ||= await create_steward(home, view, prepared, { ...options, lang: input.lang });
|
|
6436
6531
|
const { config, busy } = await configure_steward(current, view, prepared);
|
|
6437
|
-
if (action === 'steward') return { ...
|
|
6532
|
+
if (action === 'steward') return { ...steward_status_with_groups(home, settings, current.config.room), ...(busy ? { busy: true } : {}) };
|
|
6438
6533
|
return await post_steward_request(config, input, options.queue === true);
|
|
6439
6534
|
} finally { release?.(); }
|
|
6440
6535
|
}
|
|
@@ -6505,7 +6600,7 @@ function host_rule_command(op, id, values) {
|
|
|
6505
6600
|
export async function launch_main(args = process.argv.slice(2), input_text) {
|
|
6506
6601
|
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: {
|
|
6507
6602
|
file: { type: 'string' }, 'dry-run': { type: 'boolean' }, browser: { type: 'boolean' }, remote: { type: 'boolean' }, device: { type: 'string' },
|
|
6508
|
-
'configuration-locked': { type: 'boolean' }, help: { type: 'boolean', short: 'h' }, overwrite: { type: 'boolean' }, at: { type: 'string' }, weekdays: { type: 'string' }, deliver: { type: 'string' }, preset: { type: 'string' }, workflow: { type: 'string' }, from: { type: 'string' },
|
|
6603
|
+
'configuration-locked': { type: 'boolean' }, help: { type: 'boolean', short: 'h' }, overwrite: { type: 'boolean' }, at: { type: 'string' }, timezone: { type: 'string' }, weekdays: { type: 'string' }, deliver: { type: 'string' }, preset: { type: 'string' }, workflow: { type: 'string' }, from: { type: 'string' },
|
|
6509
6604
|
'overwrite-preset': { type: 'boolean' }, 'replace-knowledge': { type: 'boolean' },
|
|
6510
6605
|
'project-id': { type: 'string' }, scope: { type: 'string' }, project: { type: 'string' }, draft: { type: 'string' }, 'access-file': { type: 'string' }, dir: { type: 'string' }, card: { type: 'string' }, sub: { type: 'string' }, id: { type: 'string' },
|
|
6511
6606
|
member: { type: 'string' }, order: { type: 'string' }, revision: { type: 'string' }, name: { type: 'string' }, access: { type: 'string' },
|
|
@@ -6578,7 +6673,7 @@ export async function launch_main(args = process.argv.slice(2), input_text) {
|
|
|
6578
6673
|
return process.stdout.write(JSON.stringify(result) + '\n');
|
|
6579
6674
|
}
|
|
6580
6675
|
if (process.env.DISCUSS_ACCESS_FILE || values['access-file']) throw new Error(t('只有用户能管理经验。'));
|
|
6581
|
-
if (positionals[1] === 'review') return process.stdout.write(JSON.stringify(await experience_review(home, { mode: positionals[2], at: values.at })) + '\n');
|
|
6676
|
+
if (positionals[1] === 'review') return process.stdout.write(JSON.stringify(await experience_review(home, { mode: positionals[2], at: values.at, timezone: values.timezone })) + '\n');
|
|
6582
6677
|
input.action = positionals[1] || 'list';
|
|
6583
6678
|
if (values.id) input.id = values.id;
|
|
6584
6679
|
if (input.action === 'go') return process.stdout.write(JSON.stringify(await start_intent(home, input.id)) + '\n');
|
|
@@ -18,6 +18,7 @@ import { adapter_capabilities, adapter_profile, API_PROVIDERS, lockdown_support
|
|
|
18
18
|
import { correctable_refusals, external_task_text, MAX_REFUSAL_RETRIES, refusal_retry_prompt, TASK_SUBCOMMANDS } from './expert_prompts.mjs';
|
|
19
19
|
import { atomic_json } from './files.mjs';
|
|
20
20
|
import { t } from './i18n.mjs';
|
|
21
|
+
import { model_catalog_reader } from './model_catalog.mjs';
|
|
21
22
|
import { mirror_pin, mirror_proposal, mirror_pull, mirror_rm, mirror_status } from './patch_mirror.mjs';
|
|
22
23
|
|
|
23
24
|
export const WAKES = ['auto', 'ask'];
|
|
@@ -411,14 +412,26 @@ export async function member_api(home, id, method, path, body, deps = {}) {
|
|
|
411
412
|
|
|
412
413
|
// ---- Local commands ----
|
|
413
414
|
|
|
414
|
-
function check_ai(input) {
|
|
415
|
+
function check_ai(home, input) {
|
|
415
416
|
const adapter = String(input.adapter || '');
|
|
416
417
|
const profile = adapter_profile(adapter);
|
|
417
418
|
// The AI reaches the other room only through this computer's codiscuss (a CLI) or this module (the model API's room
|
|
418
419
|
// and repo tools); App windows do neither.
|
|
419
420
|
if (!['cli', 'api'].includes(profile?.kind)) throw failure('ai_unsupported', '外部成员只能派命令行软件(如 Claude Code)或模型 API');
|
|
420
421
|
// An external member takes no prompt of its own (user 2026-11-25): it answers in another person's room by that room's rules.
|
|
421
|
-
|
|
422
|
+
const model = String(input.model || '');
|
|
423
|
+
const service_tier = input.service_tier === undefined ? '' : input.service_tier;
|
|
424
|
+
if (typeof service_tier !== 'string' || (service_tier && !profile.service_tiers?.includes(service_tier))) {
|
|
425
|
+
throw failure('ai_speed_unsupported', '所选软件不支持该速度档位');
|
|
426
|
+
}
|
|
427
|
+
if (model && service_tier && service_tier !== 'default') {
|
|
428
|
+
const software = software_profile(home, { adapter, model });
|
|
429
|
+
const entry = model_catalog_reader(home)({ ...software, adapter })?.find(item => item.id === model);
|
|
430
|
+
if (Array.isArray(entry?.service_tiers) && !entry.service_tiers.includes(service_tier)) {
|
|
431
|
+
throw failure('ai_model_speed_unsupported', '所选模型不支持该速度档位');
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return { adapter, model, effort: String(input.effort || ''), ...(profile.service_tiers ? { service_tier } : {}) };
|
|
422
435
|
}
|
|
423
436
|
|
|
424
437
|
/** The saved model API this AI runs on, as `[participant name, settings]`; empty when this computer has none. */
|
|
@@ -485,7 +498,7 @@ export async function lend(home, { id, duration }, deps = {}) {
|
|
|
485
498
|
/** Accept an invitation: check the computer's fingerprint when the link carries one, redeem with a new key, keep the record. */
|
|
486
499
|
export async function join_invite(home, input, deps = {}) {
|
|
487
500
|
const invite = parse_invite(input.invite, input);
|
|
488
|
-
const ai = check_ai(input);
|
|
501
|
+
const ai = check_ai(home, input);
|
|
489
502
|
const expires_at = lend_until(input.duration || '1h', deps.now?.() ?? Date.now());
|
|
490
503
|
// A conversation this computer's software already holds, picked to carry its context into the room.
|
|
491
504
|
const session_id = String(input.session_id || '');
|
|
@@ -746,7 +759,12 @@ export async function invited_command(home, action, input = {}, deps = {}) {
|
|
|
746
759
|
}
|
|
747
760
|
if (action === 'invited-join') return join_invite(home, input, deps);
|
|
748
761
|
if (action === 'invited-trust') return set_trust(home, input);
|
|
749
|
-
if (action === 'invited-ai') return change_record(home, id, (record, now, store) => {
|
|
762
|
+
if (action === 'invited-ai') return change_record(home, id, (record, now, store) => {
|
|
763
|
+
const ai = { ...record.ai, ...input };
|
|
764
|
+
if (input.adapter !== undefined && !adapter_profile(ai.adapter)?.service_tiers && input.service_tier === undefined) delete ai.service_tier;
|
|
765
|
+
record.ai = check_ai(home, ai);
|
|
766
|
+
return { record: record_view(record, store) };
|
|
767
|
+
});
|
|
750
768
|
if (action === 'invited-pause') return change_record(home, id, (record, now, store) => { record.paused = input.paused !== false; return { record: record_view(record, store) }; });
|
|
751
769
|
if (action === 'invited-approve') return approve(home, input);
|
|
752
770
|
if (action === 'invited-refuse') return refuse_approval(home, input, deps);
|
|
@@ -878,6 +896,7 @@ async function start_run(home, record, execution, { confined, software, end, res
|
|
|
878
896
|
// 不受限 means the AI works on this computer as usual (全放开): a sandbox would run its commands as another Windows
|
|
879
897
|
// account, which cannot open the record's credential (DPAPI, current user), so its `codiscuss` calls would all fail.
|
|
880
898
|
const profile = { adapter: record.ai.adapter, ...software, model: record.ai.model || software.model || '', effort: record.ai.effort, cwd: workdir, project_access: confined ? 'read' : 'full',
|
|
899
|
+
...(adapter_profile(record.ai.adapter)?.service_tiers ? { service_tier: record.ai.service_tier ?? '' } : {}),
|
|
881
900
|
// No own prompt, not even one left in an older record or in this software's local settings.
|
|
882
901
|
system_prompt: '' };
|
|
883
902
|
const log_path = join(base, `external-${execution.id}.log`);
|
|
@@ -1183,10 +1202,10 @@ function print_record(record) {
|
|
|
1183
1202
|
const HELP = () => t(`外部房间(本机 AI 作为外部成员参加另一台电脑上的房间)
|
|
1184
1203
|
|
|
1185
1204
|
用法:
|
|
1186
|
-
codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E] [--session 会话] [--duration 1h|today|3d]
|
|
1205
|
+
codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E] [--service-tier TIER] [--session 会话] [--duration 1h|today|3d]
|
|
1187
1206
|
codiscuss invited list
|
|
1188
1207
|
codiscuss invited trust ID auto|ask [--unconfined|--confined]
|
|
1189
|
-
codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E]
|
|
1208
|
+
codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E] [--service-tier TIER]
|
|
1190
1209
|
codiscuss invited pause ID | resume ID
|
|
1191
1210
|
codiscuss invited lend ID 1h|today|3d
|
|
1192
1211
|
codiscuss invited approve ID 待确认编号 | refuse ID 待确认编号
|
|
@@ -1199,7 +1218,7 @@ const HELP = () => t(`外部房间(本机 AI 作为外部成员参加另一台
|
|
|
1199
1218
|
借出时间:加入时用 --duration 选择(默认 1h),之后用 lend 从现在起重新计算,最长 3 天。
|
|
1200
1219
|
--session 续接这个软件已有的会话(带着原上下文加入)。
|
|
1201
1220
|
同意后由本机服务唤醒 AI,请保持 codiscuss 服务运行。加 --json 输出 JSON。
|
|
1202
|
-
`);
|
|
1221
|
+
`) + t('速度:--service-tier default(标准)、priority(Fast)或 ultrafast;用 --service-tier= 跟随软件,省略则保留。') + '\n';
|
|
1203
1222
|
|
|
1204
1223
|
const REPO_HELP = () => t(`只读查看任务授权的项目(本机受限只读任务或外部成员)
|
|
1205
1224
|
|
|
@@ -1218,7 +1237,7 @@ const REPO_HELP = () => t(`只读查看任务授权的项目(本机受限只
|
|
|
1218
1237
|
export async function external_main(command, args, { home, deps = {}, write = text => process.stdout.write(text), read_stdin = () => readFileSync(0, 'utf8') } = {}) {
|
|
1219
1238
|
const service = home || (await import('./discussion_service.mjs')).service_home();
|
|
1220
1239
|
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: {
|
|
1221
|
-
site: { type: 'string' }, machine: { type: 'string' }, adapter: { type: 'string' }, model: { type: 'string' }, effort: { type: 'string' },
|
|
1240
|
+
site: { type: 'string' }, machine: { type: 'string' }, adapter: { type: 'string' }, model: { type: 'string' }, effort: { type: 'string' }, 'service-tier': { type: 'string' },
|
|
1222
1241
|
session: { type: 'string' }, duration: { type: 'string' },
|
|
1223
1242
|
label: { type: 'string' }, json: { type: 'boolean' }, help: { type: 'boolean', short: 'h' },
|
|
1224
1243
|
unconfined: { type: 'boolean' }, confined: { type: 'boolean' },
|
|
@@ -1241,7 +1260,8 @@ export async function external_main(command, args, { home, deps = {}, write = te
|
|
|
1241
1260
|
return out(await repo_command(service, op, options, access, deps));
|
|
1242
1261
|
}
|
|
1243
1262
|
if (values.help || (command === 'invited' && !positionals.length) || (command === 'join' && !positionals.length)) return write(HELP());
|
|
1244
|
-
const ai = { ...(values.adapter ? { adapter: values.adapter } : {}), ...(values.model !== undefined ? { model: values.model } : {}),
|
|
1263
|
+
const ai = { ...(values.adapter ? { adapter: values.adapter } : {}), ...(values.model !== undefined ? { model: values.model } : {}),
|
|
1264
|
+
...(values.effort !== undefined ? { effort: values.effort } : {}), ...(values['service-tier'] !== undefined ? { service_tier: values['service-tier'] } : {}) };
|
|
1245
1265
|
let result;
|
|
1246
1266
|
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 } : {}), ...(values.duration ? { duration: values.duration } : {}), ...ai }, deps);
|
|
1247
1267
|
else {
|
package/runner/i18n_en.mjs
CHANGED
|
@@ -211,6 +211,7 @@ export default {
|
|
|
211
211
|
"标准速度": "Standard",
|
|
212
212
|
"所选软件不支持该速度档位": "The selected software does not support this speed tier",
|
|
213
213
|
"所选模型不支持该速度档位": "The selected model does not support this speed tier",
|
|
214
|
+
'速度:--service-tier default(标准)、priority(Fast)或 ultrafast;用 --service-tier= 跟随软件,省略则保留。': 'Speed: use --service-tier default (Standard), priority (Fast), or ultrafast. Use --service-tier= to follow the software, or omit the option to keep the current setting.',
|
|
214
215
|
"model --member M --service-tier T 可单独调速,不改模型或强度;invite --name 平台 --service-tier T 可指定新成员速度。支持时可填 default(standard)、priority(fast)、ultrafast;空值跟随软件。用 --list 查询支持范围。": "Use model --member M --service-tier T to change speed without changing the model or effort, and invite --name PLATFORM --service-tier T to set speed for a new member. Where supported, use default (standard), priority (fast), or ultrafast. An empty value follows the software. Use --list to see what is supported.",
|
|
215
216
|
"请回离开的成员会保留原配置,请去掉 --model、--effort 和 --service-tier;先请回,再用 host-control model 调整。": "Returning members keep their settings. Omit --model, --effort, and --service-tier, bring the member back, then make changes with host-control model.",
|
|
216
217
|
"须有一位本机唤醒的主持人才能指定 --host-service-tier。": "Setting --host-service-tier requires a locally launched host.",
|
|
@@ -426,7 +427,7 @@ export default {
|
|
|
426
427
|
'清空窗口对话:codiscuss steward clear --window main|private|CHANNEL:CHAT --confirm': 'Clear a window conversation: codiscuss steward clear --window main|private|CHANNEL:CHAT --confirm',
|
|
427
428
|
'清空 MOSS 对话前须用 --confirm 确认': 'Use --confirm to clear the MOSS conversation.',
|
|
428
429
|
'MOSS 私信': 'MOSS Direct messages',
|
|
429
|
-
'私信设置:codiscuss steward settings --private [--adapter ID --model MODEL --effort LEVEL --project-access read|auto --skills SKILL,...]': 'Direct messages settings: codiscuss steward settings --private [--adapter ID --model MODEL --effort LEVEL --project-access read|auto --skills SKILL,...]',
|
|
430
|
+
'私信设置:codiscuss steward settings --private [--adapter ID --model MODEL --effort LEVEL --service-tier TIER --project-access read|auto --skills SKILL,...]': 'Direct messages settings: codiscuss steward settings --private [--adapter ID --model MODEL --effort LEVEL --service-tier TIER --project-access read|auto --skills SKILL,...]',
|
|
430
431
|
'此窗口不能通过命令行更改本机平台。': 'This window cannot change the local platform through the command line.',
|
|
431
432
|
'当前 MOSS 软件不支持群窗口所需的工具收窄。': 'The selected MOSS software does not support the tool restrictions required for group windows.',
|
|
432
433
|
'群委托房间只能使用该房间的专用目录。': 'A group task room can use only its dedicated workspace.',
|
|
@@ -459,7 +460,7 @@ export default {
|
|
|
459
460
|
'只能删除已存档的 MOSS 房间': 'Only archived MOSS rooms can be deleted.',
|
|
460
461
|
'steward 查看、配置或请求MOSS': 'steward View, configure, or ask MOSS',
|
|
461
462
|
'--create-rooms 只能指定 on 或 off': '--create-rooms must be on or off',
|
|
462
|
-
'开始新会话:codiscuss steward renew [--window main|private|CHANNEL:CHAT] [--adapter ID] [--model MODEL] [--effort LEVEL]': 'Start a new session: codiscuss steward renew [--window main|private|CHANNEL:CHAT] [--adapter ID] [--model MODEL] [--effort LEVEL]',
|
|
463
|
+
'开始新会话:codiscuss steward renew [--window main|private|CHANNEL:CHAT] [--adapter ID] [--model MODEL] [--effort LEVEL] [--service-tier TIER]': 'Start a new session: codiscuss steward renew [--window main|private|CHANNEL:CHAT] [--adapter ID] [--model MODEL] [--effort LEVEL] [--service-tier TIER]',
|
|
463
464
|
'请先打开 MOSS 对话,再开始新会话': 'Open the MOSS conversation before starting a new session',
|
|
464
465
|
'你在本会话中的项目权限已从 {from} 改为 {to}(见任务文件的 project_access)。本会话里之前被拒或做不了的操作,按新权限重新判断,需要时直接再试。': 'Your project access in this session changed from {from} to {to} (see project_access in the task file). Judge anything refused or not possible earlier in this session again under the new access, and retry it when needed.',
|
|
465
466
|
'你在本会话中的项目权限已从 {from} 降为 {to}(见任务文件的 project_access)。本会话里之前能做的操作现在可能会被拒,按新权限重新判断。': 'Your project access in this session was lowered from {from} to {to} (see project_access in the task file). Operations that worked earlier in this session may now be refused; judge them again under the new access.',
|
|
@@ -487,7 +488,7 @@ export default {
|
|
|
487
488
|
'MOSS 只能向同站点未存档项目房间的主持人发消息': 'MOSS can only message hosts of unarchived project rooms on the same site',
|
|
488
489
|
'此房间无权执行操作 {action}': 'This room is not permitted to run {action}',
|
|
489
490
|
'MOSS 无权管理工作流': 'MOSS is not allowed to manage workflows',
|
|
490
|
-
'用法:codiscuss steward status | settings [--adapter ID --model MODEL --effort LEVEL --cwd DIR --skills SKILL,... --create-rooms on|off] | ask SKILL [--room ROOM --note TEXT --confirm] | history | delete ROOM --confirm': 'Usage: codiscuss steward status | settings [--adapter ID --model MODEL --effort LEVEL --cwd DIR --skills SKILL,... --create-rooms on|off] | ask SKILL [--room ROOM --note TEXT --confirm] | history | delete ROOM --confirm',
|
|
491
|
+
'用法:codiscuss steward status | settings [--adapter ID --model MODEL --effort LEVEL --service-tier TIER --cwd DIR --skills SKILL,... --create-rooms on|off] | ask SKILL [--room ROOM --note TEXT --confirm] | history | delete ROOM --confirm': 'Usage: codiscuss steward status | settings [--adapter ID --model MODEL --effort LEVEL --service-tier TIER --cwd DIR --skills SKILL,... --create-rooms on|off] | ask SKILL [--room ROOM --note TEXT --confirm] | history | delete ROOM --confirm',
|
|
491
492
|
"找不到所引用的通知,这条回复没有发回房间。": "The quoted notice was not found, so this reply was not sent to a room.",
|
|
492
493
|
"飞书": "Feishu",
|
|
493
494
|
"在飞书中打开与应用机器人的私聊,发送这组绑定码。": "Open a private chat with the app bot in Feishu and send this binding code.",
|
|
@@ -1299,7 +1300,7 @@ export default {
|
|
|
1299
1300
|
"{member} 的操作被本机权限规则拒绝,未提交本次回答": "An operation of {member} was refused by this computer's permission rules; no answer was submitted for this run",
|
|
1300
1301
|
"外部成员只能读本房间消息与概况、提交自己的回答": "An external member can only read this room's messages and overview and submit its own answer",
|
|
1301
1302
|
" 对方已结束你的成员资格({reason})": " The other side ended your membership ({reason})",
|
|
1302
|
-
"外部房间(本机 AI 作为外部成员参加另一台电脑上的房间)\n\n用法:\n codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E] [--session 会话] [--duration 1h|today|3d]\n codiscuss invited list\n codiscuss invited trust ID auto|ask [--unconfined|--confined]\n codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E]\n codiscuss invited pause ID | resume ID\n codiscuss invited lend ID 1h|today|3d\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借出时间:加入时用 --duration 选择(默认 1h),之后用 lend 从现在起重新计算,最长 3 天。\n--session 续接这个软件已有的会话(带着原上下文加入)。\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] [--duration 1h|today|3d]\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 lend ID 1h|today|3d\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 joins in read-only mode inside an empty workspace (public web allowed, no local project files); --unconfined lifts that so it can read/write local files and run commands.\nLoan time: choose it with --duration when joining (1h by default); lend later restarts it from now, three days at most.\n--session resumes a conversation this software already holds (joining with its context).\nThe local service wakes the AI after you approve; keep the codiscuss service running. Add --json for JSON output.\n",
|
|
1303
|
+
"外部房间(本机 AI 作为外部成员参加另一台电脑上的房间)\n\n用法:\n codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E] [--service-tier TIER] [--session 会话] [--duration 1h|today|3d]\n codiscuss invited list\n codiscuss invited trust ID auto|ask [--unconfined|--confined]\n codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E] [--service-tier TIER]\n codiscuss invited pause ID | resume ID\n codiscuss invited lend ID 1h|today|3d\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借出时间:加入时用 --duration 选择(默认 1h),之后用 lend 从现在起重新计算,最长 3 天。\n--session 续接这个软件已有的会话(带着原上下文加入)。\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] [--service-tier TIER] [--session SESSION] [--duration 1h|today|3d]\n codiscuss invited list\n codiscuss invited trust ID auto|ask [--unconfined|--confined]\n codiscuss invited ai ID [--adapter SOFTWARE] [--model M] [--effort E] [--service-tier TIER]\n codiscuss invited pause ID | resume ID\n codiscuss invited lend ID 1h|today|3d\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 joins in read-only mode inside an empty workspace (public web allowed, no local project files); --unconfined lifts that so it can read/write local files and run commands.\nLoan time: choose it with --duration when joining (1h by default); lend later restarts it from now, three days at most.\n--session resumes a conversation this software already holds (joining with its context).\nThe local service wakes the AI after you approve; keep the codiscuss service running. Add --json for JSON output.\n",
|
|
1303
1304
|
"只读查看任务授权的项目(本机受限只读任务或外部成员)\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 codiscuss repo pull 文件… --root N [--refresh]\n codiscuss repo rm 文件 --root N\n codiscuss repo status [--root N]\n凭据取自 --access-file 或 DISCUSS_ACCESS_FILE。\n": "Read authorized project files in a local restricted read-only task or as an external member\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]\n codiscuss repo pull FILE… --root N [--refresh]\n codiscuss repo rm FILE --root N\n codiscuss repo status [--root N]\nCredentials come from --access-file or DISCUSS_ACCESS_FILE.\n",
|
|
1304
1305
|
"用法:codiscuss repo ls | read | grep | pull | rm | status": "Usage: codiscuss repo ls | read | grep | pull | rm | status",
|
|
1305
1306
|
"用法:codiscuss repo rm 文件 --root N 或 codiscuss repo status [--root N]": "Usage: codiscuss repo rm FILE --root N or codiscuss repo status [--root N]",
|