@zhin.js/runtime 1.1.6 → 1.1.7
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/lib/config-composer.d.ts
CHANGED
|
@@ -234,6 +234,28 @@ export declare const HOST_CONFIG_SCHEMA: {
|
|
|
234
234
|
description: string;
|
|
235
235
|
"x-descriptionZh": string;
|
|
236
236
|
};
|
|
237
|
+
network: {
|
|
238
|
+
type: string;
|
|
239
|
+
additionalProperties: boolean;
|
|
240
|
+
description: string;
|
|
241
|
+
"x-descriptionZh": string;
|
|
242
|
+
properties: {
|
|
243
|
+
enabled: {
|
|
244
|
+
type: string;
|
|
245
|
+
default: boolean;
|
|
246
|
+
description: string;
|
|
247
|
+
"x-descriptionZh": string;
|
|
248
|
+
};
|
|
249
|
+
allowedDomains: {
|
|
250
|
+
type: string;
|
|
251
|
+
items: {
|
|
252
|
+
type: string;
|
|
253
|
+
};
|
|
254
|
+
description: string;
|
|
255
|
+
"x-descriptionZh": string;
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
};
|
|
237
259
|
masterShell: {
|
|
238
260
|
type: string;
|
|
239
261
|
enum: string[];
|
|
@@ -152,6 +152,26 @@
|
|
|
152
152
|
"description": "Command allowlist preset used outside full mode.",
|
|
153
153
|
"x-descriptionZh": "非 full 模式使用的命令白名单预设。"
|
|
154
154
|
},
|
|
155
|
+
"network": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"additionalProperties": false,
|
|
158
|
+
"description": "Network access for IM turns (web_fetch / web_search and networked commands). Off by default; enabled allows HTTPS egress, optionally limited to allowedDomains. When enabled is unset, execPreset: network still enables it for compatibility.",
|
|
159
|
+
"x-descriptionZh": "IM 回合的出网权限(web_fetch / web_search 与联网命令)。默认关闭;enabled 开启 HTTPS 出网,allowedDomains 非空时只允许这些域名。未设置 enabled 时兼容旧配置:execPreset: network 视为开启。",
|
|
160
|
+
"properties": {
|
|
161
|
+
"enabled": {
|
|
162
|
+
"type": "boolean",
|
|
163
|
+
"default": false,
|
|
164
|
+
"description": "Allow HTTPS egress for IM turns.",
|
|
165
|
+
"x-descriptionZh": "是否允许 IM 回合 HTTPS 出网。"
|
|
166
|
+
},
|
|
167
|
+
"allowedDomains": {
|
|
168
|
+
"type": "array",
|
|
169
|
+
"items": { "type": "string" },
|
|
170
|
+
"description": "When non-empty, only these domains (and their subdomains) are reachable.",
|
|
171
|
+
"x-descriptionZh": "非空时只允许访问这些域名(含子域名)。"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
155
175
|
"masterShell": {
|
|
156
176
|
"type": "string",
|
|
157
177
|
"enum": ["off", "isolated"],
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const TOOL_PACKAGE_INSTALL_HINT = "\u7F3A\u5C11\u4F9D\u8D56 @zhin.js/tool\uFF08tools/ \u4E0B\u7684 defineAgentTool \u9700\u8981\u5B83\uFF09\u3002\u8BF7\u8FD0\u884C: pnpm add @zhin.js/tool";
|
|
2
|
+
/** True only for ERR_MODULE_NOT_FOUND naming the `@zhin.js/tool` package root. */
|
|
3
|
+
export declare function isToolPackageMissing(error: unknown): boolean;
|
|
4
|
+
/** Return an error that carries the exact install command when `@zhin.js/tool` is missing. */
|
|
5
|
+
export declare function withToolPackageInstallHint(error: unknown): unknown;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const TOOL_PACKAGE = '@zhin.js/tool';
|
|
2
|
+
const TOOL_ROOT_SPECIFIER = /['"]@zhin\.js\/tool['"]/u;
|
|
3
|
+
export const TOOL_PACKAGE_INSTALL_HINT = `缺少依赖 ${TOOL_PACKAGE}(tools/ 下的 defineAgentTool 需要它)。请运行: pnpm add ${TOOL_PACKAGE}`;
|
|
4
|
+
/** True only for ERR_MODULE_NOT_FOUND naming the `@zhin.js/tool` package root. */
|
|
5
|
+
export function isToolPackageMissing(error) {
|
|
6
|
+
if (!error || typeof error !== 'object')
|
|
7
|
+
return false;
|
|
8
|
+
const { code, message } = error;
|
|
9
|
+
return code === 'ERR_MODULE_NOT_FOUND'
|
|
10
|
+
&& typeof message === 'string'
|
|
11
|
+
&& TOOL_ROOT_SPECIFIER.test(message);
|
|
12
|
+
}
|
|
13
|
+
/** Return an error that carries the exact install command when `@zhin.js/tool` is missing. */
|
|
14
|
+
export function withToolPackageInstallHint(error) {
|
|
15
|
+
if (!isToolPackageMissing(error))
|
|
16
|
+
return error;
|
|
17
|
+
const original = error;
|
|
18
|
+
const augmented = new Error(`${TOOL_PACKAGE_INSTALL_HINT}\n原始错误: ${original.message}`, { cause: error });
|
|
19
|
+
augmented.code = original.code;
|
|
20
|
+
return augmented;
|
|
21
|
+
}
|
|
@@ -3,6 +3,7 @@ import { readdirSync, statSync, watch as watchDirectory, } from 'node:fs';
|
|
|
3
3
|
import { basename, extname, isAbsolute, relative, resolve, sep } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { ModuleDependencyIndex, } from './module-dependency-index.js';
|
|
6
|
+
import { withToolPackageInstallHint } from './missing-tool-package.js';
|
|
6
7
|
import { ensureTypeScriptSpecifierRemap } from './typescript-specifier-remap.js';
|
|
7
8
|
const ignoredDirectories = new Set([
|
|
8
9
|
'.git', '.zhin', 'coverage', 'data', 'dist', 'lib', 'node_modules',
|
|
@@ -53,9 +54,14 @@ export class NativeDevelopmentModuleRuntime {
|
|
|
53
54
|
}
|
|
54
55
|
catch (error) {
|
|
55
56
|
if (!normalized.endsWith('.tsx') || !isUnsupportedTsxError(error) || !this.#tsxLoader) {
|
|
56
|
-
throw error;
|
|
57
|
+
throw withToolPackageInstallHint(error);
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
loaded = await this.#tsxLoader.load(url.href, pathToFileURL(`${this.#projectRoot}${sep}`).href);
|
|
61
|
+
}
|
|
62
|
+
catch (tsxError) {
|
|
63
|
+
throw withToolPackageInstallHint(tsxError);
|
|
57
64
|
}
|
|
58
|
-
loaded = await this.#tsxLoader.load(url.href, pathToFileURL(`${this.#projectRoot}${sep}`).href);
|
|
59
65
|
}
|
|
60
66
|
if (this.#pendingDependencies)
|
|
61
67
|
this.#pendingDependencies.set(normalized, analysis);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/runtime",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Static Plugin graph, generation transaction and HMR Root runtime for Zhin.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./lib/index.d.ts",
|
|
11
|
-
"development": "./src/index.ts",
|
|
12
11
|
"import": "./lib/index.js"
|
|
13
12
|
}
|
|
14
13
|
},
|
|
@@ -20,25 +19,25 @@
|
|
|
20
19
|
"es-module-lexer": "2.3.1",
|
|
21
20
|
"import-meta-resolve": "4.2.0",
|
|
22
21
|
"semver": "7.8.5",
|
|
23
|
-
"@zhin.js/feature-kit": "1.1.
|
|
24
|
-
"@zhin.js/plugin-runtime": "1.1.
|
|
22
|
+
"@zhin.js/feature-kit": "1.1.5",
|
|
23
|
+
"@zhin.js/plugin-runtime": "1.1.14"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
26
|
"@types/node": "^26.1.2",
|
|
28
27
|
"tsx": "^4.23.1",
|
|
29
28
|
"typescript": "^6.0.3",
|
|
30
|
-
"@zhin.js/
|
|
31
|
-
"@zhin.js/
|
|
32
|
-
"@zhin.js/
|
|
33
|
-
"@zhin.js/component": "1.1.
|
|
34
|
-
"@zhin.js/handler": "1.1.
|
|
35
|
-
"@zhin.js/layout": "1.1.
|
|
36
|
-
"@zhin.js/mcp-feature": "1.1.
|
|
37
|
-
"@zhin.js/middleware": "1.1.
|
|
38
|
-
"@zhin.js/page": "1.1.
|
|
39
|
-
"@zhin.js/prompt-section": "1.1.
|
|
40
|
-
"@zhin.js/skill": "1.1.
|
|
41
|
-
"@zhin.js/tool": "1.1.
|
|
29
|
+
"@zhin.js/agent-feature": "1.1.6",
|
|
30
|
+
"@zhin.js/command": "1.1.7",
|
|
31
|
+
"@zhin.js/adapter": "1.1.19",
|
|
32
|
+
"@zhin.js/component": "1.1.6",
|
|
33
|
+
"@zhin.js/handler": "1.1.5",
|
|
34
|
+
"@zhin.js/layout": "1.1.6",
|
|
35
|
+
"@zhin.js/mcp-feature": "1.1.6",
|
|
36
|
+
"@zhin.js/middleware": "1.1.6",
|
|
37
|
+
"@zhin.js/page": "1.1.6",
|
|
38
|
+
"@zhin.js/prompt-section": "1.1.5",
|
|
39
|
+
"@zhin.js/skill": "1.1.6",
|
|
40
|
+
"@zhin.js/tool": "1.1.6"
|
|
42
41
|
},
|
|
43
42
|
"repository": {
|
|
44
43
|
"type": "git",
|
|
@@ -50,7 +49,7 @@
|
|
|
50
49
|
"registry": "https://registry.npmjs.org"
|
|
51
50
|
},
|
|
52
51
|
"engines": {
|
|
53
|
-
"node": "
|
|
52
|
+
"node": ">=22.19.0"
|
|
54
53
|
},
|
|
55
54
|
"license": "MIT",
|
|
56
55
|
"scripts": {
|