ai_co_discuss 0.4.83 → 0.4.85
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/backend/external_members.py +36 -5
- package/backend/identity.py +12 -2
- package/backend/server.py +5 -1
- package/docs/en/runner.md +11 -13
- package/docs/runner.md +11 -13
- package/frontend/locales/en/external.json +42 -47
- package/frontend/locales/en/room.json +2 -0
- package/frontend/locales/en/settings.json +1 -0
- package/package.json +1 -1
- package/runner/account_space.mjs +41 -0
- package/runner/adapters/antigravity_cli.mjs +47 -3
- package/runner/adapters/cli.mjs +1 -1
- package/runner/adapters/profiles.mjs +2 -2
- package/runner/discussion_launch.mjs +9 -4
- package/runner/expert_prompts.mjs +1 -1
- package/runner/external_client.mjs +83 -48
- package/runner/i18n_en.mjs +11 -6
- package/runner/remote_launch.mjs +1 -1
- package/runner/remote_policy.mjs +0 -6
- package/web/app.js +8 -1
- package/web/backup.js +1 -1
- package/web/i18n.js +1 -1
- package/web/join.html +5 -6
- package/web/modern.css +1 -1
- package/web/modern.js +67 -65
|
@@ -60,6 +60,27 @@ function check_agy_shell(user_home) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
/** Whether a saved allow rule only runs codiscuss: `command(codiscuss …)`, optionally after this tool's old access prefix. */
|
|
64
|
+
function codiscuss_only(rule) {
|
|
65
|
+
const body = /^command\((.*)\)$/s.exec(String(rule))?.[1];
|
|
66
|
+
if (!body) return false;
|
|
67
|
+
const text = body.replace(/^regex:\^?/, '').replace(/^\(\\\$env:DISCUSS_ACCESS[^)]*\)\?/, '').replace(/^\$env:DISCUSS_ACCESS\s*=\s*'[^']*';\s*/, '');
|
|
68
|
+
return /^codiscuss/.test(text);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* What the user allowed agy in its global and outside-of-project settings beyond the codiscuss commands. A confined
|
|
73
|
+
* task (`tool_lockdown`) denies each of them in its own session, since a deny rule wins over an allow (agy's documented
|
|
74
|
+
* order: deny > ask > allow); the user's settings are left as they are.
|
|
75
|
+
*/
|
|
76
|
+
function agy_saved_grants(user_home) {
|
|
77
|
+
const cli = read_json(join(user_home, '.gemini', 'antigravity-cli', 'settings.json'));
|
|
78
|
+
const shared = read_json(join(user_home, '.gemini', 'config', 'config.json'));
|
|
79
|
+
const outside = read_json(join(user_home, '.gemini', 'config', 'projects', `${AGY_OUTSIDE_PROJECT}.json`));
|
|
80
|
+
return [...(cli.permissions?.allow || []), ...(shared.userSettings?.globalPermissionGrants?.allow || []),
|
|
81
|
+
...(outside.permissionGrants?.permissionGrants?.allow || [])].filter(rule => typeof rule === 'string' && !codiscuss_only(rule));
|
|
82
|
+
}
|
|
83
|
+
|
|
63
84
|
/**
|
|
64
85
|
* Skill folders agy loads by itself: its own folder and every entry in its global skills.json. agy shows the model these
|
|
65
86
|
* skills' paths, so a run must be able to read them (1.5.3 refuses reads outside the added directories); agy leaves ~/
|
|
@@ -202,6 +223,7 @@ function agy_folders(config, task, root) {
|
|
|
202
223
|
* directories this member may only read are protected whatever its own access.
|
|
203
224
|
*/
|
|
204
225
|
function agy_project_grants(config, task, folders, user_home) {
|
|
226
|
+
if (task.tool_lockdown) return agy_lockdown_grants(task, user_home);
|
|
205
227
|
const read_only = (task.extra_directories || []).filter(item => item.access === 'read').map(item => item.path);
|
|
206
228
|
const projects = [...new Set([project_directory(config), ...folders].filter(directory => directory && !same_path(directory, task.draft_directory)
|
|
207
229
|
&& !read_only.some(path => same_path(path, directory))))];
|
|
@@ -220,6 +242,24 @@ function agy_project_grants(config, task, folders, user_home) {
|
|
|
220
242
|
deny: [...new Set(protected_paths.map(write_rule)), ...(full ? [] : ['mcp(*)'])] };
|
|
221
243
|
}
|
|
222
244
|
|
|
245
|
+
/**
|
|
246
|
+
* A confined task: only the codiscuss commands and writing its drafts; its runtime folder, skills, `~/.gemini` and its
|
|
247
|
+
* empty working folder stay unwritable, MCP tools and web page reads are refused, and the member's project, the room's
|
|
248
|
+
* other directories and the owner's allowed tools are ignored, and what the user allowed agy for itself is denied here.
|
|
249
|
+
* On agy 1.5.12 (2026-11-19, Ref_外部软件通信.md §7 实测
|
|
250
|
+
* 记录) reads outside the workspace, other commands, run_workflow, subagents and swarm workers were all refused; web
|
|
251
|
+
* search has no rule and stays available.
|
|
252
|
+
*/
|
|
253
|
+
function agy_lockdown_grants(task, user_home) {
|
|
254
|
+
const write_rule = directory => `write_file(${resolve(directory).replaceAll('\\', '/')})`;
|
|
255
|
+
const protected_paths = [task.member_directory, ...task.skill_directories, ...agy_skill_directories(user_home), join(user_home, '.gemini')];
|
|
256
|
+
if (protected_paths.some(directory => within_directory(directory, task.draft_directory))) {
|
|
257
|
+
throw new Error('agy 草稿目录不能位于运行目录、技能或 .gemini 配置目录中,未交付任务');
|
|
258
|
+
}
|
|
259
|
+
return { allow: [agy_rule(), write_rule(task.draft_directory)],
|
|
260
|
+
deny: [...new Set([...protected_paths.map(write_rule), 'mcp(*)', 'read_url(*)', ...agy_saved_grants(user_home)])] };
|
|
261
|
+
}
|
|
262
|
+
|
|
223
263
|
/** Initialize Antigravity's hidden placeholder project once on CLI-only setups; never overwrite an existing file. */
|
|
224
264
|
function ensure_outside_project(root) {
|
|
225
265
|
const path = join(root, 'projects', `${AGY_OUTSIDE_PROJECT}.json`);
|
|
@@ -244,7 +284,8 @@ export function prepare_agy_project(config, binding, task, user_home = homedir()
|
|
|
244
284
|
if (record.session_id && record.session_id !== binding.session_id) throw new Error('agy 项目记录与会话绑定不符,未交付讨论任务');
|
|
245
285
|
check_agy_shell(user_home);
|
|
246
286
|
const root = join(user_home, '.gemini', 'config');
|
|
247
|
-
|
|
287
|
+
// A confined task opens no project: only its own working folder, which holds nothing of this computer.
|
|
288
|
+
const directories = task.tool_lockdown ? [] : agy_folders(config, task, root);
|
|
248
289
|
const grants = agy_project_grants(config, task, directories, user_home);
|
|
249
290
|
if (record.project_id && record.project_id !== AGY_OUTSIDE_PROJECT && !/^[a-f0-9-]{36}$/.test(record.project_id)) {
|
|
250
291
|
throw new Error('agy 项目记录无效,未交付讨论任务');
|
|
@@ -283,6 +324,7 @@ export function remove_agy_projects(directory, user_home = homedir()) {
|
|
|
283
324
|
|
|
284
325
|
/** Native agy arguments; an expert the owner chose to host keeps its own conversation's project and permissions. */
|
|
285
326
|
function invocation(config, binding, task, user_home) {
|
|
327
|
+
if (task.tool_lockdown && config.session_id) throw new Error('托管的已有会话沿用它自己的权限,无法收窄,未交付任务');
|
|
286
328
|
const project = config.session_id ? null : prepare_agy_project(config, binding, task, user_home);
|
|
287
329
|
const cwd = launch_directory(config, task);
|
|
288
330
|
const extra = (project ? project.directories : (task.extra_directories || []).map(item => item.path))
|
|
@@ -294,13 +336,15 @@ function invocation(config, binding, task, user_home) {
|
|
|
294
336
|
...added.flatMap(directory => ['--add-dir', directory])];
|
|
295
337
|
// Headless agy refuses `--mode auto` ("not available for this account", 1.4.10–1.4.11) though its interactive window
|
|
296
338
|
// offers it; 全放开 uses the flag its own denial message suggests on top of the open session grants.
|
|
297
|
-
args.push('--mode', 'accept-edits', ...(config.project_access === 'full' ? ['--dangerously-skip-permissions'] : []),
|
|
339
|
+
args.push('--mode', 'accept-edits', ...(config.project_access === 'full' && !task.tool_lockdown ? ['--dangerously-skip-permissions'] : []),
|
|
298
340
|
...(project ? ['--project', project.project_id, '--settings', project.settings_path] : []));
|
|
299
341
|
if (binding.session_id) args.push('--conversation', binding.session_id);
|
|
300
342
|
if (config.model) args.push('--model', config.model);
|
|
301
343
|
if (config.effort) args.push('--effort', config.effort);
|
|
302
344
|
args.push('-p', task.prompt);
|
|
303
|
-
|
|
345
|
+
// The codiscuss CLI is told it runs confined, so its file arguments may name only the drafts.
|
|
346
|
+
const env = task.tool_lockdown ? { CODISCUSS_TOOL_LOCKDOWN: '1', CODISCUSS_LOCKDOWN_DIRECTORY: task.draft_directory } : null;
|
|
347
|
+
return { args, ...(env ? { env } : {}), ...(project ? { on_session: project.bind } : {}) };
|
|
304
348
|
}
|
|
305
349
|
|
|
306
350
|
/** Consume only documented lifecycle events, and remember refused operations so the page can name and allow them. */
|
package/runner/adapters/cli.mjs
CHANGED
|
@@ -135,7 +135,7 @@ export async function cli_delivery(adapter, config, binding, task, spawn_process
|
|
|
135
135
|
const launch = () => {
|
|
136
136
|
const child = spawn_process(invocation.executable || config.executable, invocation.args, {
|
|
137
137
|
cwd: launch_directory(config, task), windowsHide: true, shell: false, stdio: ['pipe', 'pipe', 'pipe'],
|
|
138
|
-
env: { ...process.env, DISCUSS_ACCESS_FILE: task.access_path },
|
|
138
|
+
env: { ...process.env, ...(invocation.env || {}), DISCUSS_ACCESS_FILE: task.access_path },
|
|
139
139
|
});
|
|
140
140
|
tree_killable(child);
|
|
141
141
|
const state = monitor_cli(adapter, child, binding, task, restart);
|
|
@@ -126,8 +126,8 @@ export const ADAPTER_PROFILES = {
|
|
|
126
126
|
unsupported_hints: { auto: 'agy 只在交互窗口提供自动模式,后台运行(-p)不支持' },
|
|
127
127
|
// Only a conversation this tool created gets its session rules; an existing one keeps its own project and permissions.
|
|
128
128
|
client: 'antigravity', adopt: 'session', host_existing: false, own_project_when_bound: true, browse_sessions: true,
|
|
129
|
-
|
|
130
|
-
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, chat: true, capture: FINAL_REMARK, tool_lockdown:
|
|
129
|
+
// Confined by session rules that allow only the codiscuss commands and deny MCP and web reads (agy_lockdown_grants).
|
|
130
|
+
capabilities: { delivery: PROCESS, rewind: 'cut', project: true, access_env: true, chat: true, capture: FINAL_REMARK, tool_lockdown: true },
|
|
131
131
|
// A read-only agy session allows only codiscuss commands and headless agy ends the turn on a denied one; agy streams no
|
|
132
132
|
// thinking text, so without a word at each turning point the page cannot show how far it got.
|
|
133
133
|
task_rules: (cli, { runs_commands }) => (runs_commands ? ''
|
|
@@ -9,7 +9,7 @@ import { setTimeout as sleep } from 'node:timers/promises';
|
|
|
9
9
|
import { pathToFileURL } from 'node:url';
|
|
10
10
|
import { parseArgs } from 'node:util';
|
|
11
11
|
|
|
12
|
-
import { account_projects, account_space,
|
|
12
|
+
import { account_projects, account_space, create_or_restore_account_project, draft_folder, hide_account_projects, listed_account_projects } from './account_space.mjs';
|
|
13
13
|
import { atomic_json } from './files.mjs';
|
|
14
14
|
import { bundle_project_markdown, bundle_project_page, outside_directory, project_media, read_only_enforced, read_project_files, read_project_folders, room_directories, search_project_roots } from './project_files.mjs';
|
|
15
15
|
import { guard_remote_request, list_remote_directories, remote_allows, remote_roots } from './remote_policy.mjs';
|
|
@@ -677,7 +677,7 @@ const PROJECT_ID_PATTERN = /^[0-9a-f]{8,32}$/;
|
|
|
677
677
|
export function launch_projects(home) {
|
|
678
678
|
// An ordinary account's projects are the folders under its projects root; it keeps no list of its own.
|
|
679
679
|
const { projects_root } = account_space(home);
|
|
680
|
-
if (projects_root) return { projects:
|
|
680
|
+
if (projects_root) return { projects: listed_account_projects(home, projects_root), restricted: true };
|
|
681
681
|
const path = join(home, 'launch-projects.json');
|
|
682
682
|
return existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : { projects: [] };
|
|
683
683
|
}
|
|
@@ -687,8 +687,12 @@ export function launch_projects(home) {
|
|
|
687
687
|
export function save_launch_projects(home, input) {
|
|
688
688
|
const { projects_root } = account_space(home);
|
|
689
689
|
if (projects_root) {
|
|
690
|
-
if (
|
|
691
|
-
|
|
690
|
+
if (Array.isArray(input.remove)) {
|
|
691
|
+
hide_account_projects(home, projects_root, input.remove);
|
|
692
|
+
return launch_projects(home);
|
|
693
|
+
}
|
|
694
|
+
if (typeof input.create !== 'string') throw new Error('此账号的项目只能在自己的项目文件夹内新建或移除:请提供 create(项目名称)或 remove(项目编号列表)');
|
|
695
|
+
const created = create_or_restore_account_project(home, projects_root, input.create);
|
|
692
696
|
return { ...launch_projects(home), created };
|
|
693
697
|
}
|
|
694
698
|
if (!Array.isArray(input.projects)) throw new Error('projects 必须为列表');
|
|
@@ -2298,6 +2302,7 @@ function granted_projects(home) {
|
|
|
2298
2302
|
const { projects_root, workspace } = account_space(home);
|
|
2299
2303
|
if (!projects_root) return launch_projects(home).projects;
|
|
2300
2304
|
mkdirSync(workspace, { recursive: true });
|
|
2305
|
+
// Removed projects stay granted: removing only shortens the list, and rooms working there must keep running.
|
|
2301
2306
|
return [...account_projects(projects_root), { name: '草稿空间', path: workspace }];
|
|
2302
2307
|
}
|
|
2303
2308
|
|
|
@@ -97,7 +97,7 @@ export function external_task_text({ name, messages, requests = [], cli, access_
|
|
|
97
97
|
const instructions = `你作为外部成员参加另一台电脑上的房间,只读对方开放的项目,不修改任何文件。命令只用 subcommands 列出的 ${cli} 子命令。${limits}${reading}`;
|
|
98
98
|
const prompt = `${wake_opening(requests, name)}(来自另一台电脑上的房间),对应消息 ${messages}。${instructions}`
|
|
99
99
|
+ `用 ${cli} message view 消息编号${access} 看原文,${cli} room read${access} 看房间概况。`
|
|
100
|
-
+ `做完用 ${cli} message post --body-file 草稿${access} 提交一次回答(简短回答可用 --body "回答"
|
|
100
|
+
+ `做完用 ${cli} message post --body-file 草稿${access} 提交一次回答(简短回答可用 --body "回答")。房间按 Markdown 显示回答,内容较多时用分段、标题或列表排版。先读任务文件 ${task_path} 与其中列出的技能。`;
|
|
101
101
|
return { instructions, prompt };
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -19,15 +19,14 @@ import { external_task_text, TASK_SUBCOMMANDS } from './expert_prompts.mjs';
|
|
|
19
19
|
import { atomic_json } from './files.mjs';
|
|
20
20
|
import { t } from './i18n.mjs';
|
|
21
21
|
|
|
22
|
-
export const
|
|
22
|
+
export const WAKES = ['auto', 'ask'];
|
|
23
|
+
// The single level records had before `wake` and `confined`, still accepted by `invited-trust` as a shorthand.
|
|
24
|
+
const LEGACY_TRUST = { default: { wake: 'ask', confined: true }, borrow: { wake: 'auto', confined: true }, trusted: { wake: 'auto', confined: false } };
|
|
23
25
|
export const APPROVAL_TIMEOUT_MS = 15 * 60000;
|
|
24
26
|
export const POLL_MS = 5000;
|
|
25
27
|
// The inviting room fails an execution whose lease lapses; renew it as the room runner does.
|
|
26
28
|
export const RENEW_MS = 30000;
|
|
27
29
|
// What “完全借用” allows when the owner sets no limit of their own.
|
|
28
|
-
export const BORROW_DEFAULTS = { max_wakes: 20, hours: 24 };
|
|
29
|
-
const MAX_WAKES_LIMIT = 1000;
|
|
30
|
-
const MAX_HOURS = 720;
|
|
31
30
|
const HISTORY_LIMIT = 50;
|
|
32
31
|
const MODEL_LIMIT = 120;
|
|
33
32
|
// What this computer keeps of each request its AI received and each answer it gave, so the history still reads after the
|
|
@@ -35,7 +34,6 @@ const MODEL_LIMIT = 120;
|
|
|
35
34
|
const TEXT_LIMIT = 4000;
|
|
36
35
|
// 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.
|
|
37
36
|
const VIEW_REFRESH_MS = 60000;
|
|
38
|
-
const HOUR_MS = 3600000;
|
|
39
37
|
// The website gives up on a relayed request after 9 seconds; ask for an answer within that.
|
|
40
38
|
const RELAY_WAIT_MS = 8000;
|
|
41
39
|
const REQUEST_TIMEOUT_MS = 15000;
|
|
@@ -50,6 +48,8 @@ const SECRETS_FILE = 'secrets.json';
|
|
|
50
48
|
const LOCK_FILE = 'invited.lock';
|
|
51
49
|
const LOCK_WAIT_MS = 3000;
|
|
52
50
|
const LOCK_STALE_MS = 10000;
|
|
51
|
+
// Under the external home, one folder per record in each.
|
|
52
|
+
const RUN_FOLDERS = ['runtime', 'work', 'drafts'];
|
|
53
53
|
const CODE_PATTERN = /^[0-9A-Z]{12}$/;
|
|
54
54
|
const HEX32 = /^[0-9a-f]{32}$/;
|
|
55
55
|
const RECORD_ID = /^[0-9a-f]{16}$/;
|
|
@@ -153,12 +153,21 @@ function with_store(home, task) {
|
|
|
153
153
|
} finally { rmSync(lock, { force: true }); }
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/**
|
|
157
|
+
* How a record treats being named, `{wake, confined}`: `wake` is `auto` (start at once) or
|
|
158
|
+
* `ask` (wait for the owner), `confined` whether the AI may run only the codiscuss commands. Each record keeps its own;
|
|
159
|
+
* one joined before these two settings follows the level its inviting computer had (default / borrow / trusted).
|
|
160
|
+
*/
|
|
161
|
+
function record_settings(record, store) {
|
|
162
|
+
if (WAKES.includes(record.wake)) return { wake: record.wake, confined: record.confined !== false };
|
|
163
|
+
return LEGACY_TRUST[store.machines[record.machine_fingerprint]?.trust] || LEGACY_TRUST.default;
|
|
164
|
+
}
|
|
165
|
+
|
|
156
166
|
/** A record as every command shows it: no key, no credential. */
|
|
157
167
|
export function record_view(record, store) {
|
|
158
|
-
const
|
|
159
|
-
const trust = TRUST_LEVELS.includes(machine.trust) ? machine.trust : 'default';
|
|
168
|
+
const settings = record_settings(record, store);
|
|
160
169
|
const { session_id, machine_key, ai_reported, ...shown } = record;
|
|
161
|
-
return { ...shown,
|
|
170
|
+
return { ...shown, ...settings, lockdown: settings.confined, approvals: (record.approvals || []).filter(item => item.status === 'waiting') };
|
|
162
171
|
}
|
|
163
172
|
|
|
164
173
|
function find_record(store, id) {
|
|
@@ -437,13 +446,15 @@ export async function join_invite(home, input, deps = {}) {
|
|
|
437
446
|
return with_store(home, (store, secrets, now) => {
|
|
438
447
|
const id = attempt.id;
|
|
439
448
|
const name = joined.machine?.name || keys.name || invite.machine_name;
|
|
440
|
-
|
|
449
|
+
// Accepting the invitation is the consent: a new record answers at once, confined.
|
|
450
|
+
const machine = store.machines[keys.fingerprint] ||= {};
|
|
441
451
|
Object.assign(machine, { machine: keys.id, site: invite.site, machine_name: name, updated_at: now });
|
|
442
452
|
store.records[id] = { id, site: invite.site, machine: keys.id, machine_name: name, machine_fingerprint: keys.fingerprint,
|
|
443
453
|
machine_key: keys.public_key, fingerprint_checked: Boolean(invite.fingerprint), room: joined.room.id, room_title: String(joined.room.name || invite.room_name),
|
|
444
454
|
member: joined.member.name, member_id: joined.member.id ?? null, key_id, open_level: joined.level || invite.level || 'read',
|
|
445
455
|
directories: Array.isArray(joined.directories) ? joined.directories : [],
|
|
446
|
-
expires_at: Number(joined.expires_at) ? Number(joined.expires_at) * 1000 : null, ai, ai_reported: JSON.stringify(identity),
|
|
456
|
+
expires_at: Number(joined.expires_at) ? Number(joined.expires_at) * 1000 : null, ai, ai_reported: JSON.stringify(identity), wake: 'auto', confined: true,
|
|
457
|
+
limits: null, wakes: 0, last_wake_at: null, paused: false,
|
|
447
458
|
status: 'active', contact: { at: now, state: 'online', error: '' }, approvals: [], history: [], running: null, joined_at: now };
|
|
448
459
|
secrets.get()[id] = { private_key: pair.private_key, token: joined.token };
|
|
449
460
|
secrets.changed = true;
|
|
@@ -451,34 +462,25 @@ export async function join_invite(home, input, deps = {}) {
|
|
|
451
462
|
});
|
|
452
463
|
}
|
|
453
464
|
|
|
454
|
-
function bounded(value, max, label) {
|
|
455
|
-
const number = Number(value);
|
|
456
|
-
if (!Number.isInteger(number) || number < 1 || number > max) throw failure('invalid_number', '{label} 须为 1–{max} 的整数', { label, max });
|
|
457
|
-
return number;
|
|
458
|
-
}
|
|
459
465
|
|
|
460
|
-
/**
|
|
461
|
-
|
|
462
|
-
|
|
466
|
+
/**
|
|
467
|
+
* Set how this record treats being named: `wake` (auto / ask) and `confined`, either of which may be left out, or the old
|
|
468
|
+
* single `trust` level. Answering at once has no wake count or time limit (2026-11-19, user); any a record had is dropped.
|
|
469
|
+
*/
|
|
470
|
+
export function set_trust(home, { id, trust, wake, confined }) {
|
|
471
|
+
if (trust !== undefined && !LEGACY_TRUST[trust]) throw failure('invalid_trust', '信任等级只能是 default、borrow 或 trusted');
|
|
472
|
+
if (wake !== undefined && !WAKES.includes(wake)) throw failure('invalid_wake', '被点名时只能是 auto 或 ask');
|
|
473
|
+
const chosen = trust !== undefined ? LEGACY_TRUST[trust] : { wake, confined: confined === undefined ? undefined : confined !== false && confined !== 'false' };
|
|
463
474
|
return change_record(home, id, (record, now, store) => {
|
|
464
|
-
const
|
|
465
|
-
Object.assign(
|
|
466
|
-
if (trust === 'borrow') {
|
|
467
|
-
const limit = max_wakes === undefined ? record.limits?.max_wakes ?? BORROW_DEFAULTS.max_wakes : bounded(max_wakes, MAX_WAKES_LIMIT, 'max_wakes');
|
|
468
|
-
const end = until !== undefined ? Number(until) : hours !== undefined ? now + bounded(hours, MAX_HOURS, 'hours') * HOUR_MS
|
|
469
|
-
: record.limits?.until > now ? record.limits.until : now + BORROW_DEFAULTS.hours * HOUR_MS;
|
|
470
|
-
if (!Number.isFinite(end) || end <= now) throw failure('invalid_deadline', '借用期限须晚于现在');
|
|
471
|
-
record.limits = { max_wakes: limit, until: end, used: 0 };
|
|
472
|
-
}
|
|
475
|
+
const current = record_settings(record, store);
|
|
476
|
+
Object.assign(record, { wake: chosen.wake ?? current.wake, confined: chosen.confined ?? current.confined, limits: null });
|
|
473
477
|
return { record: record_view(record, store) };
|
|
474
478
|
});
|
|
475
479
|
}
|
|
476
480
|
|
|
477
|
-
/** Whether a request may wake the AI without asking:
|
|
478
|
-
export function wakes_directly(record, store
|
|
479
|
-
|
|
480
|
-
if (trust === 'trusted') return true;
|
|
481
|
-
return trust === 'borrow' && Boolean(record.limits) && record.limits.used < record.limits.max_wakes && record.limits.until > now;
|
|
481
|
+
/** Whether a request may wake the AI without asking: the record answers at once. */
|
|
482
|
+
export function wakes_directly(record, store) {
|
|
483
|
+
return record_settings(record, store).wake === 'auto';
|
|
482
484
|
}
|
|
483
485
|
|
|
484
486
|
/**
|
|
@@ -565,6 +567,29 @@ async function deliver_leave(home, id, deps = {}) {
|
|
|
565
567
|
return { leave_pending: false };
|
|
566
568
|
}
|
|
567
569
|
|
|
570
|
+
/**
|
|
571
|
+
* Delete an ended or left record from this computer: its history, key, credential and run files. Nothing is sent to the
|
|
572
|
+
* inviting room, and the trust given to that computer stays, since it covers all of that computer's rooms.
|
|
573
|
+
*/
|
|
574
|
+
export function remove_record(home, { id }, deps = {}) {
|
|
575
|
+
const record = with_store(home, (store, secrets) => {
|
|
576
|
+
const found = find_record(store, id);
|
|
577
|
+
if (found.status === 'active') throw failure('record_active', '这个房间还在进行中,请先退出再删除记录');
|
|
578
|
+
if (found.leave_pending) throw failure('leave_pending', '退出通知还没送达对方电脑,送达后才能删除记录');
|
|
579
|
+
delete store.records[found.id];
|
|
580
|
+
forget_keys(secrets, found.id);
|
|
581
|
+
return found;
|
|
582
|
+
});
|
|
583
|
+
// A run still going keeps its folders; they are only leftovers, so one that cannot be removed does not fail the delete.
|
|
584
|
+
if (!record.running) {
|
|
585
|
+
for (const folder of RUN_FOLDERS) {
|
|
586
|
+
try { rmSync(join(external_home(home), folder, record.id), { recursive: true, force: true }); }
|
|
587
|
+
catch (error) { deps.log?.(error.message); }
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return { removed: record.id };
|
|
591
|
+
}
|
|
592
|
+
|
|
568
593
|
/** Keep the record in line with what the inviting room grants now (`/view` `me`): level, deadline and opened directories. */
|
|
569
594
|
function apply_grant(home, id, me, now = Date.now()) {
|
|
570
595
|
if (!me || typeof me !== 'object') return;
|
|
@@ -596,15 +621,19 @@ function kept_messages(record) {
|
|
|
596
621
|
}
|
|
597
622
|
|
|
598
623
|
/** The record with what the inviting room shows this member, when it can be reached. */
|
|
599
|
-
export async function room_view(home, { id }, deps = {}) {
|
|
624
|
+
export async function room_view(home, { id, cached = false }, deps = {}) {
|
|
600
625
|
const record = find_record(read_store(home), id);
|
|
626
|
+
// What this computer already knows, without the network: the page shows it at once while the real read is under way.
|
|
627
|
+
if (cached) return { record: record_view(record, read_store(home)), room: null, messages: kept_messages(record) };
|
|
601
628
|
let room = null, problem = null;
|
|
602
629
|
let messages = [];
|
|
603
630
|
try {
|
|
604
|
-
|
|
605
|
-
//
|
|
631
|
+
// What the page shows in the middle: requests naming this AI and this AI's own answers, oldest first. Sent together,
|
|
632
|
+
// since each one crosses the relay and in turn they outlast the page's refresh.
|
|
606
633
|
const query = field => `${MEMBER_API.messages(record.room)}?${new URLSearchParams({ [field]: record.member })}`;
|
|
607
|
-
const pages = await Promise.all([
|
|
634
|
+
const [view, ...pages] = await Promise.all([refresh_grant(home, id, deps),
|
|
635
|
+
...['mention', 'author'].map(field => member_api(home, id, 'GET', query(field), undefined, deps))]);
|
|
636
|
+
room = view;
|
|
608
637
|
const unique = new Map(pages.flatMap(page => page.messages || []).map(message => [message.id, message]));
|
|
609
638
|
messages = [...unique.values()].sort((a, b) => a.id - b.id);
|
|
610
639
|
} catch (error) { problem = error; messages = kept_messages(record); }
|
|
@@ -623,7 +652,7 @@ export async function invited_command(home, action, input = {}, deps = {}) {
|
|
|
623
652
|
if (action === 'invited-list') {
|
|
624
653
|
const store = read_store(home);
|
|
625
654
|
return { records: Object.values(store.records).map(record => record_view(record, store)).sort((a, b) => b.joined_at - a.joined_at),
|
|
626
|
-
machines: Object.entries(store.machines).map(([fingerprint, item]) => ({ fingerprint,
|
|
655
|
+
machines: Object.entries(store.machines).map(([fingerprint, item]) => ({ fingerprint, machine_name: item.machine_name || '', site: item.site || '' })) };
|
|
627
656
|
}
|
|
628
657
|
if (action === 'invited-join') return join_invite(home, input, deps);
|
|
629
658
|
if (action === 'invited-trust') return set_trust(home, input);
|
|
@@ -632,12 +661,13 @@ export async function invited_command(home, action, input = {}, deps = {}) {
|
|
|
632
661
|
if (action === 'invited-approve') return approve(home, input);
|
|
633
662
|
if (action === 'invited-refuse') return refuse_approval(home, input, deps);
|
|
634
663
|
if (action === 'invited-leave') return leave(home, input, deps);
|
|
664
|
+
if (action === 'invited-remove') return remove_record(home, input, deps);
|
|
635
665
|
if (action === 'invited-room') return room_view(home, input, deps);
|
|
636
666
|
throw failure('unknown_action', '未知的被邀请记录操作:{action}', { action });
|
|
637
667
|
}
|
|
638
668
|
|
|
639
669
|
export const INVITED_ACTIONS = new Set(['invited-list', 'invited-join', 'invited-trust', 'invited-ai', 'invited-pause', 'invited-approve',
|
|
640
|
-
'invited-refuse', 'invited-leave', 'invited-room']);
|
|
670
|
+
'invited-refuse', 'invited-leave', 'invited-remove', 'invited-room']);
|
|
641
671
|
|
|
642
672
|
// ---- Pulling and waking (in the service) ----
|
|
643
673
|
|
|
@@ -980,13 +1010,11 @@ function load_access(path) {
|
|
|
980
1010
|
const integer = value => value === undefined ? undefined : Number(value);
|
|
981
1011
|
|
|
982
1012
|
function print_record(record) {
|
|
983
|
-
const
|
|
1013
|
+
const wake = record.wake === 'ask' ? t('先问我') : t('直接回答');
|
|
1014
|
+
const scope = record.confined ? t('只在房间里发言') : t('不受限');
|
|
984
1015
|
const contact = { online: t('在线'), offline: t('不在线'), error: t('出错'), unknown: t('未知') }[record.contact?.state || 'unknown'];
|
|
985
1016
|
const lines = [t('{id} {room}({site})成员 {member}', { id: record.id, room: record.room_title || record.room, site: record.site, member: record.member }),
|
|
986
|
-
t('
|
|
987
|
-
if (record.trust === 'borrow' && record.limits) {
|
|
988
|
-
lines.push(t(' 借用上限:{used}/{max} 次,至 {until}', { used: record.limits.used, max: record.limits.max_wakes, until: new Date(record.limits.until).toLocaleString() }));
|
|
989
|
-
}
|
|
1017
|
+
t(' 被点名时:{wake};在这台电脑上:{scope};已唤醒 {wakes} 次;对方电脑:{contact}{paused}', { wake, scope, wakes: record.wakes, contact, paused: record.paused ? t(';已暂停') : '' })];
|
|
990
1018
|
for (const item of record.approvals) lines.push(t(' 待确认 {approval}:消息 {messages}', { approval: item.id, messages: item.message_ids.map(n => `#${n}`).join(', ') }));
|
|
991
1019
|
if (record.status === 'left') lines.push(t(' 已退出'));
|
|
992
1020
|
if (record.status === 'ended') lines.push(t(' 对方已结束你的成员资格({reason})', { reason: record.end_reason }));
|
|
@@ -998,14 +1026,16 @@ const HELP = () => t(`被邀请的房间(本机 AI 作为外部成员参加另
|
|
|
998
1026
|
用法:
|
|
999
1027
|
codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E]
|
|
1000
1028
|
codiscuss invited list
|
|
1001
|
-
codiscuss invited trust ID
|
|
1029
|
+
codiscuss invited trust ID auto|ask [--unconfined|--confined]
|
|
1002
1030
|
codiscuss invited ai ID [--adapter 软件] [--model M] [--effort E]
|
|
1003
1031
|
codiscuss invited pause ID | resume ID
|
|
1004
1032
|
codiscuss invited approve ID 待确认编号 | refuse ID 待确认编号
|
|
1005
1033
|
codiscuss invited leave ID
|
|
1034
|
+
codiscuss invited remove ID
|
|
1006
1035
|
codiscuss invited room ID
|
|
1007
1036
|
|
|
1008
|
-
|
|
1037
|
+
被点名时:auto 直接回答;ask 每次先问你。
|
|
1038
|
+
在这台电脑上:默认只在房间里发言(只能运行共议命令);--unconfined 不受限,可读本机文件、联网。
|
|
1009
1039
|
同意后由本机服务唤醒 AI,请保持 codiscuss 服务运行。加 --json 输出 JSON。
|
|
1010
1040
|
`);
|
|
1011
1041
|
|
|
@@ -1024,7 +1054,8 @@ export async function external_main(command, args, { home, deps = {}, write = te
|
|
|
1024
1054
|
const service = home || (await import('./discussion_service.mjs')).service_home();
|
|
1025
1055
|
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: {
|
|
1026
1056
|
site: { type: 'string' }, machine: { type: 'string' }, adapter: { type: 'string' }, model: { type: 'string' }, effort: { type: 'string' },
|
|
1027
|
-
label: { type: 'string' },
|
|
1057
|
+
label: { type: 'string' }, json: { type: 'boolean' }, help: { type: 'boolean', short: 'h' },
|
|
1058
|
+
unconfined: { type: 'boolean' }, confined: { type: 'boolean' },
|
|
1028
1059
|
'access-file': { type: 'string' }, root: { type: 'string' }, offset: { type: 'string' }, limit: { type: 'string' }, 'max-bytes': { type: 'string' },
|
|
1029
1060
|
path: { type: 'string' }, 'case-sensitive': { type: 'boolean' }, 'max-results': { type: 'string' },
|
|
1030
1061
|
} });
|
|
@@ -1046,13 +1077,17 @@ export async function external_main(command, args, { home, deps = {}, write = te
|
|
|
1046
1077
|
else {
|
|
1047
1078
|
const [verb, id, extra] = positionals;
|
|
1048
1079
|
const action = { list: 'invited-list', trust: 'invited-trust', ai: 'invited-ai', pause: 'invited-pause', resume: 'invited-pause', approve: 'invited-approve',
|
|
1049
|
-
refuse: 'invited-refuse', leave: 'invited-leave', room: 'invited-room' }[verb];
|
|
1080
|
+
refuse: 'invited-refuse', leave: 'invited-leave', remove: 'invited-remove', room: 'invited-room' }[verb];
|
|
1050
1081
|
if (!action) return write(HELP());
|
|
1051
|
-
|
|
1082
|
+
// `trust ID auto|ask` sets how it answers; the old single levels (default / borrow / trusted) are still understood.
|
|
1083
|
+
const setting = !extra ? {} : LEGACY_TRUST[extra] ? { trust: extra } : { wake: extra };
|
|
1084
|
+
const scope = values.unconfined ? { confined: false } : values.confined ? { confined: true } : {};
|
|
1085
|
+
const input = { id, ...(verb === 'trust' ? { ...setting, ...scope } : {}),
|
|
1052
1086
|
...(verb === 'ai' ? ai : {}), ...(['pause', 'resume'].includes(verb) ? { paused: verb === 'pause' } : {}), ...(['approve', 'refuse'].includes(verb) ? { approval: extra } : {}) };
|
|
1053
1087
|
result = await invited_command(service, action, input, deps);
|
|
1054
1088
|
}
|
|
1055
1089
|
if (values.json) return out(result);
|
|
1056
1090
|
if (result.records) return write(`${result.records.length ? result.records.map(print_record).join('\n') : t('还没有被邀请的房间')}\n`);
|
|
1091
|
+
if (result.removed) return write(`${t('已删除这条被邀请记录')}\n`);
|
|
1057
1092
|
return write(`${print_record(result.record)}${result.record?.leave_pending ? `\n${t('暂时连不上对方电脑,常驻服务会继续通知它;通知送达或成员资格到期后删除本机密钥')}` : ''}${result.error ? `\n${t('读不到对方房间:{reason}', { reason: result.error })}` : ''}\n`);
|
|
1058
1093
|
}
|
package/runner/i18n_en.mjs
CHANGED
|
@@ -444,9 +444,16 @@ export default {
|
|
|
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
446
|
"已退出这个被邀请的房间": "You have left this invited room",
|
|
447
|
+
"这个房间还在进行中,请先退出再删除记录": "This room is still active. Leave it before deleting the record",
|
|
448
|
+
"退出通知还没送达对方电脑,送达后才能删除记录": "The other computer hasn't received your leave notice yet. You can delete the record once it arrives",
|
|
449
|
+
"已删除这条被邀请记录": "Deleted this invited room record",
|
|
447
450
|
"用法:codiscuss repo ls [目录] | read 文件 | grep 关键词": "Usage: codiscuss repo ls [directory] | read FILE | grep KEYWORD",
|
|
448
451
|
"读取被拒绝": "Reading was refused",
|
|
449
|
-
"
|
|
452
|
+
"先问我": "Ask me",
|
|
453
|
+
"直接回答": "Answer at once",
|
|
454
|
+
"只在房间里发言": "Room only",
|
|
455
|
+
"不受限": "Unrestricted",
|
|
456
|
+
"被点名时只能是 auto 或 ask": "When named must be auto or ask",
|
|
450
457
|
"完全借用": "Full borrowing",
|
|
451
458
|
"信任设备": "Trusted device",
|
|
452
459
|
"在线": "online",
|
|
@@ -454,9 +461,8 @@ export default {
|
|
|
454
461
|
"出错": "error",
|
|
455
462
|
"未知": "unknown",
|
|
456
463
|
"{id} {room}({site})成员 {member}": "{id} {room} ({site}) member {member}",
|
|
457
|
-
"
|
|
464
|
+
" 被点名时:{wake};在这台电脑上:{scope};已唤醒 {wakes} 次;对方电脑:{contact}{paused}": " When named: {wake}; on this computer: {scope}; woken {wakes} times; other computer: {contact}{paused}",
|
|
458
465
|
";已暂停": "; paused",
|
|
459
|
-
" 借用上限:{used}/{max} 次,至 {until}": " Borrowing limit: {used}/{max} wake-ups, until {until}",
|
|
460
466
|
" 待确认 {approval}:消息 {messages}": " Pending {approval}: messages {messages}",
|
|
461
467
|
" 已退出": " Left",
|
|
462
468
|
"还没有被邀请的房间": "No invited rooms yet",
|
|
@@ -517,12 +523,11 @@ export default {
|
|
|
517
523
|
"{member} 会话已结束,但未提交本次回答": "{member}'s session ended without submitting an answer for this run",
|
|
518
524
|
"外部成员只能读本房间消息与概况、提交自己的回答": "An external member can only read this room's messages and overview and submit its own answer",
|
|
519
525
|
" 对方已结束你的成员资格({reason})": " The other side ended your membership ({reason})",
|
|
520
|
-
"被邀请的房间(本机 AI 作为外部成员参加另一台电脑上的房间)\n\n用法:\n codiscuss join <链接|配对码> [--site 站点] [--machine 电脑编号] --adapter 软件 [--model M] [--effort E]\n codiscuss invited list\n codiscuss invited trust ID
|
|
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",
|
|
521
527
|
"只读查看对方电脑开放的项目(仅外部成员的任务中可用)\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",
|
|
522
528
|
"本次运行已收窄,不能使用 launch image(它会读取本机文件)": "This run is restricted and cannot use launch image (it reads local files)",
|
|
523
529
|
"本次运行已收窄,不能从标准输入读取;请先把内容写进草稿目录,再用文件参数传入": "This run is restricted and cannot read standard input; write the content in the draft folder and pass its path",
|
|
524
530
|
"本次运行已收窄,只能读取草稿目录 {folder} 里的文件": "This run is restricted and can read files only in its draft folder {folder}",
|
|
525
531
|
"外部成员只能派命令行软件(如 Claude Code)或模型 API": "An external member must be command-line software (such as Claude Code) or a model API",
|
|
526
|
-
"这台电脑还没有配置 {adapter}": "This computer has not configured {adapter}"
|
|
527
|
-
"“信任设备”只能在这台电脑上设置;其他设备可以改回“默认”或“完全借用”": "“Trusted device” can only be set on this computer. Other devices can switch back to “Default” or “Full borrowing”"
|
|
532
|
+
"这台电脑还没有配置 {adapter}": "This computer has not configured {adapter}"
|
|
528
533
|
};
|
package/runner/remote_launch.mjs
CHANGED
|
@@ -32,7 +32,7 @@ const LAUNCH_SCRIPT = fileURLToPath(new URL('./discussion_launch.mjs', import.me
|
|
|
32
32
|
export const RELAYED_ACTIONS = new Set(['settings', 'launch', 'room-models', 'room-member', 'room-member-access', 'room-member-allow', 'room-member-adapter',
|
|
33
33
|
'room-member-model', 'room-profiles', 'room-skills', 'room-files', 'room-page', 'room-media', 'execution-details', 'room-restore', 'room-fork', 'models', 'sessions', 'api-key', 'api-check', 'scheduler-check', 'image-settings', 'tts-settings', 'tts', 'tts-release', 'local-speech', 'stt', 'weixin', 'projects', 'presets', 'workflows', 'room-workflow', 'room-settings', 'browse-directory', 'room-invite', 'room-invites', 'room-invite-revoke',
|
|
34
34
|
// Rooms on other computers this one was invited to (runner/external_client.mjs): its paired devices manage them as here.
|
|
35
|
-
'invited-list', 'invited-join', 'invited-trust', 'invited-ai', 'invited-pause', 'invited-approve', 'invited-refuse', 'invited-leave', 'invited-room']);
|
|
35
|
+
'invited-list', 'invited-join', 'invited-trust', 'invited-ai', 'invited-pause', 'invited-approve', 'invited-refuse', 'invited-leave', 'invited-remove', 'invited-room']);
|
|
36
36
|
export const ROOM_ACTIONS = new Set(['launch', 'room-models', 'room-member', 'room-member-access', 'room-member-allow', 'room-member-adapter',
|
|
37
37
|
'room-member-model', 'room-profiles', 'room-skills', 'room-files', 'room-page', 'room-media', 'execution-details', 'room-restore', 'room-fork', 'room-workflow', 'room-settings', 'workflows',
|
|
38
38
|
// Invites to members on other computers: paired devices issue them as this computer does (PLAN §4.2 item 1).
|
package/runner/remote_policy.mjs
CHANGED
|
@@ -105,12 +105,6 @@ export function guard_remote_request(command, input, { projects, participants, h
|
|
|
105
105
|
});
|
|
106
106
|
// Joining a room on another computer from afar contacts only a public HTTPS site, never this computer's own network.
|
|
107
107
|
if (command === 'invited-join') remote_invite_site(input);
|
|
108
|
-
// 信任设备 lifts this computer's guard on the invited AI for good, so, like 全放开 as a default, it is set only here
|
|
109
|
-
// (DESIGN D6a); going back to 默认 or 完全借用 is allowed from afar.
|
|
110
|
-
if (['invited-trust', 'invited-join'].includes(command) && input.trust === 'trusted') {
|
|
111
|
-
const template = '“信任设备”只能在这台电脑上设置;其他设备可以改回“默认”或“完全借用”';
|
|
112
|
-
throw Object.assign(new Error(t(template)), { error_text: { template, params: {} }, code: 'trusted_local_only' });
|
|
113
|
-
}
|
|
114
108
|
// A saved project only widens what other devices reach, so a new or moved one must already lie inside the old ones.
|
|
115
109
|
if (command === 'projects' && Array.isArray(input.projects)) {
|
|
116
110
|
const existing = new Map((projects || []).map(project => [project.id, project.path]));
|
package/web/app.js
CHANGED
|
@@ -4948,6 +4948,13 @@ async function create_launch_project(name) {
|
|
|
4948
4948
|
return result.created;
|
|
4949
4949
|
}
|
|
4950
4950
|
|
|
4951
|
+
/** Take projects off an ordinary account's list; their folders and files stay on the computer. */
|
|
4952
|
+
async function remove_launch_projects(ids) {
|
|
4953
|
+
const result = await local_launch_request("projects", { remove: ids });
|
|
4954
|
+
state.launch.projects = result.projects;
|
|
4955
|
+
publish_view();
|
|
4956
|
+
}
|
|
4957
|
+
|
|
4951
4958
|
/** Save machine defaults without per-discussion session IDs or project write access. */
|
|
4952
4959
|
async function save_launch_defaults() {
|
|
4953
4960
|
// Defaults are per platform; an extra instance's model and effort apply to its own discussion only.
|
|
@@ -6440,7 +6447,7 @@ function change_view_theme(theme) {
|
|
|
6440
6447
|
|
|
6441
6448
|
window.discuss_view = { snapshot: view_snapshot, write_field: write_view_field, write_create_preferences, notify, load_decision_input, upload_progress,
|
|
6442
6449
|
write_launch: write_launch_field, default_launch_entry, platform_configured, description_template, save_description_template, description_draft, write_description_draft, describe_member, set_chain_rounds, continue_chain, expert_presets, apply_expert_preset, unique_instance, member_label, default_name, label_draft, write_label_draft, preset_identity, save_expert_preset, delete_expert_preset, write_room_connection, write_room_adapter, launch_clients: LAUNCH_CLIENTS,
|
|
6443
|
-
launch_model_state, load_launch_models, write_launch_model, save_launch_api_key, create_launch_project, display_path, write_scheduler, save_scheduler_api_key, save_search_api_key, check_scheduler, write_named_followup, write_create_discussion, write_create_goal, write_create_chain_rounds, check_launch_api, launch_summary, launch_can_set_access, full_only_hint, pick_launch_directory, browse_local_directory, list_remote_directories, save_launch_projects, restore_launch_profile, reset_create_form, empty_discussion_message,
|
|
6450
|
+
launch_model_state, load_launch_models, write_launch_model, save_launch_api_key, create_launch_project, remove_launch_projects, display_path, write_scheduler, save_scheduler_api_key, save_search_api_key, check_scheduler, write_named_followup, write_create_discussion, write_create_goal, write_create_chain_rounds, check_launch_api, launch_summary, launch_can_set_access, full_only_hint, pick_launch_directory, browse_local_directory, list_remote_directories, save_launch_projects, restore_launch_profile, reset_create_form, empty_discussion_message,
|
|
6444
6451
|
start_drag: start_directory_drag, reconnect: reconnect_live_updates, stop_label, local_request: local_launch_request,
|
|
6445
6452
|
attachment_markup, attachment_size, attachment_file_icon, drop_attachments, paste_attachments, drop_unreferenced_attachments, set_text_preview: (open) => { state.text_preview = open; }, set_image_viewer: (open) => { state.image_viewer = open; }, attachment_url,
|
|
6446
6453
|
write_expert: write_view_expert, add_instance: add_view_instance, add_preset: add_preset_instance, platform_of, execute: execute_view_action, theme: change_view_theme,
|