@specverse/engines 6.18.0 → 6.18.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.
@@ -81,7 +81,7 @@ async function validateTypeScriptTypes(code) {
81
81
  return null;
82
82
  }
83
83
  }
84
- const PROMPT_VERSION = "9.8.0";
84
+ const PROMPT_VERSION = "9.8.1";
85
85
  function cacheKey(step, modelName, operationName, functionName, inputs) {
86
86
  const payload = JSON.stringify({ step, modelName, operationName, functionName, inputs: [...inputs].sort(), v: PROMPT_VERSION });
87
87
  return createHash("sha256").update(payload).digest("hex").slice(0, 16);
@@ -223,7 +223,7 @@ async function generateAiBehaviorsFile(opts) {
223
223
  };
224
224
  const isRealReference = (n, codeOnly) => {
225
225
  const escaped = n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
226
- const re = new RegExp(`(?<![A-Za-z0-9_$])${escaped}(?![A-Za-z0-9_$:])`, "g");
226
+ const re = new RegExp(`(?<![A-Za-z0-9_$.])${escaped}(?![A-Za-z0-9_$:])`, "g");
227
227
  return re.test(codeOnly);
228
228
  };
229
229
  const buildSignatureAndDestructure = (body2) => {
@@ -156,7 +156,7 @@ async function validateTypeScriptTypes(code: string): Promise<string | null> {
156
156
  * produces a new hash. The prompt version is part of the hash so
157
157
  * prompt upgrades also invalidate.
158
158
  */
159
- const PROMPT_VERSION = '9.8.0'; // 9.8: import-whitelist enforcement (#43K-B-review)
159
+ const PROMPT_VERSION = '9.8.1'; // 9.8.1: isRealReference excludes member access (.X) — fixes TS6198 on alias-via-cast bodies
160
160
 
161
161
  function cacheKey(step: string, modelName: string, operationName: string, functionName: string, inputs: string[]): string {
162
162
  const payload = JSON.stringify({ step, modelName, operationName, functionName, inputs: [...inputs].sort(), v: PROMPT_VERSION });
@@ -425,12 +425,16 @@ export async function generateAiBehaviorsFile(opts: {
425
425
 
426
426
  /** Does the body actually USE the local variable `n` (vs only mention
427
427
  * it as an object-literal property name like `step1Result:` in a
428
- * return object)? A real usage is `n` followed by something other than
429
- * `:` i.e. accessed in an expression. We approximate by requiring
430
- * the next non-whitespace char to be a code-meaningful operator/end. */
428
+ * return object, OR as a member access like `inp.token`)? A real
429
+ * usage is `n` not preceded by `.` (which would make it a property
430
+ * access on some other object) and not followed by `:` (object-literal
431
+ * key). The `.` in the lookbehind exclusion catches the case where
432
+ * the LLM aliases input via `const inp = input as any;` and then
433
+ * accesses `inp.token` etc. — the destructured names would otherwise
434
+ * count as referenced and we'd emit an unused-locals destructure. */
431
435
  const isRealReference = (n: string, codeOnly: string): boolean => {
432
436
  const escaped = n.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
433
- const re = new RegExp(`(?<![A-Za-z0-9_$])${escaped}(?![A-Za-z0-9_$:])`, 'g');
437
+ const re = new RegExp(`(?<![A-Za-z0-9_$.])${escaped}(?![A-Za-z0-9_$:])`, 'g');
434
438
  return re.test(codeOnly);
435
439
  };
436
440
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@specverse/engines",
3
- "version": "6.18.0",
3
+ "version": "6.18.1",
4
4
  "description": "SpecVerse toolchain — parser, inference, realize, generators, AI, registry, bundles",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",