@aalis/plugin-tool-code-runner 0.11.0 → 0.12.1
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -26
- package/dist/index.js.map +1 -1
- package/dist/locales/en.d.ts +24 -0
- package/dist/locales/en.d.ts.map +1 -0
- package/dist/locales/en.js +24 -0
- package/dist/locales/en.js.map +1 -0
- package/dist/runner.d.ts +2 -3
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +2 -2
- package/dist/runner.js.map +1 -1
- package/dist/texts.d.ts +47 -0
- package/dist/texts.d.ts.map +1 -0
- package/dist/texts.js +32 -0
- package/dist/texts.js.map +1 -0
- package/package.json +8 -7
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAqJA,wBAoJG"}
|
package/dist/index.js
CHANGED
|
@@ -5,74 +5,78 @@ import { tools, withToolGroups } from '@aalis/api-tools';
|
|
|
5
5
|
import { config, definePlugin, logger, optional } from '@aalis/core';
|
|
6
6
|
import { defineConfig, parseConfig } from '@aalis/schema-config';
|
|
7
7
|
import { runCode } from './runner.js';
|
|
8
|
+
import { t } from './texts.js';
|
|
8
9
|
const configSchema = defineConfig({
|
|
9
10
|
python: {
|
|
10
11
|
label: 'Python',
|
|
11
12
|
fields: {
|
|
12
|
-
enabled: { type: 'boolean', label: '
|
|
13
|
+
enabled: { type: 'boolean', label: t('enableTool', { tool: 'run_python' }), default: true, onInvalid: 'error' },
|
|
13
14
|
interpreter: {
|
|
14
15
|
type: 'string',
|
|
15
|
-
label: '
|
|
16
|
+
label: t('interpreterLabel'),
|
|
16
17
|
default: 'python3',
|
|
17
18
|
required: true,
|
|
18
19
|
onInvalid: 'error',
|
|
19
|
-
description: '
|
|
20
|
+
description: t('pythonInterpreterDescription'),
|
|
20
21
|
},
|
|
21
22
|
},
|
|
22
23
|
},
|
|
23
24
|
javascript: {
|
|
24
25
|
label: 'JavaScript (Node.js)',
|
|
25
26
|
fields: {
|
|
26
|
-
enabled: {
|
|
27
|
+
enabled: {
|
|
28
|
+
type: 'boolean',
|
|
29
|
+
label: t('enableTool', { tool: 'run_javascript' }),
|
|
30
|
+
default: true,
|
|
31
|
+
onInvalid: 'error',
|
|
32
|
+
},
|
|
27
33
|
interpreter: {
|
|
28
34
|
type: 'string',
|
|
29
|
-
label: '
|
|
35
|
+
label: t('interpreterLabel'),
|
|
30
36
|
default: 'node',
|
|
31
37
|
required: true,
|
|
32
38
|
onInvalid: 'error',
|
|
33
|
-
description: '
|
|
39
|
+
description: t('javascriptInterpreterDescription'),
|
|
34
40
|
},
|
|
35
41
|
},
|
|
36
42
|
},
|
|
37
43
|
maxOutputSize: {
|
|
38
44
|
type: 'number',
|
|
39
|
-
label: '
|
|
45
|
+
label: t('maxOutputSizeLabel'),
|
|
40
46
|
default: 131072,
|
|
41
|
-
description: '
|
|
47
|
+
description: t('maxOutputSizeDescription'),
|
|
42
48
|
},
|
|
43
49
|
workingDirectory: {
|
|
44
50
|
type: 'string',
|
|
45
|
-
label: '
|
|
51
|
+
label: t('workingDirectoryLabel'),
|
|
46
52
|
default: 'workspace:/',
|
|
47
53
|
onInvalid: 'error',
|
|
48
|
-
description: '
|
|
54
|
+
description: t('workingDirectoryDescription'),
|
|
49
55
|
},
|
|
50
56
|
sandbox: {
|
|
51
|
-
label: '
|
|
57
|
+
label: t('sandboxLabel'),
|
|
52
58
|
fields: {
|
|
53
59
|
mode: {
|
|
54
60
|
type: 'select',
|
|
55
|
-
label: '
|
|
61
|
+
label: t('modeLabel'),
|
|
56
62
|
default: 'auto',
|
|
57
63
|
onInvalid: 'error',
|
|
58
64
|
options: [
|
|
59
|
-
{ label: '
|
|
60
|
-
{ label: '
|
|
65
|
+
{ label: t('modeAuto'), value: 'auto' },
|
|
66
|
+
{ label: t('modeNone'), value: 'none' },
|
|
61
67
|
],
|
|
62
|
-
description: '
|
|
63
|
-
'只放行白名单环境变量;无可用沙箱后端时拒绝执行(fail-closed)。none:退回无隔离裸进程,每次告警。' +
|
|
64
|
-
'说明:v1 读放开(解释器需系统库),防的是写出工作区/联网外泄/篡改系统,不防读取本机其它文件。',
|
|
68
|
+
description: t('modeDescription'),
|
|
65
69
|
},
|
|
66
70
|
network: {
|
|
67
71
|
type: 'select',
|
|
68
|
-
label: '
|
|
72
|
+
label: t('networkLabel'),
|
|
69
73
|
default: 'deny',
|
|
70
74
|
onInvalid: 'error',
|
|
71
75
|
options: [
|
|
72
|
-
{ label: '
|
|
73
|
-
{ label: '
|
|
76
|
+
{ label: t('networkDeny'), value: 'deny' },
|
|
77
|
+
{ label: t('networkAllow'), value: 'allow' },
|
|
74
78
|
],
|
|
75
|
-
description: '
|
|
79
|
+
description: t('networkDescription'),
|
|
76
80
|
},
|
|
77
81
|
},
|
|
78
82
|
},
|
|
@@ -80,8 +84,24 @@ const configSchema = defineConfig({
|
|
|
80
84
|
function toRunnerCwdUri(input) {
|
|
81
85
|
return resolveAgainstCwd(input, 'workspace:/');
|
|
82
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* 交给脚本的环境变量白名单,两种模式下都只交这些(runner 另加 PYTHONIOENCODING)。SystemRoot 以下几项给 Windows:
|
|
89
|
+
* 它没有沙箱后端、只能 mode=none,系统组件要 SystemRoot 等,解释器的临时目录与用户目录取 TEMP、TMP、USERPROFILE
|
|
90
|
+
*/
|
|
83
91
|
function safeEnv() {
|
|
84
|
-
const keep = [
|
|
92
|
+
const keep = [
|
|
93
|
+
'PATH',
|
|
94
|
+
'LANG',
|
|
95
|
+
'LC_ALL',
|
|
96
|
+
'TERM',
|
|
97
|
+
'SystemRoot',
|
|
98
|
+
'WINDIR',
|
|
99
|
+
'COMSPEC',
|
|
100
|
+
'PATHEXT',
|
|
101
|
+
'TEMP',
|
|
102
|
+
'TMP',
|
|
103
|
+
'USERPROFILE',
|
|
104
|
+
];
|
|
85
105
|
const env = {};
|
|
86
106
|
for (const key of keep) {
|
|
87
107
|
if (process.env[key])
|
|
@@ -91,7 +111,7 @@ function safeEnv() {
|
|
|
91
111
|
}
|
|
92
112
|
// ===== 插件入口 =====
|
|
93
113
|
// storage 仅按名等待;local-path 由 createRunnerConfig 运行时探测 resolveLocalPath 守卫。
|
|
94
|
-
// tools
|
|
114
|
+
// tools 只被登记、不被读,缺席时记在归属表里等提供者到场,因此不设激活闸。
|
|
95
115
|
const uses = {
|
|
96
116
|
tools: optional(tools),
|
|
97
117
|
storage,
|
|
@@ -116,7 +136,7 @@ async function createRunnerConfig(caps, cfg) {
|
|
|
116
136
|
}
|
|
117
137
|
export default definePlugin({
|
|
118
138
|
name: '@aalis/plugin-tool-code-runner',
|
|
119
|
-
displayName: '
|
|
139
|
+
displayName: t('displayName'),
|
|
120
140
|
subsystem: 'tools',
|
|
121
141
|
configSchema,
|
|
122
142
|
uses,
|
|
@@ -124,7 +144,7 @@ export default definePlugin({
|
|
|
124
144
|
const { tools, proc, storage, codeSandbox, logger } = caps;
|
|
125
145
|
const cfg = parseConfig(configSchema, caps.config.use, logger.use);
|
|
126
146
|
if (cfg.sandbox.mode === 'none') {
|
|
127
|
-
logger.use.warn('
|
|
147
|
+
logger.use.warn('注意:code-runner 运行在【无隔离】模式(sandbox.mode=none):代码以宿主用户全权限裸跑,仅在完全可信环境使用。');
|
|
128
148
|
}
|
|
129
149
|
const cwdUri = toRunnerCwdUri(cfg.workingDirectory);
|
|
130
150
|
// 每次调用现取:cwd 要按当时的 storage 实况解析,沙箱后端也可能中途上下线
|
|
@@ -134,7 +154,8 @@ export default definePlugin({
|
|
|
134
154
|
// 注册工具分组
|
|
135
155
|
tools.use.registerGroup({
|
|
136
156
|
name: 'code-runner',
|
|
137
|
-
label: '
|
|
157
|
+
label: t('groupLabel'),
|
|
158
|
+
summary: t('groupSummary'),
|
|
138
159
|
description: '编写并运行 Python / JavaScript 代码来解决计算、分析、文件处理等问题',
|
|
139
160
|
});
|
|
140
161
|
const osName = process.platform === 'darwin' ? 'macOS' : process.platform === 'win32' ? 'Windows' : 'Linux';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAgB,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAiB,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAgB,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAiB,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,EAAqB,OAAO,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,E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,CAAC,MAAM,CACf,CAAC;oBACF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;gBAChC,CAAC;aACF,CAAC,CAAC;YAEH,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,8BAA8B,GAAG,CAAC,UAAU,CAAC,WAAW,GAAG,CAAC,CAAC;QAC/E,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,MAAM,GAAG,CAAC,CAAC;IAClD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
readonly displayName: "Code runner";
|
|
3
|
+
readonly groupLabel: "Code execution";
|
|
4
|
+
readonly groupSummary: "Write and run Python / JavaScript code to solve computation, analysis, file processing and similar problems";
|
|
5
|
+
readonly enableTool: "Enable {tool}";
|
|
6
|
+
readonly interpreterLabel: "Interpreter path";
|
|
7
|
+
readonly pythonInterpreterDescription: "Path or command name of the Python interpreter, such as python3 or /usr/bin/python3";
|
|
8
|
+
readonly javascriptInterpreterDescription: "Path or command name of the Node.js interpreter";
|
|
9
|
+
readonly maxOutputSizeLabel: "Max output bytes";
|
|
10
|
+
readonly maxOutputSizeDescription: "Maximum output bytes for stdout and stderr each";
|
|
11
|
+
readonly workingDirectoryLabel: "Logical working directory";
|
|
12
|
+
readonly workingDirectoryDescription: "Working directory for scripts, as a storage URI such as workspace:/ or tmp:/run; relative paths are resolved under workspace:/.";
|
|
13
|
+
readonly sandboxLabel: "Code sandbox";
|
|
14
|
+
readonly modeLabel: "Isolation mode";
|
|
15
|
+
readonly modeAuto: "Automatic (enforce isolation when a sandbox is available, otherwise refuse to run)";
|
|
16
|
+
readonly modeNone: "No isolation (bare process, dangerous, trusted environments only)";
|
|
17
|
+
readonly modeDescription: "“Automatic” runs in an OS sandbox that may only write the working directory and this run's temporary directory, with no network by default; “No isolation” runs directly, with a warning when the plugin starts. The sandbox does not restrict reading files on this machine.";
|
|
18
|
+
readonly networkLabel: "Child process network";
|
|
19
|
+
readonly networkDeny: "No network (recommended)";
|
|
20
|
+
readonly networkAllow: "Allowed (coarse, cannot filter by domain)";
|
|
21
|
+
readonly networkDescription: "Only takes effect when “Isolation mode” is “Automatic”.";
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
24
|
+
//# sourceMappingURL=en.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGA,wBAwBG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineLocale } from '@aalis/schema-i18n';
|
|
2
|
+
export default defineLocale()({
|
|
3
|
+
displayName: 'Code runner',
|
|
4
|
+
groupLabel: 'Code execution',
|
|
5
|
+
groupSummary: 'Write and run Python / JavaScript code to solve computation, analysis, file processing and similar problems',
|
|
6
|
+
enableTool: 'Enable {tool}',
|
|
7
|
+
interpreterLabel: 'Interpreter path',
|
|
8
|
+
pythonInterpreterDescription: 'Path or command name of the Python interpreter, such as python3 or /usr/bin/python3',
|
|
9
|
+
javascriptInterpreterDescription: 'Path or command name of the Node.js interpreter',
|
|
10
|
+
maxOutputSizeLabel: 'Max output bytes',
|
|
11
|
+
maxOutputSizeDescription: 'Maximum output bytes for stdout and stderr each',
|
|
12
|
+
workingDirectoryLabel: 'Logical working directory',
|
|
13
|
+
workingDirectoryDescription: 'Working directory for scripts, as a storage URI such as workspace:/ or tmp:/run; relative paths are resolved under workspace:/.',
|
|
14
|
+
sandboxLabel: 'Code sandbox',
|
|
15
|
+
modeLabel: 'Isolation mode',
|
|
16
|
+
modeAuto: 'Automatic (enforce isolation when a sandbox is available, otherwise refuse to run)',
|
|
17
|
+
modeNone: 'No isolation (bare process, dangerous, trusted environments only)',
|
|
18
|
+
modeDescription: "“Automatic” runs in an OS sandbox that may only write the working directory and this run's temporary directory, with no network by default; “No isolation” runs directly, with a warning when the plugin starts. The sandbox does not restrict reading files on this machine.",
|
|
19
|
+
networkLabel: 'Child process network',
|
|
20
|
+
networkDeny: 'No network (recommended)',
|
|
21
|
+
networkAllow: 'Allowed (coarse, cannot filter by domain)',
|
|
22
|
+
networkDescription: 'Only takes effect when “Isolation mode” is “Automatic”.',
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=en.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/locales/en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,eAAe,YAAY,EAAU,CAAC;IACpC,WAAW,EAAE,aAAa;IAC1B,UAAU,EAAE,gBAAgB;IAC5B,YAAY,EACV,6GAA6G;IAC/G,UAAU,EAAE,eAAe;IAC3B,gBAAgB,EAAE,kBAAkB;IACpC,4BAA4B,EAAE,qFAAqF;IACnH,gCAAgC,EAAE,iDAAiD;IACnF,kBAAkB,EAAE,kBAAkB;IACtC,wBAAwB,EAAE,iDAAiD;IAC3E,qBAAqB,EAAE,2BAA2B;IAClD,2BAA2B,EACzB,iIAAiI;IACnI,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,oFAAoF;IAC9F,QAAQ,EAAE,mEAAmE;IAC7E,eAAe,EACb,+QAA+Q;IACjR,YAAY,EAAE,uBAAuB;IACrC,WAAW,EAAE,0BAA0B;IACvC,YAAY,EAAE,2CAA2C;IACzD,kBAAkB,EAAE,yDAAyD;CAC9E,CAAC,CAAC"}
|
package/dist/runner.d.ts
CHANGED
|
@@ -11,8 +11,7 @@ export interface RunnerConfig {
|
|
|
11
11
|
maxOutputSize: number;
|
|
12
12
|
/** 子进程 cwd(已通过 storage.resolveLocalPath 解析的本地路径) */
|
|
13
13
|
cwd: string;
|
|
14
|
-
/**
|
|
15
|
-
* 非沙箱路径走 process-local,env 被**叠加**在宿主全量环境之上(提供与否都合并),无隔离作用 */
|
|
14
|
+
/** 子进程只拿到这些环境变量(白名单):沙箱路径经 env -i 清空后注入,非沙箱路径由进程服务按替换语义交给子进程 */
|
|
16
15
|
env?: Record<string, string | undefined>;
|
|
17
16
|
/**
|
|
18
17
|
* 沙箱:给定即要求 OS 隔离(写白名单 = [cwd, 本次临时目录]、网络按 network、env 仅白名单);
|
|
@@ -28,7 +27,7 @@ export interface RunResult {
|
|
|
28
27
|
exitCode: number;
|
|
29
28
|
stdout: string;
|
|
30
29
|
stderr: string;
|
|
31
|
-
/**
|
|
30
|
+
/** 脚本没能运行(沙箱不可用、启动进程失败),或没被中止而以非零退出(「退出码 N」)、被信号结束:带 error 的工具结果判为失败 */
|
|
32
31
|
error?: string;
|
|
33
32
|
/** 调用被中止且脚本是被信号结束的 */
|
|
34
33
|
aborted?: true;
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACxC,mDAAmD;IACnD,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAQD;;;;;;;;;;;GAWG;AACH,wBAAsB,OAAO,CAC3B,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,YAAY,EACpB,SAAS,GAAE,MAAM,EAAO,EACxB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,SAAS,CAAC,CAgFpB"}
|
package/dist/runner.js
CHANGED
|
@@ -30,7 +30,7 @@ export async function runCode(proc, storage, interpreter, code, ext, config, ext
|
|
|
30
30
|
await storage.writeFile(scriptUri, Buffer.from(code, 'utf-8'));
|
|
31
31
|
const scriptPath = `${tmp.path}/script${ext}`;
|
|
32
32
|
// 沙箱策略按本次运行实际路径构造(scope-ready:cwd 来自运行时 resolveLocalPath,
|
|
33
|
-
// 将来
|
|
33
|
+
// 将来 storage 按 session 命名空间化后自动变 per-session 隔离)。
|
|
34
34
|
const policy = config.sandbox
|
|
35
35
|
? { fsRead: [config.cwd], fsWrite: [config.cwd, tmp.path], network: config.sandbox.network }
|
|
36
36
|
: undefined;
|
|
@@ -88,7 +88,7 @@ export async function runCode(proc, storage, interpreter, code, ext, config, ext
|
|
|
88
88
|
const ended = e.result.signal !== null ? `被信号 ${e.result.signal} 结束` : `退出码 ${output.exitCode}`;
|
|
89
89
|
return { ...output, error: ended };
|
|
90
90
|
}
|
|
91
|
-
// 没有退出结果:spawn 失败,或已中止时 spawn
|
|
91
|
+
// 没有退出结果:spawn 失败,或已中止时 spawn 同步抛出(不启动进程)
|
|
92
92
|
if (signal?.aborted)
|
|
93
93
|
return { exitCode: -1, stdout: '', stderr: '', aborted: true, message: '代码已中止' };
|
|
94
94
|
return {
|
package/dist/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkCrC,SAAS,cAAc,CAAC,MAAc,EAAE,OAAe;IACrD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,OAAO;QAAE,OAAO,MAAM,CAAC;IACjE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACtF,OAAO,GAAG,SAAS,iBAAiB,OAAO,MAAM,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,IAAoB,EACpB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,EAAE,CAAC;oBACpB,wDAAwD;oBACxD,8CAA8C;oBAC9C,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI;wBAAE,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;oBACpF,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gBACtC,CAAC;gBACD,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAChG,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;YACrC,CAAC;YACD,0CAA0C;YAC1C,IAAI,MAAM,EAAE,OAAO;gBAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;YACtG,OAAO;gBACL,QAAQ,EAAE,CAAC,CAAC;gBACZ,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,CAAC,CAAC,OAAO;aACjB,CAAC;QACJ,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;IACtB,CAAC;AACH,CAAC"}
|
package/dist/texts.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare const SOURCE: {
|
|
2
|
+
readonly displayName: "代码执行器";
|
|
3
|
+
readonly groupLabel: "代码执行";
|
|
4
|
+
readonly groupSummary: "编写并运行 Python / JavaScript 代码来解决计算、分析、文件处理等问题";
|
|
5
|
+
readonly enableTool: "启用 {tool}";
|
|
6
|
+
readonly interpreterLabel: "解释器路径";
|
|
7
|
+
readonly pythonInterpreterDescription: "Python 解释器路径或命令名,如 python3、/usr/bin/python3";
|
|
8
|
+
readonly javascriptInterpreterDescription: "Node.js 解释器路径或命令名";
|
|
9
|
+
readonly maxOutputSizeLabel: "最大输出字节";
|
|
10
|
+
readonly maxOutputSizeDescription: "stdout/stderr 各自的最大输出字节数";
|
|
11
|
+
readonly workingDirectoryLabel: "逻辑工作目录";
|
|
12
|
+
readonly workingDirectoryDescription: "脚本运行的工作目录,填 storage URI,如 workspace:/ 或 tmp:/run;相对路径按 workspace:/ 下解析。";
|
|
13
|
+
readonly sandboxLabel: "代码沙箱";
|
|
14
|
+
readonly modeLabel: "隔离模式";
|
|
15
|
+
readonly modeAuto: "自动(有沙箱则强制隔离,无则拒绝运行)";
|
|
16
|
+
readonly modeNone: "无隔离(裸进程,危险,仅信任环境)";
|
|
17
|
+
readonly modeDescription: "「自动」在系统沙箱里运行,只能写工作目录与本次临时目录,默认断网;「无隔离」直接运行,插件启动时告警。沙箱不限制读取本机文件。";
|
|
18
|
+
readonly networkLabel: "子进程网络";
|
|
19
|
+
readonly networkDeny: "断网(推荐)";
|
|
20
|
+
readonly networkAllow: "放开(粗粒度,无法按域名过滤)";
|
|
21
|
+
readonly networkDescription: "仅「隔离模式」选「自动」时生效。";
|
|
22
|
+
};
|
|
23
|
+
export type Source = typeof SOURCE;
|
|
24
|
+
export declare const t: import("@aalis/schema-i18n").TextFactory<{
|
|
25
|
+
readonly displayName: "代码执行器";
|
|
26
|
+
readonly groupLabel: "代码执行";
|
|
27
|
+
readonly groupSummary: "编写并运行 Python / JavaScript 代码来解决计算、分析、文件处理等问题";
|
|
28
|
+
readonly enableTool: "启用 {tool}";
|
|
29
|
+
readonly interpreterLabel: "解释器路径";
|
|
30
|
+
readonly pythonInterpreterDescription: "Python 解释器路径或命令名,如 python3、/usr/bin/python3";
|
|
31
|
+
readonly javascriptInterpreterDescription: "Node.js 解释器路径或命令名";
|
|
32
|
+
readonly maxOutputSizeLabel: "最大输出字节";
|
|
33
|
+
readonly maxOutputSizeDescription: "stdout/stderr 各自的最大输出字节数";
|
|
34
|
+
readonly workingDirectoryLabel: "逻辑工作目录";
|
|
35
|
+
readonly workingDirectoryDescription: "脚本运行的工作目录,填 storage URI,如 workspace:/ 或 tmp:/run;相对路径按 workspace:/ 下解析。";
|
|
36
|
+
readonly sandboxLabel: "代码沙箱";
|
|
37
|
+
readonly modeLabel: "隔离模式";
|
|
38
|
+
readonly modeAuto: "自动(有沙箱则强制隔离,无则拒绝运行)";
|
|
39
|
+
readonly modeNone: "无隔离(裸进程,危险,仅信任环境)";
|
|
40
|
+
readonly modeDescription: "「自动」在系统沙箱里运行,只能写工作目录与本次临时目录,默认断网;「无隔离」直接运行,插件启动时告警。沙箱不限制读取本机文件。";
|
|
41
|
+
readonly networkLabel: "子进程网络";
|
|
42
|
+
readonly networkDeny: "断网(推荐)";
|
|
43
|
+
readonly networkAllow: "放开(粗粒度,无法按域名过滤)";
|
|
44
|
+
readonly networkDescription: "仅「隔离模式」选「自动」时生效。";
|
|
45
|
+
}>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=texts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texts.d.ts","sourceRoot":"","sources":["../src/texts.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;CAuBF,CAAC;AACX,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;EAKZ,CAAC"}
|
package/dist/texts.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// 本插件自己的原文字典:显示名、工具分组名与概述、配置项
|
|
2
|
+
import { defineTexts } from '@aalis/schema-i18n';
|
|
3
|
+
import en from './locales/en.js';
|
|
4
|
+
const SOURCE = {
|
|
5
|
+
displayName: '代码执行器',
|
|
6
|
+
groupLabel: '代码执行',
|
|
7
|
+
groupSummary: '编写并运行 Python / JavaScript 代码来解决计算、分析、文件处理等问题',
|
|
8
|
+
enableTool: '启用 {tool}',
|
|
9
|
+
interpreterLabel: '解释器路径',
|
|
10
|
+
pythonInterpreterDescription: 'Python 解释器路径或命令名,如 python3、/usr/bin/python3',
|
|
11
|
+
javascriptInterpreterDescription: 'Node.js 解释器路径或命令名',
|
|
12
|
+
maxOutputSizeLabel: '最大输出字节',
|
|
13
|
+
maxOutputSizeDescription: 'stdout/stderr 各自的最大输出字节数',
|
|
14
|
+
workingDirectoryLabel: '逻辑工作目录',
|
|
15
|
+
workingDirectoryDescription: '脚本运行的工作目录,填 storage URI,如 workspace:/ 或 tmp:/run;相对路径按 workspace:/ 下解析。',
|
|
16
|
+
sandboxLabel: '代码沙箱',
|
|
17
|
+
modeLabel: '隔离模式',
|
|
18
|
+
modeAuto: '自动(有沙箱则强制隔离,无则拒绝运行)',
|
|
19
|
+
modeNone: '无隔离(裸进程,危险,仅信任环境)',
|
|
20
|
+
modeDescription: '「自动」在系统沙箱里运行,只能写工作目录与本次临时目录,默认断网;「无隔离」直接运行,插件启动时告警。沙箱不限制读取本机文件。',
|
|
21
|
+
networkLabel: '子进程网络',
|
|
22
|
+
networkDeny: '断网(推荐)',
|
|
23
|
+
networkAllow: '放开(粗粒度,无法按域名过滤)',
|
|
24
|
+
networkDescription: '仅「隔离模式」选「自动」时生效。',
|
|
25
|
+
};
|
|
26
|
+
export const t = defineTexts({
|
|
27
|
+
ns: '@aalis/plugin-tool-code-runner',
|
|
28
|
+
language: 'zh-CN',
|
|
29
|
+
source: SOURCE,
|
|
30
|
+
locales: { en },
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=texts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texts.js","sourceRoot":"","sources":["../src/texts.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEjC,MAAM,MAAM,GAAG;IACb,WAAW,EAAE,OAAO;IACpB,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,8CAA8C;IAC5D,UAAU,EAAE,WAAW;IACvB,gBAAgB,EAAE,OAAO;IACzB,4BAA4B,EAAE,6CAA6C;IAC3E,gCAAgC,EAAE,mBAAmB;IACrD,kBAAkB,EAAE,QAAQ;IAC5B,wBAAwB,EAAE,0BAA0B;IACpD,qBAAqB,EAAE,QAAQ;IAC/B,2BAA2B,EACzB,yEAAyE;IAC3E,YAAY,EAAE,MAAM;IACpB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,qBAAqB;IAC/B,QAAQ,EAAE,mBAAmB;IAC7B,eAAe,EACb,iEAAiE;IACnE,YAAY,EAAE,OAAO;IACrB,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,iBAAiB;IAC/B,kBAAkB,EAAE,kBAAkB;CAC9B,CAAC;AAGX,MAAM,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;IAC3B,EAAE,EAAE,gCAAgC;IACpC,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,EAAE,EAAE,EAAE;CAChB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aalis/plugin-tool-code-runner",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,18 +25,19 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@aalis/api-code-sandbox": ">=0.7.0 <1.0.0",
|
|
28
|
-
"@aalis/schema-config": ">=0.
|
|
29
|
-
"@aalis/
|
|
30
|
-
"@aalis/api-
|
|
31
|
-
"@aalis/api-
|
|
28
|
+
"@aalis/schema-config": ">=0.16.0 <1.0.0",
|
|
29
|
+
"@aalis/schema-i18n": ">=0.1.0 <1.0.0",
|
|
30
|
+
"@aalis/api-process": ">=0.10.0 <1.0.0",
|
|
31
|
+
"@aalis/api-storage": ">=0.9.0 <1.0.0",
|
|
32
|
+
"@aalis/api-tools": ">=0.12.0 <1.0.0"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@types/node": "^22.0.0",
|
|
35
36
|
"typescript": "^5.7.0",
|
|
36
|
-
"@aalis/core": "0.
|
|
37
|
+
"@aalis/core": "0.21.1"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
|
-
"@aalis/core": ">=0.
|
|
40
|
+
"@aalis/core": ">=0.21.0 <1.0.0"
|
|
40
41
|
},
|
|
41
42
|
"aalis": {
|
|
42
43
|
"service": {
|