@aalis/plugin-tool-code-runner 0.10.1 → 0.12.0

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  declare const _default: import("@aalis/core").PluginDefinition<{
2
2
  tools: import("@aalis/core").OptionalUse<import("@aalis/api-tools").ToolService, import("@aalis/api-tools").BoundTools>;
3
- storage: import("@aalis/core").ServiceDescriptor<import("@aalis/api-storage").StorageService, import("@aalis/core").ServiceRef<import("@aalis/api-storage").StorageService>>;
4
- proc: import("@aalis/core").ServiceDescriptor<import("@aalis/api-process").ProcessService, import("@aalis/core").ServiceRef<import("@aalis/api-process").ProcessService>>;
5
- codeSandbox: import("@aalis/core").OptionalUse<import("@aalis/api-code-sandbox").CodeSandboxService, import("@aalis/core").ServiceRef<import("@aalis/api-code-sandbox").CodeSandboxService>>;
3
+ storage: import("@aalis/core").ServiceDescriptor<import("@aalis/api-storage").StorageService, import("@aalis/api-storage").BoundStorage>;
4
+ proc: import("@aalis/core").ServiceDescriptor<import("@aalis/api-process").ProcessService, import("@aalis/api-process").ProcessService>;
5
+ codeSandbox: import("@aalis/core").OptionalUse<import("@aalis/api-code-sandbox").CodeSandboxService, import("@aalis/api-code-sandbox").CodeSandboxService>;
6
6
  logger: import("@aalis/core").ServiceDescriptor<(identity: symbol) => import("@aalis/core").Logger, import("@aalis/core").Logger>;
7
7
  config: import("@aalis/core").ServiceDescriptor<(identity: symbol) => Readonly<Record<string, unknown>>, Readonly<Record<string, unknown>>>;
8
8
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAmJA,wBA2JG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAqJA,wBAoJG"}
package/dist/index.js CHANGED
@@ -1,90 +1,82 @@
1
1
  import { codeSandbox } from '@aalis/api-code-sandbox';
2
- import { createProcessGateway, processService } from '@aalis/api-process';
3
- import { createStorageGateway, resolveAgainstCwd, storage } from '@aalis/api-storage';
2
+ import { processService } from '@aalis/api-process';
3
+ import { resolveAgainstCwd, storage } from '@aalis/api-storage';
4
4
  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: '启用 run_python', default: true, onInvalid: 'error' },
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: 'Python 解释器路径或命令名,如 python3、/usr/bin/python3',
20
+ description: t('pythonInterpreterDescription'),
20
21
  },
21
22
  },
22
23
  },
23
24
  javascript: {
24
25
  label: 'JavaScript (Node.js)',
25
26
  fields: {
26
- enabled: { type: 'boolean', label: '启用 run_javascript', default: true, onInvalid: 'error' },
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: 'Node.js 解释器路径或命令名',
39
+ description: t('javascriptInterpreterDescription'),
34
40
  },
35
41
  },
36
42
  },
37
- defaultTimeout: {
38
- type: 'number',
39
- label: '默认超时 (ms)',
40
- default: 60000,
41
- description: '脚本执行默认超时时间',
42
- },
43
- maxTimeout: {
44
- type: 'number',
45
- label: '最大超时 (ms)',
46
- default: 300000,
47
- description: '允许指定的最大超时时间',
48
- },
49
43
  maxOutputSize: {
50
44
  type: 'number',
51
- label: '最大输出字节',
45
+ label: t('maxOutputSizeLabel'),
52
46
  default: 131072,
53
- description: 'stdout/stderr 各自的最大输出字节数',
47
+ description: t('maxOutputSizeDescription'),
54
48
  },
55
49
  workingDirectory: {
56
50
  type: 'string',
57
- label: '逻辑工作目录',
51
+ label: t('workingDirectoryLabel'),
58
52
  default: 'workspace:/',
59
53
  onInvalid: 'error',
60
- description: '脚本执行时的 storage URI 工作目录,如 workspace:/ 或 tmp:/run;相对路径会解释为 workspace:/ 下路径。',
54
+ description: t('workingDirectoryDescription'),
61
55
  },
62
56
  sandbox: {
63
- label: '代码沙箱',
57
+ label: t('sandboxLabel'),
64
58
  fields: {
65
59
  mode: {
66
60
  type: 'select',
67
- label: '隔离模式',
61
+ label: t('modeLabel'),
68
62
  default: 'auto',
69
63
  onInvalid: 'error',
70
64
  options: [
71
- { label: '自动(有沙箱则强制隔离,无则拒绝运行)', value: 'auto' },
72
- { label: '无隔离(裸进程,危险,仅信任环境)', value: 'none' },
65
+ { label: t('modeAuto'), value: 'auto' },
66
+ { label: t('modeNone'), value: 'none' },
73
67
  ],
74
- description: 'auto:经 code-sandbox 服务(Linux bubblewrap / macOS sandbox-exec)把代码限制在「工作区 + 本次临时目录」、默认断网、' +
75
- '只放行白名单环境变量;无可用沙箱后端时拒绝执行(fail-closed)。none:退回无隔离裸进程,每次告警。' +
76
- '说明:v1 读放开(解释器需系统库),防的是写出工作区/联网外泄/篡改系统,不防读取本机其它文件。',
68
+ description: t('modeDescription'),
77
69
  },
78
70
  network: {
79
71
  type: 'select',
80
- label: '子进程网络',
72
+ label: t('networkLabel'),
81
73
  default: 'deny',
82
74
  onInvalid: 'error',
83
75
  options: [
84
- { label: '断网(推荐)', value: 'deny' },
85
- { label: '放开(粗粒度,无法按域名过滤)', value: 'allow' },
76
+ { label: t('networkDeny'), value: 'deny' },
77
+ { label: t('networkAllow'), value: 'allow' },
86
78
  ],
87
- description: '仅 auto 模式生效。deny:脚本内联网(含 fetch)会失败。allow:放开子进程网络(无法按域名白名单过滤)。',
79
+ description: t('networkDescription'),
88
80
  },
89
81
  },
90
82
  },
@@ -92,8 +84,24 @@ const configSchema = defineConfig({
92
84
  function toRunnerCwdUri(input) {
93
85
  return resolveAgainstCwd(input, 'workspace:/');
94
86
  }
87
+ /**
88
+ * 交给脚本的环境变量白名单,两种模式下都只交这些(runner 另加 PYTHONIOENCODING)。SystemRoot 以下几项给 Windows:
89
+ * 它没有沙箱后端、只能 mode=none,系统组件要 SystemRoot 等,解释器的临时目录与用户目录取 TEMP、TMP、USERPROFILE
90
+ */
95
91
  function safeEnv() {
96
- const keep = ['PATH', 'LANG', 'LC_ALL', 'TERM', 'SystemRoot', 'WINDIR', 'COMSPEC', 'PATHEXT'];
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
+ ];
97
105
  const env = {};
98
106
  for (const key of keep) {
99
107
  if (process.env[key])
@@ -113,45 +121,41 @@ const uses = {
113
121
  config,
114
122
  };
115
123
  async function createRunnerConfig(caps, cfg) {
116
- if (!caps.storage.all().some(e => typeof e.instance.resolveLocalPath === 'function')) {
117
- throw new Error('代码执行器需要至少一个支持 local-path 的 storage entry');
118
- }
119
- const gateway = createStorageGateway(caps.storage);
124
+ if (!caps.storage.present)
125
+ throw new Error('代码执行器需要 storage 服务');
126
+ const gateway = caps.storage.use;
120
127
  const cwdUri = toRunnerCwdUri(cfg.workingDirectory);
121
128
  return {
122
- defaultTimeout: cfg.defaultTimeout,
123
- maxTimeout: cfg.maxTimeout,
124
129
  maxOutputSize: cfg.maxOutputSize,
125
130
  cwd: await gateway.resolveLocalPath(cwdUri, 'read'),
126
131
  env: safeEnv(),
127
132
  // mode='none' → 不带 sandbox(裸跑);mode='auto' → 带策略,runCode 经 code-sandbox 强制隔离或 fail-closed
128
133
  sandbox: cfg.sandbox.mode === 'none' ? undefined : { network: cfg.sandbox.network },
129
- codeSandbox: caps.codeSandbox.current,
134
+ codeSandbox: caps.codeSandbox.present ? caps.codeSandbox.use : undefined,
130
135
  };
131
136
  }
132
137
  export default definePlugin({
133
138
  name: '@aalis/plugin-tool-code-runner',
134
- displayName: '代码执行器',
139
+ displayName: t('displayName'),
135
140
  subsystem: 'tools',
136
141
  configSchema,
137
142
  uses,
138
143
  apply(caps) {
139
144
  const { tools, proc, storage, codeSandbox, logger } = caps;
140
- const cfg = parseConfig(configSchema, caps.config, logger);
145
+ const cfg = parseConfig(configSchema, caps.config.use, logger.use);
141
146
  if (cfg.sandbox.mode === 'none') {
142
- logger.warn('⚠️ code-runner 运行在【无隔离】模式(sandbox.mode=none):代码以宿主用户全权限裸跑,仅在完全可信环境使用。');
147
+ logger.use.warn('注意:code-runner 运行在【无隔离】模式(sandbox.mode=none):代码以宿主用户全权限裸跑,仅在完全可信环境使用。');
143
148
  }
144
149
  const cwdUri = toRunnerCwdUri(cfg.workingDirectory);
145
- const processGateway = createProcessGateway(proc);
146
- const storageGateway = createStorageGateway(storage);
147
150
  // 每次调用现取:cwd 要按当时的 storage 实况解析,沙箱后端也可能中途上下线
148
151
  const runnerDeps = { storage, codeSandbox };
149
152
  // 创建带分组标记的工具视图
150
- const groupTools = withToolGroups(tools, ['code-runner']);
153
+ const groupTools = withToolGroups(tools.use, ['code-runner']);
151
154
  // 注册工具分组
152
- tools.registerGroup({
155
+ tools.use.registerGroup({
153
156
  name: 'code-runner',
154
- label: '代码执行',
157
+ label: t('groupLabel'),
158
+ summary: t('groupSummary'),
155
159
  description: '编写并运行 Python / JavaScript 代码来解决计算、分析、文件处理等问题',
156
160
  });
157
161
  const osName = process.platform === 'darwin' ? 'macOS' : process.platform === 'win32' ? 'Windows' : 'Linux';
@@ -184,10 +188,6 @@ export default definePlugin({
184
188
  type: 'string',
185
189
  description: '完整的 Python 脚本源代码',
186
190
  },
187
- timeout: {
188
- type: 'number',
189
- description: `超时毫秒数(可选,默认 ${cfg.defaultTimeout},最大 ${cfg.maxTimeout})`,
190
- },
191
191
  },
192
192
  required: ['code'],
193
193
  additionalProperties: false,
@@ -195,16 +195,16 @@ export default definePlugin({
195
195
  },
196
196
  },
197
197
  visibility: 'restricted',
198
- handler: async (args) => {
198
+ background: {},
199
+ handler: async (args, callCtx) => {
199
200
  const code = args.code;
200
- const timeout = args.timeout;
201
- logger.debug(`run_python: ${code.length} 字符`);
201
+ logger.use.debug(`run_python: ${code.length} 字符`);
202
202
  const runnerConfig = await createRunnerConfig(runnerDeps, cfg);
203
- const result = await runCode(processGateway, storageGateway, cfg.python.interpreter, code, '.py', runnerConfig, timeout);
203
+ const result = await runCode(proc.use, storage.use, cfg.python.interpreter, code, '.py', runnerConfig, [], callCtx.signal);
204
204
  return JSON.stringify(result);
205
205
  },
206
206
  });
207
- logger.info(`Python 代码执行工具已启用 (解释器: ${cfg.python.interpreter})`);
207
+ logger.use.info(`Python 代码执行工具已启用 (解释器: ${cfg.python.interpreter})`);
208
208
  }
209
209
  // ==================== run_javascript ====================
210
210
  if (cfg.javascript.enabled) {
@@ -232,10 +232,6 @@ export default definePlugin({
232
232
  type: 'string',
233
233
  description: '完整的 JavaScript (Node.js ESM) 脚本源代码',
234
234
  },
235
- timeout: {
236
- type: 'number',
237
- description: `超时毫秒数(可选,默认 ${cfg.defaultTimeout},最大 ${cfg.maxTimeout})`,
238
- },
239
235
  },
240
236
  required: ['code'],
241
237
  additionalProperties: false,
@@ -243,18 +239,18 @@ export default definePlugin({
243
239
  },
244
240
  },
245
241
  visibility: 'restricted',
246
- handler: async (args) => {
242
+ background: {},
243
+ handler: async (args, callCtx) => {
247
244
  const code = args.code;
248
- const timeout = args.timeout;
249
- logger.debug(`run_javascript: ${code.length} 字符`);
245
+ logger.use.debug(`run_javascript: ${code.length} 字符`);
250
246
  const runnerConfig = await createRunnerConfig(runnerDeps, cfg);
251
- const result = await runCode(processGateway, storageGateway, cfg.javascript.interpreter, code, '.mjs', runnerConfig, timeout);
247
+ const result = await runCode(proc.use, storage.use, cfg.javascript.interpreter, code, '.mjs', runnerConfig, [], callCtx.signal);
252
248
  return JSON.stringify(result);
253
249
  },
254
250
  });
255
- logger.info(`JavaScript 代码执行工具已启用 (解释器: ${cfg.javascript.interpreter})`);
251
+ logger.use.info(`JavaScript 代码执行工具已启用 (解释器: ${cfg.javascript.interpreter})`);
256
252
  }
257
- logger.info(`代码执行器插件已启动 (工作目录: ${cwdUri})`);
253
+ logger.use.info(`代码执行器插件已启动 (工作目录: ${cwdUri})`);
258
254
  },
259
255
  });
260
256
  //# sourceMappingURL=index.js.map
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,oBAAoB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACtF,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;AAEzD,MAAM,YAAY,GAAG,YAAY,CAAC;IAChC,MAAM,EAAE;QACN,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE;YACN,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,OAAO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E;oCACJ,IAAI,EAAE,QAAQ;oCACd,WAAW,EAAE,oCAAoC;iCAClD;6BACF;4BACD,QAAQ,EAAE,CAAC,MAAM,CAAC;4BAClB,oBAAoB,EAAE,KAAK;yBAC5B;qBACF;iBACF;gBACD,UAAU,EAAE,YAAY;gBACxB,UAAU,EAAE,EAAE;gBACd,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;oBAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAc,CAAC;oBACjC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,mBAAmB,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;oBACtD,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;oBAC/D,MAAM,MAAM,GAAG,MAAM,OAAO,CAC1B,IAAI,CAAC,GAAG,EACR,OAAO,CAAC,GAAG,EACX,GAAG,CAAC,UAAU,CAAC,WAAW,EAC1B,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,EAAE,EACF,OAAO,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 (a storage URI) for running scripts, 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: "auto: through the code-sandbox service (Linux bubblewrap / macOS sandbox-exec), code is confined to “the workspace + this run's temporary directory”, has no network by default, and only allowlisted environment variables are passed; with no sandbox backend available, it refuses to run (fail-closed). none: falls back to a bare process without isolation, warning every time. Note: v1 leaves reads open (interpreters need system libraries); it guards against writing outside the workspace, exfiltrating over the network and tampering with the system, not against reading other 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 in auto mode. deny: network access from the script (including fetch) fails. allow: opens the child process network (cannot be filtered by a domain allowlist).";
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,wBAyBG"}
@@ -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 (a storage URI) for running scripts, 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: "auto: through the code-sandbox service (Linux bubblewrap / macOS sandbox-exec), code is confined to “the workspace + this run's temporary directory”, has no network by default, and only allowlisted environment variables are passed; with no sandbox backend available, it refuses to run (fail-closed). none: falls back to a bare process without isolation, warning every time. Note: v1 leaves reads open (interpreters need system libraries); it guards against writing outside the workspace, exfiltrating over the network and tampering with the system, not against reading other 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 in auto mode. deny: network access from the script (including fetch) fails. allow: opens the child process network (cannot be filtered by a domain allowlist).',
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,wIAAwI;IAC1I,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,oFAAoF;IAC9F,QAAQ,EAAE,mEAAmE;IAC7E,eAAe,EACb,ulBAAulB;IACzlB,YAAY,EAAE,uBAAuB;IACrC,WAAW,EAAE,0BAA0B;IACvC,YAAY,EAAE,2CAA2C;IACzD,kBAAkB,EAChB,kLAAkL;CACrL,CAAC,CAAC"}
package/dist/runner.d.ts CHANGED
@@ -8,13 +8,10 @@ import type { CodeSandboxService } from '@aalis/api-code-sandbox';
8
8
  import type { ProcessService } from '@aalis/api-process';
9
9
  import type { StorageService } from '@aalis/api-storage';
10
10
  export interface RunnerConfig {
11
- defaultTimeout: number;
12
- maxTimeout: number;
13
11
  maxOutputSize: number;
14
12
  /** 子进程 cwd(已通过 storage.resolveLocalPath 解析的本地路径) */
15
13
  cwd: string;
16
- /** 透传给子进程的环境变量。仅沙箱路径(env -i 真清)构成白名单隔离;
17
- * 非沙箱路径走 process-local,env 被**叠加**在宿主全量环境之上(提供与否都合并),无隔离作用 */
14
+ /** 子进程只拿到这些环境变量(白名单):沙箱路径经 env -i 清空后注入,非沙箱路径由进程服务按替换语义交给子进程 */
18
15
  env?: Record<string, string | undefined>;
19
16
  /**
20
17
  * 沙箱:给定即要求 OS 隔离(写白名单 = [cwd, 本次临时目录]、网络按 network、env 仅白名单);
@@ -30,20 +27,26 @@ export interface RunResult {
30
27
  exitCode: number;
31
28
  stdout: string;
32
29
  stderr: string;
33
- timedOut?: boolean;
30
+ /** 脚本没能运行(沙箱不可用、起进程失败),或没被中止而以非零退出(「退出码 N」)、被信号结束:带 error 的工具结果判为失败 */
34
31
  error?: string;
32
+ /** 调用被中止且脚本是被信号结束的 */
33
+ aborted?: true;
34
+ /** 随 aborted 给出的文字说明(与 exec 的「命令已中止」同一口径) */
35
+ message?: string;
36
+ /** 调用已中止、但脚本不是被信号结束的(中止前已正常退出等):按实际退出回报并加此注 */
37
+ note?: string;
35
38
  }
36
39
  /**
37
- * 执行代码脚本
40
+ * 执行代码脚本。不另设超时:等多久由执行器的让出时限管,停只认 signal
38
41
  *
39
42
  * @param proc ProcessService 句柄
40
43
  * @param storage StorageService(用于写脚本到 tmp)
41
44
  * @param interpreter 解释器路径 (python3 / node)
42
45
  * @param code 完整源代码
43
46
  * @param ext 临时文件扩展名 (.py / .mjs)
44
- * @param config 超时 / 输出限制
45
- * @param timeout 可选自定义超时
47
+ * @param config 输出限制、工作目录与沙箱
46
48
  * @param extraArgs 额外的解释器参数
49
+ * @param signal 执行器给这次调用的中止信号:中止时经 process 服务(或 code-sandbox)按进程组停掉脚本
47
50
  */
48
- export declare function runCode(proc: ProcessService, storage: StorageService, interpreter: string, code: string, ext: string, config: RunnerConfig, timeout?: number, extraArgs?: string[]): Promise<RunResult>;
51
+ export declare function runCode(proc: ProcessService, storage: StorageService, interpreter: string, code: string, ext: string, config: RunnerConfig, extraArgs?: string[], signal?: AbortSignal): Promise<RunResult>;
49
52
  //# sourceMappingURL=runner.d.ts.map
@@ -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,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ;mEAC+D;IAC/D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS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CAAC;CAClC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,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
@@ -12,19 +12,18 @@ function truncateOutput(output, maxSize) {
12
12
  return `${truncated}\n...[输出截断,超过 ${maxSize} 字节]`;
13
13
  }
14
14
  /**
15
- * 执行代码脚本
15
+ * 执行代码脚本。不另设超时:等多久由执行器的让出时限管,停只认 signal
16
16
  *
17
17
  * @param proc ProcessService 句柄
18
18
  * @param storage StorageService(用于写脚本到 tmp)
19
19
  * @param interpreter 解释器路径 (python3 / node)
20
20
  * @param code 完整源代码
21
21
  * @param ext 临时文件扩展名 (.py / .mjs)
22
- * @param config 超时 / 输出限制
23
- * @param timeout 可选自定义超时
22
+ * @param config 输出限制、工作目录与沙箱
24
23
  * @param extraArgs 额外的解释器参数
24
+ * @param signal 执行器给这次调用的中止信号:中止时经 process 服务(或 code-sandbox)按进程组停掉脚本
25
25
  */
26
- export async function runCode(proc, storage, interpreter, code, ext, config, timeout, extraArgs = []) {
27
- const effectiveTimeout = Math.min(Math.max(1000, timeout ?? config.defaultTimeout), config.maxTimeout);
26
+ export async function runCode(proc, storage, interpreter, code, ext, config, extraArgs = [], signal) {
28
27
  const tmp = await proc.makeTempDir('code-runner');
29
28
  try {
30
29
  const scriptUri = `${tmp.uri}/script${ext}`;
@@ -54,32 +53,44 @@ export async function runCode(proc, storage, interpreter, code, ext, config, tim
54
53
  args: [...extraArgs, scriptPath],
55
54
  cwd: config.cwd,
56
55
  env,
57
- timeout: effectiveTimeout,
56
+ signal,
58
57
  policy,
59
58
  })
60
59
  : await proc.execFile(interpreter, [...extraArgs, scriptPath], {
61
60
  cwd: config.cwd,
62
61
  env,
63
- timeout: effectiveTimeout,
62
+ signal,
64
63
  });
65
- return {
64
+ const output = {
66
65
  exitCode: result.code ?? -1,
67
66
  stdout: truncateOutput(result.stdout, config.maxOutputSize),
68
67
  stderr: truncateOutput(result.stderr, config.maxOutputSize),
69
68
  };
69
+ // 退出码 0 不是被信号结束的:调用已中止也按实际退出回报,只注明
70
+ return signal?.aborted ? { ...output, note: '调用已中止' } : output;
70
71
  }
71
72
  catch (err) {
72
73
  // ProcessService.execFile 在非 0 退出时抛错,但会把 .result 挂上
73
74
  const e = err;
74
75
  if (e.result) {
75
- const timedOut = e.result.signal === 'SIGKILL';
76
- return {
76
+ const output = {
77
77
  exitCode: e.result.code ?? -1,
78
78
  stdout: truncateOutput(e.result.stdout, config.maxOutputSize),
79
79
  stderr: truncateOutput(e.result.stderr, config.maxOutputSize),
80
- ...(timedOut ? { timedOut: true } : {}),
81
80
  };
81
+ if (signal?.aborted) {
82
+ // 被信号结束的才说被中止(中止宽限到点的 SIGKILL 也算);中止前已退出或 Windows 下强制结束
83
+ // (signal 可能为 null)的按实际退出回报,免得下一轮把已经生效的脚本再跑一遍
84
+ if (e.result.signal !== null)
85
+ return { ...output, aborted: true, message: '代码已中止' };
86
+ return { ...output, note: '调用已中止' };
87
+ }
88
+ const ended = e.result.signal !== null ? `被信号 ${e.result.signal} 结束` : `退出码 ${output.exitCode}`;
89
+ return { ...output, error: ended };
82
90
  }
91
+ // 没有退出结果:spawn 失败,或已中止时 spawn 同步抛出(不起进程)
92
+ if (signal?.aborted)
93
+ return { exitCode: -1, stdout: '', stderr: '', aborted: true, message: '代码已中止' };
83
94
  return {
84
95
  exitCode: -1,
85
96
  stdout: '',
@@ -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;AA+BrC,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,OAAuB,EACvB,WAAmB,EACnB,IAAY,EACZ,GAAW,EACX,MAAoB,EACpB,OAAgB,EAChB,YAAsB,EAAE;IAExB,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,MAAM,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IACvG,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAClD,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,GAAG,GAAG,CAAC,GAAG,UAAU,GAAG,EAAE,CAAC;QAC5C,MAAM,OAAO,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,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E,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"}
@@ -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: "auto:经 code-sandbox 服务(Linux bubblewrap / macOS sandbox-exec)把代码限制在「工作区 + 本次临时目录」、默认断网、只放行白名单环境变量;无可用沙箱后端时拒绝执行(fail-closed)。none:退回无隔离裸进程,每次告警。说明:v1 读放开(解释器需系统库),防的是写出工作区/联网外泄/篡改系统,不防读取本机其它文件。";
18
+ readonly networkLabel: "子进程网络";
19
+ readonly networkDeny: "断网(推荐)";
20
+ readonly networkAllow: "放开(粗粒度,无法按域名过滤)";
21
+ readonly networkDescription: "仅 auto 模式生效。deny:脚本内联网(含 fetch)会失败。allow:放开子进程网络(无法按域名白名单过滤)。";
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: "auto:经 code-sandbox 服务(Linux bubblewrap / macOS sandbox-exec)把代码限制在「工作区 + 本次临时目录」、默认断网、只放行白名单环境变量;无可用沙箱后端时拒绝执行(fail-closed)。none:退回无隔离裸进程,每次告警。说明:v1 读放开(解释器需系统库),防的是写出工作区/联网外泄/篡改系统,不防读取本机其它文件。";
41
+ readonly networkLabel: "子进程网络";
42
+ readonly networkDeny: "断网(推荐)";
43
+ readonly networkAllow: "放开(粗粒度,无法按域名过滤)";
44
+ readonly networkDescription: "仅 auto 模式生效。deny:脚本内联网(含 fetch)会失败。allow:放开子进程网络(无法按域名白名单过滤)。";
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;;;;;;;;;;;;;;;;;;;;;CAwBF,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: 'auto:经 code-sandbox 服务(Linux bubblewrap / macOS sandbox-exec)把代码限制在「工作区 + 本次临时目录」、默认断网、只放行白名单环境变量;无可用沙箱后端时拒绝执行(fail-closed)。none:退回无隔离裸进程,每次告警。说明:v1 读放开(解释器需系统库),防的是写出工作区/联网外泄/篡改系统,不防读取本机其它文件。',
21
+ networkLabel: '子进程网络',
22
+ networkDeny: '断网(推荐)',
23
+ networkAllow: '放开(粗粒度,无法按域名过滤)',
24
+ networkDescription: '仅 auto 模式生效。deny:脚本内联网(含 fetch)会失败。allow:放开子进程网络(无法按域名白名单过滤)。',
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,4EAA4E;IAC9E,YAAY,EAAE,MAAM;IACpB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,qBAAqB;IAC/B,QAAQ,EAAE,mBAAmB;IAC7B,eAAe,EACb,kMAAkM;IACpM,YAAY,EAAE,OAAO;IACrB,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,iBAAiB;IAC/B,kBAAkB,EAChB,+DAA+D;CACzD,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.10.1",
3
+ "version": "0.12.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,19 +24,20 @@
24
24
  "dist"
25
25
  ],
26
26
  "dependencies": {
27
- "@aalis/api-code-sandbox": ">=0.6.0 <1.0.0",
28
- "@aalis/schema-config": ">=0.14.0 <1.0.0",
29
- "@aalis/api-process": ">=0.7.0 <1.0.0",
30
- "@aalis/api-storage": ">=0.6.0 <1.0.0",
31
- "@aalis/api-tools": ">=0.9.0 <1.0.0"
27
+ "@aalis/api-code-sandbox": ">=0.7.0 <1.0.0",
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.19.1"
37
+ "@aalis/core": "0.21.0"
37
38
  },
38
39
  "peerDependencies": {
39
- "@aalis/core": ">=0.17.0 <1.0.0"
40
+ "@aalis/core": ">=0.21.0 <1.0.0"
40
41
  },
41
42
  "aalis": {
42
43
  "service": {