progmune-runtime 3.3.2 → 3.3.4

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.
@@ -10,9 +10,13 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
10
10
  import * as fs from "fs";
11
11
  import * as path from "path";
12
12
  import { fileURLToPath } from "url";
13
+ import { createRequire } from "module";
13
14
  import { createLogger } from "./logger.js";
14
- // ── ESM-compatible __dirname (the compiled output is an .mjs module) ──
15
+ // ── ESM-compatible __dirname + require (the compiled output is an .mjs
16
+ // module, but the codebase uses lazy require() for circular-dependency
17
+ // handling — createRequire keeps those working in ESM scope) ──
15
18
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
19
+ const require = createRequire(import.meta.url);
16
20
  // ── Load .env(包目录 + 项目目录,后者优先) ──
17
21
  for (const envPath of [
18
22
  path.resolve(process.env.PROGMUNE_PROJECT_DIR || process.cwd(), ".env"),
package/dist/validator.js CHANGED
@@ -86,13 +86,14 @@ function checkVariableFlow(actions) {
86
86
  };
87
87
  const processAction = (action) => {
88
88
  if (action.kind === "call") {
89
- // call 参数值若是变量引用($ 前缀,或 planner 剥离 $ 后的裸标识符),
90
- // 必须已声明——白皮书 SVL-3:"变量先声明后使用"
89
+ // call 参数值若是显式变量引用($ 前缀),必须已声明——白皮书 SVL-3:
90
+ // "变量先声明后使用"。裸标识符保持字面量语义(可能是枚举值),
91
+ // 不做声明检查。
91
92
  for (const arg of action.args || []) {
92
93
  const val = arg?.value;
93
- if (typeof val !== "string")
94
+ if (typeof val !== "string" || !val.startsWith("$"))
94
95
  continue;
95
- const bare = val.startsWith("$") ? val.slice(1) : val;
96
+ const bare = val.slice(1);
96
97
  if (bare && !isLiteral(bare) && /^[a-zA-Z_]\w*$/.test(bare) && !declared.has(bare)) {
97
98
  errors.push(`变量 '${bare}' 在使用前未声明 (call 参数 '${arg.name || "?"}')`);
98
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "progmune-runtime",
3
- "version": "3.3.2",
3
+ "version": "3.3.4",
4
4
  "description": "Progmune — AI Trust Decision Engine. Verify AI-generated code before it reaches production. Outputs APPROVED / NEEDS_REVIEW / BLOCKED with evidence.",
5
5
  "files": [
6
6
  "dist/",