@steerable/steer 0.3.27 → 0.3.29

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.
@@ -0,0 +1,206 @@
1
+ /**
2
+ * 发现用户技能目录,并复制到 Steer 的用户技能根。不覆盖已有目录。
3
+ */
4
+ import crypto from 'node:crypto';
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+ import { parseSkillNameFromMarkdown } from '@steerable/agent-shell/local-backend/skill-install';
8
+ import { EXCLUDED_PATH_SEGMENTS } from './sources.js';
9
+ export const SKILL_WALK_DEPTH = 4;
10
+ function pathInside(root, candidate) {
11
+ const base = root.endsWith(path.sep) ? root.slice(0, -1) : root;
12
+ return candidate === base || candidate.startsWith(base + path.sep);
13
+ }
14
+ function note(probe, filePath) {
15
+ probe.observe?.(filePath);
16
+ }
17
+ function isSecretFileName(name) {
18
+ return name === '.env'
19
+ || name === 'credentials.json'
20
+ || name.endsWith('.pem')
21
+ || name.endsWith('.key');
22
+ }
23
+ /** frontmatter 的原始 name。没有则用目录名。展示用,不参与目录净化。 */
24
+ export function skillDisplayName(markdown, dirBase) {
25
+ if (markdown.startsWith('---')) {
26
+ const rest = markdown.slice(3).replace(/^\r?\n/, '');
27
+ const end = rest.search(/\r?\n---\s*(?:\r?\n|$)/);
28
+ if (end !== -1) {
29
+ const nameMatch = rest.slice(0, end).match(/^name:\s*(.+)$/m);
30
+ const raw = nameMatch?.[1]?.trim().replace(/^["']|["']$/g, '');
31
+ if (raw)
32
+ return raw;
33
+ }
34
+ }
35
+ return dirBase;
36
+ }
37
+ /** 目标目录名。中文或空净化结果改用来源 id 加路径哈希。 */
38
+ export function skillDestName(source, realPath, markdown, dirBase) {
39
+ const parsed = parseSkillNameFromMarkdown(markdown, dirBase);
40
+ const hashed = `${source}-${crypto.createHash('sha256').update(realPath).digest('hex').slice(0, 8)}`;
41
+ const preferred = /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(parsed) && parsed.length <= 81
42
+ ? parsed
43
+ : hashed;
44
+ return /^[a-z0-9][a-z0-9-]{0,80}$/.test(preferred) ? preferred : hashed;
45
+ }
46
+ function skillMarkdownEscapes(skillDir, probe) {
47
+ note(probe, skillDir);
48
+ let skillReal;
49
+ try {
50
+ skillReal = fs.realpathSync(skillDir);
51
+ }
52
+ catch {
53
+ return true;
54
+ }
55
+ note(probe, skillReal);
56
+ const stack = [skillDir];
57
+ while (stack.length > 0) {
58
+ const dir = stack.pop();
59
+ if (!dir)
60
+ continue;
61
+ note(probe, dir);
62
+ let entries;
63
+ try {
64
+ entries = fs.readdirSync(dir, { withFileTypes: true });
65
+ }
66
+ catch {
67
+ return true;
68
+ }
69
+ for (const ent of entries) {
70
+ if (isSecretFileName(ent.name) || EXCLUDED_PATH_SEGMENTS.has(ent.name))
71
+ continue;
72
+ const abs = path.join(dir, ent.name);
73
+ if (!ent.isSymbolicLink()) {
74
+ if (ent.isDirectory())
75
+ stack.push(abs);
76
+ continue;
77
+ }
78
+ note(probe, abs);
79
+ try {
80
+ const target = fs.realpathSync(abs);
81
+ note(probe, target);
82
+ if (!pathInside(skillReal, target))
83
+ return true;
84
+ }
85
+ catch {
86
+ return true;
87
+ }
88
+ }
89
+ }
90
+ return false;
91
+ }
92
+ /** 技能根下最多 4 层目录里,直接含有常规文件 SKILL.md 的目录。 */
93
+ export function discoverSkillDirs(skillRootReal, probe) {
94
+ const found = [];
95
+ const walk = (dir, depth) => {
96
+ note(probe, dir);
97
+ let entries;
98
+ try {
99
+ entries = fs.readdirSync(dir, { withFileTypes: true });
100
+ }
101
+ catch {
102
+ return;
103
+ }
104
+ let skillFile = null;
105
+ const children = [];
106
+ for (const ent of entries) {
107
+ if (EXCLUDED_PATH_SEGMENTS.has(ent.name))
108
+ continue;
109
+ const abs = path.join(dir, ent.name);
110
+ if (ent.isSymbolicLink())
111
+ continue;
112
+ if (ent.isDirectory()) {
113
+ if (depth < SKILL_WALK_DEPTH)
114
+ children.push(abs);
115
+ continue;
116
+ }
117
+ if (ent.isFile() && ent.name === 'SKILL.md' && depth >= 1)
118
+ skillFile = abs;
119
+ }
120
+ if (skillFile) {
121
+ note(probe, skillFile);
122
+ try {
123
+ const real = fs.realpathSync(dir);
124
+ note(probe, real);
125
+ if (pathInside(skillRootReal, real)) {
126
+ const st = fs.lstatSync(dir);
127
+ found.push({
128
+ dir,
129
+ real,
130
+ mtime: st.mtime,
131
+ escaped: skillMarkdownEscapes(dir, probe),
132
+ });
133
+ }
134
+ }
135
+ catch {
136
+ // 目录在列出之后消失:这项不进清单。
137
+ }
138
+ }
139
+ for (const child of children)
140
+ walk(child, depth + 1);
141
+ };
142
+ walk(skillRootReal, 0);
143
+ return found;
144
+ }
145
+ /**
146
+ * 只复制常规文件和目录。密钥文件名不打开。
147
+ * 指向技能目录外的符号链接会删掉已创建的目标。
148
+ */
149
+ export function copySkillDirectory(sourceDir, destDir) {
150
+ let sourceReal;
151
+ try {
152
+ sourceReal = fs.realpathSync(sourceDir);
153
+ }
154
+ catch {
155
+ return 'copy-failed';
156
+ }
157
+ fs.mkdirSync(destDir, { recursive: true });
158
+ const walk = (current) => {
159
+ let entries;
160
+ try {
161
+ entries = fs.readdirSync(current, { withFileTypes: true });
162
+ }
163
+ catch {
164
+ return 'copy-failed';
165
+ }
166
+ for (const ent of entries) {
167
+ if (isSecretFileName(ent.name) || EXCLUDED_PATH_SEGMENTS.has(ent.name))
168
+ continue;
169
+ const from = path.join(current, ent.name);
170
+ const rel = path.relative(sourceDir, from);
171
+ if (rel.startsWith('..') || path.isAbsolute(rel))
172
+ return 'copy-failed';
173
+ const to = path.join(destDir, rel);
174
+ if (ent.isSymbolicLink()) {
175
+ try {
176
+ const target = fs.realpathSync(from);
177
+ if (!pathInside(sourceReal, target))
178
+ return 'symlink-escape';
179
+ }
180
+ catch {
181
+ return 'symlink-escape';
182
+ }
183
+ continue;
184
+ }
185
+ try {
186
+ if (ent.isDirectory()) {
187
+ fs.mkdirSync(to, { recursive: true });
188
+ const nested = walk(from);
189
+ if (nested !== 'ok')
190
+ return nested;
191
+ }
192
+ else if (ent.isFile()) {
193
+ fs.copyFileSync(from, to);
194
+ }
195
+ }
196
+ catch {
197
+ return 'copy-failed';
198
+ }
199
+ }
200
+ return 'ok';
201
+ };
202
+ const result = walk(sourceDir);
203
+ if (result !== 'ok')
204
+ fs.rmSync(destDir, { recursive: true, force: true });
205
+ return result;
206
+ }
@@ -0,0 +1,127 @@
1
+ /**
2
+ * 七家来源的根目录。只认这里列出的路径,环境变量只替换对应的那一个根。
3
+ */
4
+ import path from 'node:path';
5
+ export { SOURCE_ORDER } from './types.js';
6
+ export const EXCLUDED_PATH_SEGMENTS = new Set([
7
+ 'node_modules',
8
+ 'plugins',
9
+ 'plugin-data',
10
+ 'builtin',
11
+ 'skills-cursor',
12
+ '.skills',
13
+ ]);
14
+ function envDir(env, name) {
15
+ const value = env[name];
16
+ if (typeof value !== 'string')
17
+ return null;
18
+ const trimmed = value.trim();
19
+ return trimmed.length > 0 ? trimmed : null;
20
+ }
21
+ function doubaoSkillRoots(input) {
22
+ const roots = [path.join(input.homedir, 'DoubaoWork', 'skills')];
23
+ if (input.platform === 'win32') {
24
+ const base = envDir(input.env, 'LOCALAPPDATA')
25
+ ?? path.join(input.homedir, 'AppData', 'Local');
26
+ roots.push(path.join(base, 'Doubao', 'User Data', 'Default', '.doubao', 'agent_mode', 'workspace', '.user_skills'));
27
+ }
28
+ else if (input.platform === 'darwin') {
29
+ roots.push(path.join(input.homedir, 'Library', 'Application Support', 'DoubaoWork', 'Default', '.doubaowork', 'agent_mode', 'workspace', '.user_skills'));
30
+ }
31
+ return roots;
32
+ }
33
+ function doubaoAppDir(input) {
34
+ if (input.platform === 'win32') {
35
+ const base = envDir(input.env, 'LOCALAPPDATA')
36
+ ?? path.join(input.homedir, 'AppData', 'Local');
37
+ return path.join(base, 'Doubao');
38
+ }
39
+ if (input.platform === 'darwin') {
40
+ return path.join(input.homedir, 'Library', 'Application Support', 'DoubaoWork');
41
+ }
42
+ return path.join(input.homedir, '.config', 'DoubaoWork');
43
+ }
44
+ /** 按主目录和环境变量列出本期要看的根。不访问磁盘。 */
45
+ export function foreignImportRoots(input) {
46
+ const home = input.homedir;
47
+ const claude = path.join(home, '.claude');
48
+ const workbuddy = path.join(home, '.codebuddy');
49
+ const codex = path.join(home, '.codex');
50
+ const cursor = path.join(home, '.cursor');
51
+ const qoder = envDir(input.env, 'QODER_CONFIG_DIR') ?? path.join(home, '.qoder');
52
+ const qoderCn = envDir(input.env, 'QODERCN_CONFIG_DIR') ?? path.join(home, '.qoder-cn');
53
+ const trae = envDir(input.env, 'TRAE_HOME') ?? path.join(home, '.trae');
54
+ const traeCn = path.join(home, '.trae-cn');
55
+ const standard = (source, family, variant, root, taskShape, agents) => ({
56
+ source,
57
+ family,
58
+ variant,
59
+ root,
60
+ unsupported: null,
61
+ taskShape,
62
+ skillRoots: [path.join(root, 'skills')],
63
+ agentsDir: agents ? path.join(root, 'agents') : null,
64
+ });
65
+ return [
66
+ standard('claude', 'claude', null, claude, 'claude-jsonl', true),
67
+ standard('workbuddy', 'workbuddy', null, workbuddy, 'claude-jsonl', true),
68
+ standard('codex', 'codex', null, codex, 'codex-rollout', false),
69
+ standard('cursor', 'cursor', null, cursor, 'cursor-transcript', false),
70
+ standard('qoder', 'qoder', 'global', qoder, 'qoder-jsonl', true),
71
+ standard('qoder-cn', 'qoder', 'cn', qoderCn, 'qoder-jsonl', true),
72
+ {
73
+ source: 'trae',
74
+ family: 'trae',
75
+ variant: 'global',
76
+ root: trae,
77
+ unsupported: 'encrypted-db',
78
+ taskShape: 'unsupported',
79
+ skillRoots: [path.join(trae, 'skills')],
80
+ agentsDir: null,
81
+ },
82
+ {
83
+ source: 'trae-cn',
84
+ family: 'trae',
85
+ variant: 'cn',
86
+ root: traeCn,
87
+ unsupported: 'encrypted-db',
88
+ taskShape: 'unsupported',
89
+ skillRoots: [path.join(traeCn, 'skills')],
90
+ agentsDir: null,
91
+ },
92
+ {
93
+ source: 'doubao-work',
94
+ family: 'doubao',
95
+ variant: null,
96
+ root: doubaoAppDir(input),
97
+ unsupported: 'indexed-db',
98
+ taskShape: 'unsupported',
99
+ skillRoots: doubaoSkillRoots(input),
100
+ agentsDir: null,
101
+ },
102
+ ];
103
+ }
104
+ export function sourceBaseLabel(source) {
105
+ switch (source) {
106
+ case 'claude':
107
+ return 'Claude Code';
108
+ case 'workbuddy':
109
+ return 'WorkBuddy';
110
+ case 'codex':
111
+ return 'Codex';
112
+ case 'cursor':
113
+ return 'Cursor';
114
+ case 'qoder':
115
+ case 'qoder-cn':
116
+ return 'Qoder';
117
+ case 'trae':
118
+ case 'trae-cn':
119
+ return 'Trae';
120
+ case 'doubao-work':
121
+ return 'Doubao Work';
122
+ default: {
123
+ const neverSource = source;
124
+ return neverSource;
125
+ }
126
+ }
127
+ }
@@ -0,0 +1,187 @@
1
+ /**
2
+ * 从四家明文 jsonl 里抽出用户和助手的文本。不保留工具调用。
3
+ */
4
+ import path from 'node:path';
5
+ export const FOREIGN_MESSAGE_LIMIT = 1000;
6
+ export const FOREIGN_MESSAGE_CHARS = 100_000;
7
+ const TITLE_CHARS = 64;
8
+ /** 单条超过 10 万字符时保留前段并标明截断。 */
9
+ export function clipForeignMessage(text) {
10
+ if (text.length <= FOREIGN_MESSAGE_CHARS)
11
+ return text;
12
+ return `${text.slice(0, FOREIGN_MESSAGE_CHARS)}\n…[truncated]`;
13
+ }
14
+ /** 标题用第一条非空用户文本,压成一行,最多 64 字。没有则用会话 id 前 8 位。 */
15
+ export function foreignTaskBareTitle(session) {
16
+ const user = session.messages.find((message) => message.role === 'user' && message.text.trim());
17
+ if (!user)
18
+ return session.sessionId.slice(0, 8);
19
+ return user.text.replace(/\s+/g, ' ').trim().slice(0, TITLE_CHARS);
20
+ }
21
+ function pushText(messages, role, text) {
22
+ if (!text.trim())
23
+ return;
24
+ messages.push({ role, text });
25
+ }
26
+ function blocksText(content, extraTypes = []) {
27
+ if (typeof content === 'string')
28
+ return content;
29
+ if (!Array.isArray(content))
30
+ return '';
31
+ const parts = [];
32
+ for (const block of content) {
33
+ if (!block || typeof block !== 'object')
34
+ continue;
35
+ const rec = block;
36
+ const type = rec.type;
37
+ if (typeof rec.text !== 'string')
38
+ continue;
39
+ if (type === 'text' || extraTypes.includes(String(type)))
40
+ parts.push(rec.text);
41
+ }
42
+ return parts.join('');
43
+ }
44
+ function messageText(message) {
45
+ if (typeof message === 'string')
46
+ return message;
47
+ if (!message || typeof message !== 'object')
48
+ return '';
49
+ return blocksText(message.content);
50
+ }
51
+ function asRecord(value) {
52
+ if (!value || typeof value !== 'object' || Array.isArray(value))
53
+ return null;
54
+ return value;
55
+ }
56
+ function parseClaudeLike(raw, filename, allowAgentFile) {
57
+ if (!allowAgentFile && path.basename(filename).startsWith('agent-'))
58
+ return null;
59
+ const session = {
60
+ sessionId: path.basename(filename, '.jsonl'),
61
+ cwd: null,
62
+ messages: [],
63
+ };
64
+ for (const line of raw.split(/\r?\n/)) {
65
+ if (!line.trim())
66
+ continue;
67
+ let parsed;
68
+ try {
69
+ parsed = JSON.parse(line);
70
+ }
71
+ catch {
72
+ continue;
73
+ }
74
+ const rec = asRecord(parsed);
75
+ if (!rec)
76
+ continue;
77
+ if (typeof rec.cwd === 'string' && rec.cwd.trim() && !session.cwd)
78
+ session.cwd = rec.cwd;
79
+ if (typeof rec.sessionId === 'string' && rec.sessionId.trim())
80
+ session.sessionId = rec.sessionId;
81
+ if (rec.type === 'workspace-directories' || rec.type === 'runtime-config' || rec.type === 'active-leaf') {
82
+ continue;
83
+ }
84
+ if (rec.type !== 'user' && rec.type !== 'assistant')
85
+ continue;
86
+ pushText(session.messages, rec.type, messageText(rec.message));
87
+ }
88
+ return session;
89
+ }
90
+ function codexRole(payload) {
91
+ if (payload.role === 'user' || payload.type === 'user_message')
92
+ return 'user';
93
+ if (payload.role === 'assistant' || payload.type === 'agent_message')
94
+ return 'assistant';
95
+ return null;
96
+ }
97
+ function codexText(payload) {
98
+ if (typeof payload.message === 'string')
99
+ return payload.message;
100
+ if (typeof payload.text === 'string')
101
+ return payload.text;
102
+ const fromMessage = messageText(payload.message);
103
+ if (fromMessage.trim())
104
+ return fromMessage;
105
+ return blocksText(payload.content, ['input_text', 'output_text']);
106
+ }
107
+ function parseCodex(raw, filename) {
108
+ const session = {
109
+ sessionId: path.basename(filename, '.jsonl'),
110
+ cwd: null,
111
+ messages: [],
112
+ };
113
+ for (const line of raw.split(/\r?\n/)) {
114
+ if (!line.trim())
115
+ continue;
116
+ let parsed;
117
+ try {
118
+ parsed = JSON.parse(line);
119
+ }
120
+ catch {
121
+ continue;
122
+ }
123
+ const rec = asRecord(parsed);
124
+ const payload = rec ? asRecord(rec.payload) : null;
125
+ if (!rec || !payload)
126
+ continue;
127
+ if (rec.type === 'session_meta') {
128
+ if (typeof payload.id === 'string' && payload.id.trim())
129
+ session.sessionId = payload.id;
130
+ if (typeof payload.cwd === 'string' && payload.cwd.trim())
131
+ session.cwd = payload.cwd;
132
+ continue;
133
+ }
134
+ if (rec.type !== 'event_msg' && rec.type !== 'response_item')
135
+ continue;
136
+ const role = codexRole(payload);
137
+ if (!role)
138
+ continue;
139
+ pushText(session.messages, role, codexText(payload));
140
+ }
141
+ return session;
142
+ }
143
+ function parseCursor(raw, filename) {
144
+ const session = {
145
+ sessionId: path.basename(filename, '.jsonl'),
146
+ cwd: null,
147
+ messages: [],
148
+ };
149
+ for (const line of raw.split(/\r?\n/)) {
150
+ if (!line.trim())
151
+ continue;
152
+ let parsed;
153
+ try {
154
+ parsed = JSON.parse(line);
155
+ }
156
+ catch {
157
+ continue;
158
+ }
159
+ const rec = asRecord(parsed);
160
+ if (!rec)
161
+ continue;
162
+ if (typeof rec.cwd === 'string' && rec.cwd.trim() && !session.cwd)
163
+ session.cwd = rec.cwd;
164
+ if (rec.role !== 'user' && rec.role !== 'assistant')
165
+ continue;
166
+ const text = typeof rec.message === 'string' ? rec.message : messageText(rec.message);
167
+ pushText(session.messages, rec.role, text);
168
+ }
169
+ return session;
170
+ }
171
+ /** 解析一份已经确认落在来源根里的会话文件。agent-*.jsonl 在 Claude 形状下返回 null。 */
172
+ export function parseForeignSession(shape, filename, raw) {
173
+ switch (shape) {
174
+ case 'claude-jsonl':
175
+ return parseClaudeLike(raw, filename, false);
176
+ case 'qoder-jsonl':
177
+ return parseClaudeLike(raw, filename, true);
178
+ case 'codex-rollout':
179
+ return parseCodex(raw, filename);
180
+ case 'cursor-transcript':
181
+ return parseCursor(raw, filename);
182
+ default: {
183
+ const neverShape = shape;
184
+ return neverShape;
185
+ }
186
+ }
187
+ }
@@ -0,0 +1,12 @@
1
+ /** 从其他智能体导入的清单与结果。面板和扫描器共用这组字段。 */
2
+ export const SOURCE_ORDER = [
3
+ 'claude',
4
+ 'workbuddy',
5
+ 'codex',
6
+ 'cursor',
7
+ 'qoder',
8
+ 'qoder-cn',
9
+ 'trae',
10
+ 'trae-cn',
11
+ 'doubao-work',
12
+ ];
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Steer 的「从其他智能体导入」路由。扫描和复制都在产品里,存储仍用宿主的会话库。
3
+ */
4
+ import os from 'node:os';
5
+ import { matchPackBackendRoute, registerPackBackendRoutes, } from '@steerable/agent-shell/local-backend/pack-backend-routes';
6
+ import { importForeignSelection, scanForeignImport } from './foreign-import/scan.js';
7
+ export const FOREIGN_IMPORT_PREFIX = '/api/v2/steer/foreign-import/';
8
+ export const FOREIGN_IMPORT_SCAN_ROUTE = '/api/v2/steer/foreign-import/scan';
9
+ export const FOREIGN_IMPORT_RUN_ROUTE = '/api/v2/steer/foreign-import/import';
10
+ function detail(status, message) {
11
+ return { status, data: { detail: message } };
12
+ }
13
+ /** ids 必须是字符串数组。重复的 id 只处理一次。 */
14
+ export function foreignImportIds(body) {
15
+ if (!body || typeof body !== 'object')
16
+ return null;
17
+ const ids = body.ids;
18
+ if (!Array.isArray(ids) || ids.some((id) => typeof id !== 'string'))
19
+ return null;
20
+ return [...new Set(ids)];
21
+ }
22
+ export async function handleForeignImportScan(deps) {
23
+ try {
24
+ const scan = await scanForeignImport(deps);
25
+ const data = { items: scan.items };
26
+ if (scan.ledgerWarning)
27
+ data.ledgerWarning = scan.ledgerWarning;
28
+ return { status: 200, data };
29
+ }
30
+ catch {
31
+ return detail(500, 'Could not scan this Mac.');
32
+ }
33
+ }
34
+ export async function handleForeignImport(body, deps) {
35
+ const ids = foreignImportIds(body);
36
+ if (!ids)
37
+ return detail(400, 'ids must be an array of strings');
38
+ try {
39
+ return { status: 200, data: await importForeignSelection(deps, ids) };
40
+ }
41
+ catch {
42
+ return detail(500, 'Could not copy this item.');
43
+ }
44
+ }
45
+ async function liveDeps() {
46
+ const { getScopedStore, LOCAL_SCOPE } = await import('@steerable/agent-shell/storage/driver');
47
+ const { getUserDataDir } = await import('@steerable/agent-shell/runtime');
48
+ const { getUserSkillsDir } = await import('@steerable/agent-shell/local-backend/skill-loader');
49
+ const { ProjectRegistry } = await import('@steerable/agent-shell/project-registry');
50
+ const { createJsonStore } = await import('@steerable/agent-shell/json-store');
51
+ const store = getScopedStore(LOCAL_SCOPE);
52
+ const saved = createJsonStore({
53
+ name: 'agent-projects',
54
+ defaults: { projects: [] },
55
+ });
56
+ const projects = new ProjectRegistry({
57
+ get: () => saved.get('projects'),
58
+ set: (_key, value) => { saved.set('projects', value); },
59
+ mutate: (_key, update) => saved.mutate('projects', update),
60
+ });
61
+ return {
62
+ env: process.env,
63
+ homedir: os.homedir(),
64
+ platform: process.platform,
65
+ userDataDir: getUserDataDir(),
66
+ userSkillsDir: getUserSkillsDir(),
67
+ store,
68
+ projects,
69
+ };
70
+ }
71
+ /** 宿主启动时注册。重复调用直接返回,避免热重载登记两次。 */
72
+ export function registerSteerForeignImport() {
73
+ if (matchPackBackendRoute('POST', FOREIGN_IMPORT_SCAN_ROUTE))
74
+ return;
75
+ registerPackBackendRoutes('steer', FOREIGN_IMPORT_PREFIX, [
76
+ {
77
+ method: 'POST',
78
+ path: FOREIGN_IMPORT_SCAN_ROUTE,
79
+ handler: async () => handleForeignImportScan(await liveDeps()),
80
+ },
81
+ {
82
+ method: 'POST',
83
+ path: FOREIGN_IMPORT_RUN_ROUTE,
84
+ handler: async ({ body }) => handleForeignImport(body, await liveDeps()),
85
+ },
86
+ ]);
87
+ }
@@ -1343,5 +1343,22 @@
1343
1343
  "Set up API key…": "配置 API Key…",
1344
1344
  "API key not configured — click to set up ({model})": "尚未配置 API Key — 点击前往配置({model})",
1345
1345
  "Save a model API key below (or switch Provider to local Ollama) — your message will be sent automatically.": "在下方保存模型 API Key(或切换为本地免密 Ollama)后,将自动发送你刚输入的消息。",
1346
- "No API key is configured yet. Paste a key below and click Save, or switch Provider to Ollama (Local).": "尚未填写可用的 API Key:请在下方粘贴密钥后点「保存」,或将服务商切换为本地 Ollama。"
1346
+ "No API key is configured yet. Paste a key below and click Save, or switch Provider to Ollama (Local).": "尚未填写可用的 API Key:请在下方粘贴密钥后点「保存」,或将服务商切换为本地 Ollama。",
1347
+ "Destructive command · confirm before running": "高危操作确认",
1348
+ "Agent requests access outside the workspace": "Agent 请求访问工作区外目录",
1349
+ "Agent requests to install packages and run code": "Agent 请求安装依赖并运行代码",
1350
+ "This command can delete or overwrite data: {reason}": "包含不可逆删除或重置指令({reason}),请核对后再决定是否执行。",
1351
+ "Target folder: {dir}": "目标目录:{dir}",
1352
+ "Needs a new package: {packages}": "需联网安装新依赖:{packages}",
1353
+ "Installs {packages} before running. The command sandbox is off.": "运行前会安装依赖:{packages}。命令沙箱已关闭。",
1354
+ "Installs {packages} before running inside the workspace sandbox.": "在工作区沙箱内运行,并在运行前安装依赖:{packages}。",
1355
+ "Runs with the local interpreter. The command sandbox is off.": "使用本机解释器运行。命令沙箱已关闭。",
1356
+ "Runs inside the workspace sandbox.": "在工作区沙箱内运行。",
1357
+ "Allow this folder in this chat": "本任务允许此目录",
1358
+ "Always allow commands starting with {prefix}": "始终允许以 {prefix} 开头的命令",
1359
+ "Saved on this computer and applies to matching commands in every chat": "写入本机规则,对所有任务中匹配该前缀的命令生效",
1360
+ "Enter to allow · Shift+Enter for this folder · Esc to deny": "↵ 允许一次 · Shift+Enter 允许此目录 · Esc 拒绝",
1361
+ "Enter to allow · Shift+Enter for this chat · Esc to deny": "↵ 允许一次 · Shift+Enter 本任务允许 · Esc 拒绝",
1362
+ "Running with default permissions. Files, commands, and snippets inside the workspace run automatically. Access outside it, new packages, and destructive commands still ask.": "当前在默认权限下运行。工作区内的文件、命令和代码片段自动运行;访问外部目录、安装新依赖或执行高危删除命令前会向你确认。",
1363
+ "Full access is enabled. Files, commands, and snippets on this computer run without a prompt. Destructive commands and outward submissions still ask.": "已开启完整权限。本机文件、命令和代码片段无需逐次确认;高危删除命令和对外提交仍会向你确认。"
1347
1364
  }