@actiondock/core 2.0.7 → 2.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actiondock/core",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "ActionDock Core Engine - Project loader, runtime execution, SQLite storage, standalone builder, and skill exporter",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -108,10 +108,10 @@ export function initProject(targetDir: string, options: InitOptions = {}): void
108
108
  node: ">=22.12.0",
109
109
  },
110
110
  dependencies: {
111
- "@actiondock/sdk": "^2.0.7",
111
+ "@actiondock/sdk": "^2.0.8",
112
112
  },
113
113
  devDependencies: {
114
- "@actiondock/testing": "^2.0.7",
114
+ "@actiondock/testing": "^2.0.8",
115
115
  "@types/node": "^22.12.0",
116
116
  "tsx": "^4.19.0",
117
117
  "typescript": "^5.7.0",
@@ -1,10 +1,20 @@
1
1
  import { spawnSync } from "node:child_process";
2
2
  import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
3
3
  import { basename, dirname, join, resolve } from "node:path";
4
+ import { pathToFileURL } from "node:url";
4
5
  import YAML from "yaml";
5
6
  import type { ActionDefinition } from "@actiondock/sdk";
6
7
  import type { PlaybookDefinition, PlaybookFrontmatter, ProjectConfig } from "./types";
7
8
 
9
+ /**
10
+ * 将绝对路径规范化为 ESM 动态导入可用的 file:// URL 标识符。
11
+ * Windows 绝对路径(如 D:\a\b.ts)不是合法的 ESM 标识符,会被解析为 "d:" 协议导致
12
+ * 加载失败;POSIX 绝对路径虽可直接导入,统一转换后跨平台行为一致。
13
+ */
14
+ function toImportSpecifier(filePath: string): string {
15
+ return pathToFileURL(filePath).href;
16
+ }
17
+
8
18
  /**
9
19
  * 从指定目录开始向上逐级递归查找包含 `actiondock.json` 的项目根目录。
10
20
  *
@@ -220,7 +230,7 @@ export async function loadActions(
220
230
  // 动态导入,若缺失模块则自动触发依赖重装与二次重试
221
231
  let imported: any;
222
232
  try {
223
- imported = await import(file);
233
+ imported = await import(toImportSpecifier(file));
224
234
  } catch (err: any) {
225
235
  const msg = String(err.message || "");
226
236
  if (
@@ -232,7 +242,7 @@ export async function loadActions(
232
242
  ) {
233
243
  const installed = ensureProjectDependencies(projectRoot, true);
234
244
  if (installed) {
235
- imported = await import(file);
245
+ imported = await import(toImportSpecifier(file));
236
246
  } else {
237
247
  throw err;
238
248
  }
@@ -283,7 +293,7 @@ export async function loadActionFileMap(
283
293
 
284
294
  for (const file of files) {
285
295
  try {
286
- const imported = await import(file);
296
+ const imported = await import(toImportSpecifier(file));
287
297
  const act = imported.default || imported.action;
288
298
  if (act && typeof act === "object" && typeof act.id === "string") {
289
299
  map.set(act.id, {