@zhin.js/plugin-code-runner 1.1.0 → 1.1.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/commands/run/{[language].js → [language]/index.js} +1 -1
- package/commands/run/{[language].ts → [language]/index.ts} +1 -1
- package/package.json +18 -10
- package/skills/code-runner/tools/run_code/index.js +17 -0
- package/{agent/tools/run_code.ts → skills/code-runner/tools/run_code/index.ts} +2 -2
- /package/{agent/skills/code-runner.md → skills/code-runner/SKILL.md} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
2
|
import { defineCommand } from 'zhin.js/command';
|
|
3
|
-
import { formatResult, runCode } from "
|
|
3
|
+
import { formatResult, runCode } from "../../../lib/run-code.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
description: '在沙箱中运行代码片段(/code-runner run <语言> <代码>)',
|
|
6
6
|
params: { language: { type: 'string' } },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineCommand } from 'zhin.js/command';
|
|
2
|
-
import { formatResult, runCode } from '
|
|
2
|
+
import { formatResult, runCode } from '../../../src/run-code.js';
|
|
3
3
|
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
description: '在沙箱中运行代码片段(/code-runner run <语言> <代码>)',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/plugin-code-runner",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Sandboxed code execution plugin for Zhin.js (Plugin Runtime)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"commands",
|
|
20
20
|
"src",
|
|
21
21
|
"lib",
|
|
22
|
-
"
|
|
22
|
+
"tools",
|
|
23
|
+
"skills",
|
|
23
24
|
"README.md"
|
|
24
25
|
],
|
|
25
26
|
"keywords": [
|
|
@@ -41,19 +42,14 @@
|
|
|
41
42
|
"typescript": "^6.0.3",
|
|
42
43
|
"vitest": "^4.1.10",
|
|
43
44
|
"zod": "^4.4.3",
|
|
44
|
-
"
|
|
45
|
-
"zhin.js": "1.1.0"
|
|
45
|
+
"zhin.js": "1.1.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"zod": "^4.0.0",
|
|
49
|
-
"@zhin.js/
|
|
50
|
-
"
|
|
51
|
-
"zhin.js": "^1.1.0"
|
|
49
|
+
"@zhin.js/command": "^1.1.1",
|
|
50
|
+
"zhin.js": "^1.1.2"
|
|
52
51
|
},
|
|
53
52
|
"peerDependenciesMeta": {
|
|
54
|
-
"@zhin.js/agent": {
|
|
55
|
-
"optional": true
|
|
56
|
-
},
|
|
57
53
|
"@zhin.js/command": {
|
|
58
54
|
"optional": true
|
|
59
55
|
},
|
|
@@ -83,10 +79,22 @@
|
|
|
83
79
|
{
|
|
84
80
|
"package": "@zhin.js/command",
|
|
85
81
|
"api": "^1.0.0"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"package": "@zhin.js/tool",
|
|
85
|
+
"api": "^1.0.0"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"package": "@zhin.js/skill",
|
|
89
|
+
"api": "^1.0.0"
|
|
86
90
|
}
|
|
87
91
|
],
|
|
88
92
|
"plugins": []
|
|
89
93
|
},
|
|
94
|
+
"dependencies": {
|
|
95
|
+
"@zhin.js/tool": "1.1.1",
|
|
96
|
+
"@zhin.js/skill": "1.1.1"
|
|
97
|
+
},
|
|
90
98
|
"scripts": {
|
|
91
99
|
"build": "tsc",
|
|
92
100
|
"clean": "rimraf lib",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { defineAgentTool } from '@zhin.js/tool';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
import { formatResult, runCode } from "../../../../lib/run-code.js";
|
|
5
|
+
export default defineAgentTool({
|
|
6
|
+
description: '在沙箱中运行代码片段,返回 stdout/stderr/error',
|
|
7
|
+
inputSchema: z.object({
|
|
8
|
+
language: z.string().min(1),
|
|
9
|
+
code: z.string().min(1),
|
|
10
|
+
}),
|
|
11
|
+
keywords: ['运行代码', '执行代码', 'run code', 'execute', '代码'],
|
|
12
|
+
tags: ['code', 'run', 'execute', 'sandbox'],
|
|
13
|
+
async execute({ language, code }) {
|
|
14
|
+
const result = await runCode(language, code);
|
|
15
|
+
return formatResult(result);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineAgentTool } from '@zhin.js/
|
|
1
|
+
import { defineAgentTool } from '@zhin.js/tool';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { formatResult, runCode } from '
|
|
3
|
+
import { formatResult, runCode } from '../../../../src/run-code.js';
|
|
4
4
|
|
|
5
5
|
export default defineAgentTool<{ language: string; code: string }>({
|
|
6
6
|
description: '在沙箱中运行代码片段,返回 stdout/stderr/error',
|
|
File without changes
|